py-substrate-interface icon indicating copy to clipboard operation
py-substrate-interface copied to clipboard

evm address to substrate address function

Open jpgundrum opened this issue 7 months ago • 0 comments

Similar functionality to the evmToAddress function in ts - but for python.

How to use:

    evm_address = "0x3e3FF16083Bf0a444B8fF86C7156eB3368e3cefB"
    ss58_format = 42
    ss58_address = evm_to_address(evm_address, ss58_format)
    print(f"SS58 Address: {ss58_address}")

Can see the evm address in the Explorer. After clicking on the View Substrate Data button you will see how the Substrate Address matches the one outputted from the code example above.

Please double check for faulty logic and confirm with tests on your side. Not sure if there is a python implementation for this anywhere... if there is please make it public so it is easier to use.

jpgundrum avatar Apr 04 '25 22:04 jpgundrum