這是我透過bingchatgpt產生的private key產生public address
的eth python code
如下
import hashlib
import ecdsa
# Generate a private key
#private_key =
"f4e5d767e3e044f852dee70037d8d3555549614c8b62a4899e60bcf85472c380"
private_key =
ecdsa.SigningKey.from_string(bytes.fromhex("f4e5d767e3e044f852dee70037d8d3555549614c8b62a4899e60bcf85472c380"),
curve=ecdsa.SECP256k1)
# Derive the public key from the private key
public_key = private_key.get_verifying_key().to_string()
# Derive the Ethereum address from the public key
keccak = hashlib.sha3_256()
keccak.update(public_key)
address = "0x" + keccak.hexdigest()[24:]
# Print the results
print("Private key:", private_key.to_string().hex())
print("Public key:", public_key.hex())
print("Address:", address)
可以成功算出一個public address 但是就是跟myetherwallet算出的不一樣
我已經試了三四個版本的code寫出來都跟myetherwallet算出的不一樣
有沒有高手能指點一下那裡出錯了