Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
duoxehyon authored Apr 27, 2024
1 parent e2e09e5 commit 314ea18
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# Block Builder Bids Poller
This program polls for the latest block values submitted by the builder for each relay. Example on how to use in `src/main.rs`.

## Usage
```rust
use std::error::Error;

use ethers::prelude::*;
use block_bid_watcher::relay_clients::RelayClients;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Initialize RelayClients with URLs
let mut relay_clients = RelayClients::new(vec![
"https://relay.ultrasound.money".to_string(),
"https://agnostic-relay.net".to_string(),
"https://boost-relay.flashbots.net".to_string(),
]);
let mut bid_manager_receiver = relay_clients.bid_manager.subscribe_to_top_bids().await;

// Spawn a task to handle received messages from the bid manager
tokio::spawn(async move {
while let Some(data) = bid_manager_receiver.recv().await {
println!("New Highest Bid: {}", data);
}
});

// Connect to the WebSocket provider
let provider = Provider::<Ws>::connect("wss://go.getblock.io/<your_access_token_here>").await?;

// Subscribe to new blocks
let mut block_stream = provider.subscribe_blocks().await?;

// Process new blocks as they come in
while let Some(block) = block_stream.next().await {
let block_number = block.number.expect("Block number not found in new block");
println!("New block: {}", block_number);

// Poll for each new block
relay_clients
.poll_for(block_number + U64::one(), 1, 12)
.await
}

Ok(())
}
```

# Location, IP Values for relays

## relay.ultrasound.money
Expand Down Expand Up @@ -91,4 +136,4 @@ The IP for mainnet.aestus.live is 57.128.162.97. This IP does not use CDNs, and
```

## mainnet-relay.securerpc.com
The IP addresses for mainnet-relay.securerpc.com are 15.204.142.24, 15.204.196.74, 15.204.196.75, 15.204.208.26, 15.204.196.73. All these IPs are located in North America.
The IP addresses for mainnet-relay.securerpc.com are 15.204.142.24, 15.204.196.74, 15.204.196.75, 15.204.208.26, 15.204.196.73. All these IPs are located in North America.

0 comments on commit 314ea18

Please sign in to comment.