funga

Signer and keystore daemon and library for cryptocurrency software development
Log | Files | Refs | README | LICENSE

commit 23a5e8dcd0211857d86d24f8f108719671ea185d
parent 86ef9bdb5603179286b4c3919c99d6a909d56ef4
Author: nolash <dev@holbrook.no>
Date:   Mon, 12 Apr 2021 19:09:11 +0200

Export canonical order method

Diffstat:
Acrypto_dev_signer/eth/encoding.py | 5+++++
Mcrypto_dev_signer/eth/transaction.py | 10++++++----
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/crypto_dev_signer/eth/encoding.py b/crypto_dev_signer/eth/encoding.py @@ -0,0 +1,5 @@ +ethereum_recid_modifier = 35 + +def chain_id_to_v(chain_id, signature): + v = signature[64] + return (chain_id * 2) + ethereum_recid_modifier + v diff --git a/crypto_dev_signer/eth/transaction.py b/crypto_dev_signer/eth/transaction.py @@ -13,10 +13,12 @@ from hexathon import ( # local imports from crypto_dev_signer.eth.encoding import chain_id_to_v -from crypto_dev_signer.eth.rlp import rlp_encode +#from crypto_dev_signer.eth.rlp import rlp_encode +import rlp logg = logging.getLogger().getChild(__name__) +rlp_encode = rlp.encode class Transaction: @@ -91,7 +93,7 @@ class EIP155Transaction: self.sender = strip_0x(tx['from']) - def __canonical_order(self): + def canonical_order(self): s = [ self.nonce, self.gas_price, @@ -108,7 +110,7 @@ class EIP155Transaction: def bytes_serialize(self): - s = self.__canonical_order() + s = self.canonical_order() b = b'' for e in s: b += e @@ -116,7 +118,7 @@ class EIP155Transaction: def rlp_serialize(self): - s = self.__canonical_order() + s = self.canonical_order() return rlp_encode(s)