https://github.com/0xvv/snowsight-rs
Basic example to connect to snowsight mempool streaming service in Rust
https://github.com/0xvv/snowsight-rs
avalanche mempool mev snowsight
Last synced: 5 months ago
JSON representation
Basic example to connect to snowsight mempool streaming service in Rust
- Host: GitHub
- URL: https://github.com/0xvv/snowsight-rs
- Owner: 0xvv
- License: mit
- Created: 2022-06-12T20:51:56.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T09:03:43.000Z (about 3 years ago)
- Last Synced: 2025-04-12T06:14:57.127Z (about 1 year ago)
- Topics: avalanche, mempool, mev, snowsight
- Language: Rust
- Homepage:
- Size: 11.7 KB
- Stars: 11
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snowsight-rs
Basic Rust example of a client for snowsight Avalanche mempool streaming service.
This uses `tokio-tungstenite` for the websocket, `ethers-rs` and `cast` to interact with the chain and `chacha20poly1305` for private key encryption.
This contains examples for:
- Connecting to the websocket and receiving transactions
- Paying the snowsight fee for a given tier
- Using the transaction propagator
This could be used as a basis for a bot, although private key management should be improved.
### Running the code
You should change the NONCE constant at line 14 in `main.rs` before use.
You can choose to include the line to pay the fee or not (line 35 in `main.rs`).
Paying for the trial tier (0) costs a couple cents as of writing this.
You can now compile the code, during compilation keep reading.
Set the env var `BOT_PWD` with a 32 chars long password to encrypt and decrypt the private key.
Set the env var `RPC_URL` to an Avalanche mainnet RPC.
You can then run :
```shell
snowsight-rs
```
Your private key will be encrypted and stored in the home directory for later use.
Then run the code to see the transactions stream.
```shell
snowsight-rs
```
The code is under MIT license.