This Rust project demonstrates how to perform a handshake with a P2P local node using the web3
crate and coregeth
.
- Rust (latest stable version recommended)
coregeth
(latest version recommended)
- Install Rust by following the instructions on the Rust website.
- Install
coregeth
by following the instructions on the Geth website. Or the next:
- Go 1.16 or higher
go-ethereum
v1.10.26 or higher
-
Download and install Go from the Go website.
-
Install
go-ethereum
versionv1.10.26
:go get -u github.com/ethereum/go-ethereum@v1.10.26
unzip and follow the usual Linux: place it in the preferred directory (e.g usr/local/) and continue.
-
Clone this repository:
git clone https://github.com/anfegu/anfegeth
-
Navigate to the root directory of the project and install the dependencies:
cd anfegeth
cargo install
-
Start
coregeth
in a separate terminal window:Run
geth
with the--http
and--network
flags:in the installed directory:
./geth --http --network=my-network-id
- "id": "1", "name": "Mainnet"
- "id": "3", "name": "Ropsten"
- "id": "4", "name": "Rinkeby"
- "id": "5", "name": "Goerli"
- "id": "1337802", "name": "Kiln"
- "id": "11155111", "name": "Sepolia"
-
In the terminal window where you installed the project, run the anfeGETH 1.0 P2P Handshake:
cargo run
-
Follow the prompts in the console menu to perform the handshake with the local
geth
node.If the handshake is successful, you should see a message indicating that the handshake was completed.
To run the tests for this project, use the cargo test
command:
cargo test
This will run all the tests in the project and show the results.
You can also use the --verbose
flag to see more detailed output:
cargo test --verbose
Or, you can specify the name of a specific test or test module to run a subset of the tests:
cargo test my_test
cargo test my_module
To generate documentation for this project, use the cargo doc
command:
cargo doc
This will generate documentation for all the crates in the project and create an HTML file that can be viewed in a web browser. The documentation will be available in the target/doc
directory.
You can also use the --open
flag to automatically open the documentation in your default web browser:
cargo doc --open