Parity

奇偶校驗:確定事務是否是來自 JSON-RPC 呼叫的內部事務

  • January 9, 2018

鑑於 JSON-RPC 呼叫(呼叫奇偶校驗存檔節點)的結果,除了查看交易收據中使用的氣體並假設所有內部交易都不會有任何方法來判斷交易是否是內部交易使用的氣體為 21,000?

這是一個內部事務的範例事務:

curl --data '{"method":"eth_getTransactionByHash","params":["0xc10dc94647a1b79ba475a388b4a5f264e6a2d56f6586579cf635672162be545b"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

和輸出:

{"jsonrpc":"2.0","result":
{"blockHash":"0xcc66cae4d1d4b42fe055b62f0abdae1920310409d09552570955392adcfca01c",
"blockNumber":"0x1e84fc","condition":null,"creates":null,
"from":"0xa49ba69549a3313a9bb03f6fadaf7bc9e09777b5",
"gas":"0x15f90",
"gasPrice":"0x4a817c800",
"hash":"0xc10dc94647a1b79ba475a388b4a5f264e6a2d56f6586579cf635672162be545b",
"input":"0x0f2c9329000000000000000000000000023f0263868a48436dca3c951656a6c6f0191dc5000000000000000000000000a49ba69549a3313a9bb03f6fadaf7bc9e09777b5",
"networkId":null,
"nonce":"0x1",
"publicKey":"0x72a2913a7c9b3aeb5af0c59db52da5db4e5b68b7abc3cf469625147825009e181418da4106aa8add9459886a4926be64b3e15d8a35a8a4907da6957b71e65619",
"r":"0x8a581d305ffe09d9dd807782a3449f6e97d994630cd0f034f31c932d29e6df13",
"raw":"0xf8b4018504a817c80083015f9094aa1a6e3e6ef20068f7f8d8c835d2d22fd51164448a016905a6fad2940fc388b8440f2c9329000000000000000000000000023f0263868a48436dca3c951656a6c6f0191dc5000000000000000000000000a49ba69549a3313a9bb03f6fadaf7bc9e09777b51ba08a581d305ffe09d9dd807782a3449f6e97d994630cd0f034f31c932d29e6df13a061800116d1fcb7bb6a94b102f79547e3a012ff0a46084a3a53245e987c863765",
"s":"0x61800116d1fcb7bb6a94b102f79547e3a012ff0a46084a3a53245e987c863765",
"standardV":"0x0",
"to":"0xaa1a6e3e6ef20068f7f8d8c835d2d22fd5116444",
"transactionIndex":"0x1a",
"v":"0x1b",
"value":"0x16905a6fad2940fc388"}
,"id":1}

從我的繼續調查來看,確定消息是否被呼叫(也稱為合約交易/內部交易)的最佳方法似乎是確定相關方的地址中是否有程式碼。使用 Parity Archive 節點,這涉及使用 get_EthCode 並查看返回的字元串中是否存在任何內容(預設值 0x 除外)。

Get_EthCode 記錄在這裡: https ://paritytech.github.io/wiki/JSONRPC-eth-module#eth_getcode

“內部交易”並不是真正的交易。最好將其稱為call。將其稱為交易是當人們試圖使用從比特幣繼承的範式製作乙太坊區塊瀏覽器時出現的一種術語捏造。

“內部交易”沒有交易雜湊、簽名、隨機數等,除非這些是從它所屬的實際交易繼承而來的。

您範例中的交易不是“內部交易”。如果是,它就不會有交易雜湊。

引用自:https://ethereum.stackexchange.com/questions/35299