簡體   English   中英

Geth“無效參數 0:json:無法將非字符串解組為 Go 類型 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 個參數:

  1. 簽字人的地址。 它假定簽名者在節點上有一個未鎖定的帳戶(即節點知道派生到該地址的私鑰)。
  2. 要簽名的消息

根據您傳遞的參數,您似乎想要簽署一項交易。 為此,有eth_signTransaction方法。

同樣,只有當節點知道發件人地址的私鑰並且持有私鑰from帳戶在節點上解鎖時,它才會成功。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM