简体   繁体   English

如何将以太坊地址转换为公钥

[英]How to convert ethereum addres to public key

I need to convert ethereum address like this 我需要这样转换以太坊地址

0xB34080739D5B656D76089f9f21b374BA5dafA373 0xB34080739D5B656D76089f9f21b374BA5dafA373

to public key like this 这样的公钥

e2d3a3a43e71eb541e12504cee22ed74024969b46b9e68ea7f9e5384fe96fc04 e2d3a3a43e71eb541e12504cee22ed74024969b46b9e68ea7f9e5384fe96fc04

I got the address this way 我这样得到地址

from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://sokol.poa.network'))

addr = w3.toHex(w3.sha3(text=public_key)[12:])

Maybe there is a library for that? 也许有图书馆吗? help pls 帮助请

This is not possible. 这是不可能的。

An ethereum address (for an externally owner account, which is an account linked to a private key) is the last 20 bytes of keccak256(public_key) . 以太坊地址(对于外部所有者帐户,该帐户是链接到私钥的帐户)是keccak256(public_key)的最后20个字节。 Since keccak256 is a hash function, and thus a one-way function, there is no way to recover the public key from the address. 由于keccak256是哈希函数,因此是单向函数,因此无法从地址中恢复公钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM