-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
I'm trying to use the endpoint with the following python script and I'm getting multiple errors:
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("http://localhost:3000"))
latest_block = w3.eth.get_block("latest")rosettanet/src/rpc/calls/getBlockByNumber.ts
Lines 219 to 240 in 1f10b2a
| result: { | |
| number: '0x' + result.block_number.toString(16), // 'number' is the block number in hex format | |
| baseFeePerGas: '0x13f5345', // This is needed to web3 wallet decides it is eip1559 tx | |
| difficulty: '0x0', // StarkNet does not work in PoW | |
| extraData: '0x0', // StarkNet does not work in PoW | |
| gasLimit: '0x0', // Gas metrics in StarkNet are more focused on individual transactions | |
| gasUsed: '0x0', // Gas metrics in StarkNet are more focused on individual transactions | |
| hash: result.block_hash, | |
| logsBloom: '0x0', // The mechanism for indexing and querying these events in Starknet does not rely on a Bloom filter | |
| miner: '0x0', // StarkNet does not work in PoW | |
| mixHash: '0x0', // StarkNet does not work in PoW | |
| nonce: '0x0', // The nonce here demonstrates computational work, which is not applicable to StarkNet | |
| parentHash: result.parent_hash, | |
| receiptsRoot: '0x0', // No receiptsRoot field returned by StarkNet | |
| sha3Uncles: '0x0', // Uncles are the mechanism for rewarding miners in PoW, which is not applicable to StarkNet | |
| size: '0x0', // No size field returned by StarkNet | |
| stateRoot: '0x' + result.new_root, | |
| timestamp: '0x' + result.timestamp.toString(16), | |
| totalDifficulty: '0x0', // StarkNet does not work in PoW | |
| transactions: result.transactions, | |
| transactionsRoot: '0x0', // No transactionsRoot field returned by StarkNet | |
| uncles: [], // Uncles are the mechanism for rewarding miners in PoW, which is not applicable to StarkNet |
The first two issues concern miner and stateRoot. Miner should be '0x0000000000000000000000000000000000000000' and not 0x0 because it's an address while stateRoot is just result.new_root. result.new_root already has 0x as a prefix.
Sometimes (depending on the block) the script fails the parsing of transaction and/or parentHash fields.
For example for block 444250:
ValueError: Could not format invalid value ['0x75959ff12aa75443b49e8256d8eb210583e09d76f7e5974ea154e11776f4d72',
'0x4ab20634949aaa73331fd7db7fc7610fcceab383f7b931c8512d5da6c5949a2',
'0x2cbee640aa434d4419ed413db959d6ec41927a355fbd7beb0e6934ccb7f0a81',
'0x4b54636f672cca417134218278f8ed65d74fcaa8934932379ef8f1bb8cf2d98',
'0x5e66c49382d3a5fdc4034282d1d9d1e46cab6b439d9d98f35946529fff73e38',
'0x5d3fa68942089b0132aa29908f589c1ce1b088a6d708515276477d3bb2be45',
'0x5f464172f6b7b3962fd0d51e3f7d52fea98a7031abe6896eb84b5b45dcbf8bc',
'0x63552d7c892df22a766f96513b30ae6c520f48e4e60fedb26ac5bc82701b9cd',
'0x4847f3fe65e482f272e338c77d9d6bc893eeca8c014c857829daa93e9880d0',
'0x48ec8c6bca7d715a312806392cd30607393de355e7b8f9e0cfdf8a432c1d9a1',
'0x5de1c85cfbe4962224f39a13694b6da4ea809945d4da8ece91dd17d9dae8670',
'0x4cdc01b397343f0cdb8c95e967a165b41ae1ff6d891d65d00297deb2d511787'] as field 'transactions'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels