CRYPTO NEWS

How to sign a simple transfer TX with digitalbitbox python api

I’m trying to sign a simple transfer transaction using digitalbitbox’s python api (see here and code snippet below).

I send the following json to the HW wallet api:

Sending: {“sign”:{“data”:[{“keypath”:”m/1/1/1/0″, “hash”:”f2243e10c5c4f4ca1ba2f4cac89e5996ede01c101c8f510440a027b5faaf96a7″}]}}

The signed TX hash returned by the HW wallet is:

0653b763d72e0dc39624310f88b1bda611e94611c5f79ad75132d4305f25dc2c3aac17c3c94a519fbc7da3b9c898a7fae26c68d49d13b604ea8a7ceaad0f1da9

However, when pasting this into etherscan I receive the following error:

Error! Unable to broadcast Tx : {“jsonrpc”:”2.0″,”id”:1,”error”:{“code”:-32000,”message”:”rlp: expected input list for types.txdata”}}

I was expecting too see some error message like insufficient funds, but it seems like my encoding is wrong.

Does anybody know why this isn’t working?

import sys from dbb_utils import * import time import rlp  try:     password = 'password'     openHid()      # Start up options - factory reset; initial password setting     if 0:         hid_send_encrypt('{"reset":"__ERASE__"}', password)         hid_send_plain('{"password":"' + password + '"}')         sys.exit()      import ethereum     from ethereum.transactions import Transaction     import hashlib      # Create test TX     testTx = Transaction(nonce=5, gasprice=24000000000, startgas=21000, to=int("0xfc5d975c3738b1eed1f072d72912bea31f9d1eb1", 16), value=1, data="")     rawTx = ethereum.utils.encode_hex(ethereum.utils.sha3(rlp.encode(testTx))) #hashlib.sha256(rlp.encode(testTx)).hexdigest()     message = '{"sign":{"data":[{"keypath":"m/1/1/1/0", "hash": "' + rawTx + '"}]}}'      # Send a JSON command     response = hid_send_encrypt(message, password)     print(response)     print("*"*40)     cmd = '{"sign":""}'     response = hid_send_encrypt(message, password)     print(response)  except IOError as ex:     print(ex) except(KeyboardInterrupt, SystemExit):     print("Exiting code")  dbb_hid.close() 

Can I subtract 2 ciphertexts in FHE exactly?

In most FHE schemes, for a polynomial $m_1$, $$enc(m_1) = a_1*s + e_1 + m_1$$ Suppose I have $enc(m_1),enc(m_2)$. Can I subtract them exactly? Sum works, but subtraction is: $$enc(m_1) – enc(m_2) = (a_1-a_2)*s + e_1-e_2 + m_1-m_2$$ In the case where $e_1-e_2$ is negative, this gives us problems in the decryption (cleaning of small::Listen

In most FHE schemes, for a polynomial $m_1$,

$$enc(m_1) = a_1*s + e_1 + m_1$$

Suppose I have $enc(m_1),enc(m_2)$. Can I subtract them exactly? Sum works, but subtraction is:

$$enc(m_1) – enc(m_2) = (a_1-a_2)*s + e_1-e_2 + m_1-m_2$$

In the case where $e_1-e_2$ is negative, this gives us problems in the decryption (cleaning of small error bits by shift right). Example:

$$enc(m_1) – enc(m_2) – (a_1-a_2)*s = e_1-e_2 + m_1-m_2$$

the final step for decryption would be $upper(e_1-e_2 + m_1-m_2)$ but if $e_1-e_2$ is negative, it’s actually a very large positive (2’s complement or in this case, modulus complement), so upper will not work.

Another way would be to transform $enc(m_2)$ into $enc(-m2)$ homomorphically, then do $enc(m_1)+enc(m_2)$ but to do this in some schemes, subtraction is needed, so it won’t work.

How to sign a simple transfer TX with digitalbitbox python api

Shopping cart
There are no products in the cart!
Continue shopping
0