I'm trying to bind a H160 address with a H256 address, if we assume this function:

fn bind(origin: OriginFor<T>, address: H160 , signature: [u8; 130]) -> Result<(), Error<T>>{
    // check the signature belonging to an address
    ensure!(check_signature(address, signature), Error<T>);

    // bind the sender with the address
    create_account(sender, address);


Is this function available in Substrate? Or do you have any advice on how to do the bind function?

  • 2
    The "bind" function you want to create seems very similar to what the Proxy account system does. Have to looked at that code to see how it works?
    – Shawn Tabrizi
    Mar 17, 2022 at 14:10
  • It's not really clear what you're asking, it would help to get context on what you're trying to achieve. The H160 format is just the first 20 bytes of the H256 address. The function you're proposing should probably be taking some H256 address and then making the conversion to H160 by truncating it. Mar 25, 2022 at 14:05
  • In acala they provide a mapping pallete wiki.acala.network/build/development-guide/smart-contracts/…
    – katapulte
    Aug 17, 2022 at 17:34

2 Answers 2


H160 has a few flavors that you might pursue in the context of a Substrate chain:

  • If you are looking to map H160 Ethereum addresses to, say, SR25519 that is most common in Substrate chains, it is good to see the implementation in Frontier as a reference. Here a truncated hash scheme is used (H256 -> H160 by taking the first 160 (LE) bytes in the address). There are some tools to inspect truncated vs. Ethereum converted (ECDSA <-> SR25519) addresses in the frontier node template.

  • Another important example is to use H160 addresses as the base for accounting in you chain, this is exemplified in Moonbeam's Unified Accounts


because this PR was merged, Frontier now also supports Moonbeam's Unified Accounts (aka AccountId20)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.