1

In Ethereum, the wallet address is the last 20 bytes of the keccak256 hash of the public key of the wallet.

I am working with Hyperledger Fabric EVM, and I would like to know which is the mechanism that is used to generate the address from the public key.

I applied keccak256, sha256, and sha-3 256 to my public key, but I didn't get the correct address...

It is my private key in pem format:

-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgjUp+AWrFlIVp13Dl
rpm/Uu2M++ZhOC4AbmjWdsofP7ihRANCAARWnvMdt+149KEt9yPKoLHG98lL5wPe
cGVMBMxsJhz3JLBSQlBCfLMz8fe5vIng4N7TGYt66P2HNeG/fLjwt7jI
-----END PRIVATE KEY-----

It is my public key in pem format:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVp7zHbftePShLfcjyqCxxvfJS+cD
3nBlTATMbCYc9ySwUkJQQnyzM/H3ubyJ4ODe0xmLeuj9hzXhv3y48Le4yA==
-----END PUBLIC KEY-----

It is my public key in hex format:

Public_key = 0x04569ef31db7ed78f4a12df723caa0b1c6f7c94be703de70654c04cc6c261cf724b0524250427cb333f1f7b9bc89e0e0ded3198b7ae8fd8735e1bf7cb8f0b7b8c8

And it is my address:

13065B11B498911F2A19815035D0AC24457D1BB6

I am using secp256r1

1 Answers1

1

The address is the last 20 bytes of the sha3-256 of 3059301306072a8648ce3d020106082a8648ce3d030107034200 + public_key_hex

In my example, take the last 160 bits (20 bytes) of "result" :

var Public_key = 0x04569ef31db7ed78f4a12df723caa0b1c6f7c94be703de70654c04cc6c261cf724b0524250427cb333f1f7b9bc89e0e0ded3198b7ae8fd8735e1bf7cb8f0b7b8c8
var result = SHA3_256(0x3059301306072a8648ce3d020106082a8648ce3d030107034200 + Public_key)
var address = last_20bytes(result)

console.log("address = ",address);

//address = 13065B11B498911F2A19815035D0AC24457D1BB6