The contract at address 0x04 is the identity function. What is it and what are use cases for it?

  • 4
    excuse my ignorance, what is "address 4"?
    – q9f
    Jan 23, 2016 at 12:53
  • Addresses are just numbers. Your address is in hex and try converting it to decimal. Addresses don't have to be such large numbers though, so this precompiled contract was put at address 4 (instead of say 4 trillion).
    – eth
    Jan 23, 2016 at 20:45

4 Answers 4


The Identity function simply returns whatever its input is.

At a talk given by Vitalik Buterin, it's for efficient data copying.

It costs 15 gas + 3 gas for each 32 bytes of input data (rounded up).

It is a precompiled contract located at address 4.

  • 1
    Could anyone paste a link to the talk where Vitalik describes this efficient data copying via the identity function? Jan 6, 2019 at 14:57

As defined on page 18 of Ethereum's formal specification written by Gavin Wood (a.k.a the "Yellow Paper"), there are 4 pre-compiled contracts that are mapped to addresses 1-4 in the Ethereum blockchain, as demonstrated in this Pyeth snippet:

specials = {
    decode_hex(k): v for k, v in
        '0000000000000000000000000000000000000001': proc_ecrecover,
        '0000000000000000000000000000000000000002': proc_sha256,
        '0000000000000000000000000000000000000003': proc_ripemd160,
        '0000000000000000000000000000000000000004': proc_identity,

The first 3 functions are ECDSARECOVER, RIPEMD-160, and SHA2-256. The fourth function is the "Identity function"](https://en.wikipedia.org/wiki/Identity_function). The identity function "simply defines the output as the input".

From the yellow paper: Yellow Paper pg. 18

Precompiled contracts' addresses need a little bit of ether deposited so that it's cheaper to call them. Message calls to non-existent accounts are more expensive, so we don't want to let developers pay the gas for initialising the accounts when the network could do it in the first place.

Update: Since Byzantium, there are 4 more precompiled contracts: Modular Exponentiation, alt_bn128 Addition, alt_bn128 Scalar Multiplication and alt_bn128 Pairing Checks at addresses 0x05, 0x06, 0x07 and 0x08 respectively.

  • But what are its uses? Is it just for testing?
    – MrChico
    Mar 5, 2016 at 21:45
  • 1
    For "why account addresses 1-4 need 1 wei to start" please post answer to: ethereum.stackexchange.com/q/1607/42
    – eth
    Apr 28, 2016 at 16:16

If you're looking for a formal description, check out Appendix E of the yellow paper:

Yellow Paper Identity Function


  • Ξpre = a function which checks the call has enough gas, reverts otherwise
  • gr = resulted gas cost, 15 + 3 for every 32 bytes of input data
  • Id = the identity's function input data

Identity on Ethereum

We can now attempt to create the Identity implementation on Ethereum. We are grateful to Ethereum, ConsenSys, Factom, IDCubed and other developers who helped us hone the ideas found below. Ethereum concepts

  1. Ethereum has a notion of an account, unlike the bitcoin. Account has the associated private/public keys.
  2. Ethereum has a notion of a contract, which is a code executed by Ethereum nodes.
  3. Unlike a bitcoin transaction that goes from many inputs to many outputs, Ethereum transaction goes from one account to another, or from one account to a contract.
  4. Contract is code that can also store key-value pairs. This makes it possible to manage identities. This contract store is expensive, and with high probability we will move the part that do not require strong consensus, to a separate store (DHT).
  5. In DHT-based design we relied on object versioning where versions formed a linked list. In Ethereum we forego this approach and rely on a combination of transactions and the current identity state in Identity contract's store.

Source: https://github.com/tradle/about/wiki/Identity-on-Ethereum


Your Answer

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

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