![](/img/trans.png)
[英]Cannot unmarshal non-string into Go struct field SendTxArgs.from of type common.Address
[英]Geth "invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Address" error
我向 Geth 發出以下請求:
POST http://localhost:8545
{
"jsonrpc":"2.0",
"id":1,
"method": "eth_sign",
"params": [
{
"from": "0xDc89096c0E279933a7C99e13f1474A0a84320207",
"gas": "0x55555",
"maxFeePerGas": "0x1234",
"maxPriorityFeePerGas": "0x1234",
"input": "",
"nonce": "0x0",
"to": "0xCdde93eEDC6c911D33E7fe41DC05208E0630a4c0",
"value": "0x1234"
}
]
}
但出現以下錯誤:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Address"
}
}
Geth 版本:Geth/v1.10.26-stable-e5eb32ac/windows-amd64/go1.18.5
什么是原因?
eth_sign用於簽署任意消息 - 而不是交易 - 並采用 2 個參數:
根據您傳遞的參數,您似乎想要簽署一項交易。 為此,有eth_signTransaction方法。
同樣,只有當節點知道發件人地址的私鑰並且持有私鑰from
帳戶在節點上解鎖時,它才會成功。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.