Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rkdud007/toji

CLI toolkit for EVM blockchains, retrieving rlp encoded block headers and hashes
https://github.com/rkdud007/toji

ethereum evm rlp

Last synced: 8 days ago
JSON representation

CLI toolkit for EVM blockchains, retrieving rlp encoded block headers and hashes

Awesome Lists containing this project

README

        

## Toji

CLI toolkit for all EVM blockchains, to get `rlp encoded block header`, `raw block header`, `block hash` mainly purpose for debugging block hash/header calculation.

Note: updated until latest dencun update

### Installation

```
cargo install --git https://github.com/rkdud007/toji --locked --force
```

### Usage

```
❯ toji --help
Usage: toji [OPTIONS] --rpc-url --block-number

Options:
-r, --rpc-url The RPC endpoint
-n, --block-number The block number to query
-h, --help Print help Print help
```

### Example

Request

```
toji -r "https://ethereum-goerli.publicnode.com" -n 10399990
```

Response

```
Raw JSON Block Header :EvmBlockHeaderFromRpc { number: "0x9eb0f6", hash: "0x2ef5bd5264f472d821fb950241aa2bbe83f885fea086b4f58fccb9c9b948adcf", difficulty: "0x0", extra_data: "0x496c6c756d696e61746520446d6f63726174697a6520447374726962757465", gas_limit: "0x1c9c380", gas_used: "0x6f9a8e", logs_bloom: "0x0420000a200308000025201005a30400008962800402185dc600144280040082221400010101200458002b0d88008028004206808408400402108f0812246200240a204365100109051c082a020081204200001060440090044044448100082100028001060640c011401a802000090331000408243804009402201240802082820403801141050a4a00208283202050000f10058894008000411050512800220a200000042275800280894080000202460040030000408001ce00282400000002a8c24210000200014a30040015020b04800020608800000850440240c06100011002000000200988001800000880128a050400329081c144080a0408000004", miner: "0xb636a68f834b4d75af9edc5fb0138bb4758ed293", mix_hash: "0xc653e1c1cee990147f4439776cc3ead6f175e081998c33c93da41653112e89ce", nonce: "0x0000000000000000", parent_hash: "0x45adb684cb5458019c496206c1383894c360fe969a1028ba44955eadfa585cc5", receipts_root: "0x361590775fea7857cc048b9324c03e96f287199803ce1440ff1e12c5c6008049", sha3_uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", size: "0x13aa2", state_root: "0x1db2388923f7c78680b4a46bae725637013d74ad787ec5c861d3ade3df882d81", timestamp: "0x65aa8780", total_difficulty: "0xa4a470", transactions_root: "0x93586eb5f2781ded334a2a03d178f41dc06f271d7f1ff429e4da6ef42d12a773", base_fee_per_gas: Some("0xd"), withdrawals_root: Some("0x39db3f9d1fe0756e5aef4e2f0241ad957e999e49c981809c018425d0080f6cd2"), blob_gas_used: Some("0x40000"), excess_blob_gas: Some("0x5320000"), parent_beacon_block_root: Some("0x713ce910d12e99ba96492ff2f6411d4e0a3e567ab419e92e60cf5fc4aa74db7a") }

Raw Block Header :Header { parent_hash: 0x45adb684cb5458019c496206c1383894c360fe969a1028ba44955eadfa585cc5, ommers_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, beneficiary: 0xb636a68f834b4d75af9edc5fb0138bb4758ed293, state_root: 0x1db2388923f7c78680b4a46bae725637013d74ad787ec5c861d3ade3df882d81, transactions_root: 0x93586eb5f2781ded334a2a03d178f41dc06f271d7f1ff429e4da6ef42d12a773, receipts_root: 0x361590775fea7857cc048b9324c03e96f287199803ce1440ff1e12c5c6008049, withdrawals_root: Some(0x39db3f9d1fe0756e5aef4e2f0241ad957e999e49c981809c018425d0080f6cd2), logs_bloom: 0x0420000a200308000025201005a30400008962800402185dc600144280040082221400010101200458002b0d88008028004206808408400402108f0812246200240a204365100109051c082a020081204200001060440090044044448100082100028001060640c011401a802000090331000408243804009402201240802082820403801141050a4a00208283202050000f10058894008000411050512800220a200000042275800280894080000202460040030000408001ce00282400000002a8c24210000200014a30040015020b04800020608800000850440240c06100011002000000200988001800000880128a050400329081c144080a0408000004, difficulty: 0x0_U256, number: 10399990, gas_limit: 30000000, gas_used: 7314062, timestamp: 1705674624, mix_hash: 0xc653e1c1cee990147f4439776cc3ead6f175e081998c33c93da41653112e89ce, nonce: 0, base_fee_per_gas: Some(13), blob_gas_used: Some(262144), excess_blob_gas: Some(87162880), parent_beacon_block_root: Some(0x713ce910d12e99ba96492ff2f6411d4e0a3e567ab419e92e60cf5fc4aa74db7a), extra_data: 0x496c6c756d696e61746520446d6f63726174697a6520447374726962757465 }

RLP Encoded Block Header :"f90266a045adb684cb5458019c496206c1383894c360fe969a1028ba44955eadfa585cc5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794b636a68f834b4d75af9edc5fb0138bb4758ed293a01db2388923f7c78680b4a46bae725637013d74ad787ec5c861d3ade3df882d81a093586eb5f2781ded334a2a03d178f41dc06f271d7f1ff429e4da6ef42d12a773a0361590775fea7857cc048b9324c03e96f287199803ce1440ff1e12c5c6008049b901000420000a200308000025201005a30400008962800402185dc600144280040082221400010101200458002b0d88008028004206808408400402108f0812246200240a204365100109051c082a020081204200001060440090044044448100082100028001060640c011401a802000090331000408243804009402201240802082820403801141050a4a00208283202050000f10058894008000411050512800220a200000042275800280894080000202460040030000408001ce00282400000002a8c24210000200014a30040015020b04800020608800000850440240c06100011002000000200988001800000880128a050400329081c144080a040800000480839eb0f68401c9c380836f9a8e8465aa87809f496c6c756d696e61746520446d6f63726174697a6520447374726962757465a0c653e1c1cee990147f4439776cc3ead6f175e081998c33c93da41653112e89ce8800000000000000000da039db3f9d1fe0756e5aef4e2f0241ad957e999e49c981809c018425d0080f6cd2830400008405320000a0713ce910d12e99ba96492ff2f6411d4e0a3e567ab419e92e60cf5fc4aa74db7a"

Block Hash :0x2ef5bd5264f472d821fb950241aa2bbe83f885fea086b4f58fccb9c9b948adcf
```