4 ms·
FWIW, I was looking at eth code in the weekend and it's pretty accessible (I was looking at go -- I've read that eth python should be even more readable). The
by ecesena 9y ago
FWIW, I was looking at eth code in the weekend and it's pretty accessible (I was looking at go -- I've read that eth python should be even more readable).
The address part is very similar, even simpler, than bitcoin. It's the same elliptic curve, same way to build private/public keys.
For the address, it uses a different hash function, Keccak256, and then it's just serialized in hex. Code here [1]. Pointers to key generation [2, 3].
[1] https://github.com/ethereum/go-ethereum/blob/release/1.6/crypto/crypto.go#L181 https://github.com/ethereum/go-ethereum/blob/release/1.6/cry...
[2] https://github.com/ethereum/go-ethereum/blob/release/1.6/accounts/keystore/key.go#L169 https://github.com/ethereum/go-ethereum/blob/release/1.6/acc...
[3] https://github.com/ethereum/go-ethereum/blob/release/1.6/accounts/keystore/key.go#L138 https://github.com/ethereum/go-ethereum/blob/release/1.6/acc...
- tuxxy 9y agoKeccak256? Isn't that just SHA3 with a digest of 256 bits?
- ecesena 9y agoI'm unsure. I think this came before sha3 was defined so some parameters may have changed. But the core is essentially that.
- tylersmith 9y agoThere are minor padding differences but that's it.
- ryan-c 9y agoNo, it's slightly different from SHA3-256. There was a tweak for standardization.