daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import rlp
  2. from eth_utils import keccak, to_checksum_address, to_bytes
  3.  
  4. def predict_address(sender: str, nonce: int) -> str:
  5.     sender_bytes = to_bytes(hexstr=sender)
  6.     raw = rlp.encode([sender_bytes, nonce])
  7.     h = keccak(raw)
  8.     address_bytes = h[12:]
  9.     return to_checksum_address(address_bytes)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top