Wall-Echain is a product for obtaining block information, transaction details, and the latest block height of the Ethereum system through JSON-RPC.
toml
# Cargo.toml
[dependencies]
wall-echain = "0.1.2"
shell
Cargo add wall-echain
Next, you can use the following code to query the latest block height on the ethereum blockchain.
```rust let w = Wall::new(Vec["https://cloudflare-eth.com/".tostring()],None, None); if let Some(t) = w.getlatest_number().await { println!("{:?}", t); }
```
You can also use the following code to query transaction details by transaction hash.
```rust
let w = Wall::new(Vec["https://cloudflare-eth.com/".tostring()],None, None); if let Some(t) = w.gettransactionreceiptfor_hash("0x80fdaa7f5f54cbe28b84f41afb9543cf0c9eb0d9f4b8a620c2fb5faf0b1c2810").await { println!("{:?}", t); }
```
You can also use the following code to query block information by specifying the block height.
```rust let w = Wall::new(Vec["https://cloudflare-eth.com/".tostring()],None, None); if let Some(t) = w.gettransactionsforblock("0xe5b544", false).await { println!("{:?}", t); }
```
Contributions to the Wall-Echain project are welcome!
Wall-Echain is licensed under the MIT license, see the LICENSE file for details.