do anyone know how to compute an ethereum address from a public key using keccak / secp256k1 ? i'm trying to learn without using ethers/web3js

Jun 21, 2022, 1:41 PM
i create a new pk
let privateKey = crypto.randomBytes(32).toString('hex')

then i create a public key using secp256k1
let pubKey = secp256k1.publicKeyCreate(privateKey,false)

but if i pass the pubKey to keccak it doesn't return the computed address even if i get the proper 20 bytes
forget about it, i forgot to slice 1 position from the start of the pub key , now it works as expected lol
Jun 21, 2022, 1:49 PM
two private keys can theoretically generate the same pub key, anything concerning?
Jun 21, 2022, 2:03 PM
i want to think that the range of possible keys si so large (2^160) that we dont need to worry but im not sure how this will scale if suddenly everyone starts using ethereum wallets

2^160 possible public address and 2^256 possible private keys makes 2^96 pks for each public address , it looks like a lot but 2^160 is quite huge. to compare the estimated amount of grains of sand on earth are about 2^76. its hard to wrap my brain over these huge numbers lol
Jun 21, 2022, 2:17 PM
yeah one day I'll wake up with empty funds on my Trezor lol
Jun 21, 2022, 2:24 PM

© 2024 Draquery.com All rights reserved.