30 go-ethereum 这个库的 BlockByNumber 方法 报 这个错误 transaction type not supported

请教大佬们一些问题,就是用 go-ethereum 这个库去获取 arb 链的某个区块的数据,但是会报错transaction type not supported,目前看来是json解析错误,但是我实际把请求回来的json数据直接解析,发现是没有问题的,目前没啥头绪,不知道什么清楚

具体代码如下:(这个会报错:transaction type not supported)

// 连接到 Arbitrum 区块链节点的 RPC 端点
client, err := ethclient.Dial("https://rpc.ankr.com/arbitrum") // 替换为正确的 RPC 地址

if err != nil {
        fmt.Println("无法连接到节点:", err)
        return
}

// 要查询的区块高度
blockHeight := big.NewInt(10000) // 替换为您要查询的区块高度

// 获取指定高度的区块
block, err := client.BlockByNumber(context.Background(), blockHeight)

if err != nil {
        fmt.Println("无法获取区块:", err)
        return
}

// 打印区块中的交易列表
fmt.Println("交易数量:", len(block.Transactions()))
fmt.Println("交易列表:")

for _, tx := range block.Transactions() {
        fmt.Println(tx)
}

实际返回的Json自己用 json.Unmarshal 来解析是没有问题


{"difficulty":"0x0","extraData":"0x","gasLimit":"0x112a6c78","gasUsed":"0x8f","hash":"0x89f452a436be29df340c7de66cf3bfd8987680bba1aabc86b6622034c26d1874","l1BlockNumber":"0xbf22b3","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0xa","parentHash":"0x7c85fabd83333240fc9fbbfa9809681cf528a8a23050f3c18de8206551925b47","receiptsRoot":"0xe4e8923542319d4ff1a207426370f04c56f3c88c62ede084e89dca7da063079d","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x2b2","stateRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","timestamp":"0x60b19675","totalDifficulty":"0x0","transactions":[{"blockHash":"0x89f452a436be29df340c7de66cf3bfd8987680bba1aabc86b6622034c26d1874","blockNumber":"0xa","from":"0x1c7d91ccbdbf378bac0f074678b09cb589184e4e","gas":"0x279f","gasPrice":"0x0","hash":"0x53a1b331a943cbeb23859f798cf753869d89591c6020b6f07938da3dcb378045","input":"0xc746c8f40000000000000000000000008f99b0b48b23908da9f727b5083052d5099e6aea","nonce":"0x8","to":"0x000000000000000000000000000000000000006b","transactionIndex":"0x0","value":"0x0","type":"0x78","v":"0x14985","r":"0xcf83f363976a02ee3e48a9706a29a228b30d73db19c52169467b49a3dca8a089","s":"0x26ec8e1ce0e5e447baecb0fb0a8068713dde3c24dc815b84cd864bf6e6e542af"}],"transactionsRoot":"0x91008c8aedcfb2969a29fb874bb1b17c5947e9da3303a01f5d7059728e2be137","uncles":[]}
请先 登录 后评论

2 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
Duanraudon
请先 登录 后评论