A Rust application that registers a validator in the Aztec network on Sepolia testnet.
This tool allows you to register as a validator in the Aztec network by:
- Calculating the forwarder address for your wallet
- Submitting a transaction to the Staking contract
- Monitoring the transaction status until it's included in a block
- Rust (latest stable version)
- Cargo (comes with Rust)
- An Ethereum private key with funds on Sepolia testnet
-
Clone this repository:
git clone https://github.com/codeesura/aztec-validator-register.git cd aztec-validator-register
-
Create a
.env
file in the root directory with your private key:PRIVATE_KEY=your_private_key_here
(
⚠️ Never commit your .env file or share your private key!)
Build and run the application:
cargo build --release
cargo run --release
The application will:
- Calculate your forwarder address
- Listen for new blocks on Sepolia
- Submit a transaction to register as a validator
- Report on the status of the transaction
The application uses the following configuration:
- RPC URL:
wss://ethereum-sepolia-rpc.publicnode.com/
- Staking Contract Address:
0xF739D03e98e23A7B65940848aBA8921fF3bAc4b2
You can modify these settings in the src/config.rs
file.
To successfully compete with bots for validator registration, you need to adjust the gas price in src/main.rs
:
let gas_price = 1_000_000_000_000; // 1k gwei
This value (currently set to 1,000 GWEI) should be adjusted based on current network conditions. Higher values give your transaction priority but cost more. Modify this value according to your needs and the current gas prices on Sepolia.
src/main.rs
: Entry point and main application logicsrc/config.rs
: Configuration settingssrc/provider.rs
: Ethereum provider setupsrc/forwarder.rs
: Calculate forwarder addresssrc/create_transaction.rs
: Transaction creationsrc/estimate_gas.rs
: Gas estimation
Main dependencies include:
alloy
: Ethereum utilitiestokio
: Async runtimedotenv
: Environment variable loadingeyre
: Error handlingserde
/serde_json
: JSON serialization/deserialization
Contributions are welcome! Please feel free to submit a Pull Request.