CAFECA-IO / auditing_system

1 stars 0 forks source link

decode nft transaction receipt. #106

Closed YangIsCoding closed 9 months ago

YangIsCoding commented 9 months ago

Decode nft transaction receipt. now the transaction receipt has been decoded

YangIsCoding commented 9 months ago

using 3 hrs

YangIsCoding commented 9 months ago
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0x21ac70286c2902b7721a9a9ff780c93b5bc88e7dfca734ba1a8ddb05b3918415",
        "blockNumber": "0x2e799",
        "contractAddress": null,
        "cumulativeGasUsed": "0x30760",
        "effectiveGasPrice": "0x3b9aca07",
        "from": "0x2390b5b1da7a78266111143d503d50c4636f5680",
        "gasUsed": "0x30760",
        "logs": [
            {
                "address": "0xc53eef459e90d9bf617bb31b15e8092a92582f81",
                "topics": [
                    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                    "0x0000000000000000000000002390b5b1da7a78266111143d503d50c4636f5680",
                    "0x0000000000000000000000000000000000000000000000000000000000000002"
                ],
                "data": "0x",
                "blockNumber": "0x2e799",
                "transactionHash": "0xfb04a4dc9032c0f075505dceaea54bff34d9f7e2bbe536d7f7d376c974c33b27",
                "transactionIndex": "0x0",
                "blockHash": "0x21ac70286c2902b7721a9a9ff780c93b5bc88e7dfca734ba1a8ddb05b3918415",
                "logIndex": "0x0",
                "removed": false
            },
            {
                "address": "0xc53eef459e90d9bf617bb31b15e8092a92582f81",
                "topics": [
                    "0x0906de9482010ff399527d704f0e039c9cff89fec923813be88cea6b696713c0",
                    "0x0000000000000000000000002390b5b1da7a78266111143d503d50c4636f5680",
                    "0x0000000000000000000000000000000000000000000000000000000000000002"
                ],
                "data": "0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000659f9e8200000000000000000000000000000000000000000000000000000000659f9e840000000000000000000000000000000000000000000000000000000000000042307837333635363336663665363435663732363537303666373237343030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000",
                "blockNumber": "0x2e799",
                "transactionHash": "0xfb04a4dc9032c0f075505dceaea54bff34d9f7e2bbe536d7f7d376c974c33b27",
                "transactionIndex": "0x0",
                "blockHash": "0x21ac70286c2902b7721a9a9ff780c93b5bc88e7dfca734ba1a8ddb05b3918415",
                "logIndex": "0x1",
                "removed": false
            }
        ],
        "logsBloom": "0x04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000010800000000000000000000000010000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000100000000000000000000000000000000000000000000000002000000800000000000000000000000000000080000000000010020000010000000000000000000001000000000000000008000000000000004000000",
        "status": "0x1",
        "to": "0xc53eef459e90d9bf617bb31b15e8092a92582f81",
        "transactionHash": "0xfb04a4dc9032c0f075505dceaea54bff34d9f7e2bbe536d7f7d376c974c33b27",
        "transactionIndex": "0x0",
        "type": "0x2"
    }
}
YangIsCoding commented 9 months ago

logs decoded:

event ReportNFTMinted(address indexed recipient, uint256 indexed newItemId, string reportName, uint256 startTime, uint256 endTime); , event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

YangIsCoding commented 9 months ago

data decoded, you have to provide ABI and use ethers.js to decode it:

image
YangIsCoding commented 9 months ago
字符串偏移量:偏移量為192個字符(96字節)。 reportName 字符串的數據從第192個字符開始。

startTime 解析:解析後的 startTime 值為 1704959618(十進制)。

endTime 解析:解析後的 endTime 值為 1704959620(十進制)。

reportName 字符串長度:字符串長度的十六進制表示為 '0000000000000000000000000000000000000000000000000000000000000042'。轉換為十進制後,這表示字符串長度是 66 個字符。

reportName 字符串內容:解析後的字符串內容是 '0x7365636f6e645f7265706f727400000000000000000000000000000000\x00\x00\x00\x00\x00\x00'。這個十六進制串代表 "second_report",伴隨著一些填充的零。