#!/usr/bin/env python3 """ You will need to install the pycryptodome package. You can do it with: pip3 install pycryptodome Note: To install pip3, run the following command sudo apt install python3-pip """ import codecs from Crypto.Hash import keccak # An example of public key is: a33e56a80b9dc83a4456265d877c0765cea76146e625572fc679804f8867222ca3c816433a9b6e6690b0b8e919ffa874982706e812314aae09d85fc62fc4fa3c public_key_bytes = codecs.decode("your public key here", "hex") keccak_hash = keccak.new(digest_bits=256) keccak_hash.update(public_key_bytes) keccak_digest = keccak_hash.hexdigest() wallet_len = 40 wallet = "0x" + keccak_digest[-wallet_len:] print("address", wallet)