| Crates.io | nautilus-blockchain |
| lib.rs | nautilus-blockchain |
| version | 0.52.0 |
| created_at | 2025-10-26 10:31:50.867982+00 |
| updated_at | 2026-01-02 10:55:31.742648+00 |
| description | Blockchain and DeFi integration adapter for the Nautilus trading engine |
| homepage | https://nautilustrader.io |
| repository | https://github.com/nautechsystems/nautilus_trader |
| max_upload_size | |
| id | 1901223 |
| size | 1,017,230 |
A high-performance, universal, extensible adapter for ingesting DeFi data from decentralized exchanges (DEXs), liquidity pools, and on-chain events. It enables you to power analytics pipelines and trading strategies with real-time and historical on-chain data.
NautilusTrader is an open-source, high-performance, production-grade algorithmic trading platform, providing quantitative traders with the ability to backtest portfolios of automated trading strategies on historical data with an event-driven engine, and also deploy those same strategies live, with no code changes.
NautilusTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
This crate provides feature flags to control source code inclusion during compilation:
hypersync: Enables the HyperSync client integration.python: Enables Python bindings from PyO3.extension-module: Builds as a Python extension module (used with python).turmoil: Enables deterministic network simulation testing with turmoil.You can run some example scripts and provide target RPC environment variables. These examples demonstrate how to connect to blockchain nodes and subscribe to various events.
You can configure the required environment variables in two ways:
Using a .env file in the project root:
Create a file named .env in the project root directory with the following content:
CHAIN=Ethereum
RPC_WSS_URL=wss://mainnet.infura.io/ws/v3/YOUR_INFURA_API_KEY
RPC_HTTP_URL=https://mainnet.infura.io/v3/YOUR_INFURA_API_KEY
Providing variables directly in the command line:
CHAIN=Ethereum RPC_WSS_URL=wss://your-node-endpoint cargo run --bin live_blocks_rpc
The scripts will connect to the specified blockchain and log information about each new block received for both the RPC version and only Hypersync.
cargo run --bin live_blocks_rpc --features hypersync
cargo run --bin live_blocks_hypersync --features hypersync
For RPC example, the output should be:
Running `target/debug/live_blocks_rpc`
2025-04-25T14:54:41.394620000Z [INFO] TRADER-001.nautilus_blockchain::rpc::core: Subscribing to new blocks on chain Ethereum
2025-04-25T14:54:48.951608000Z [INFO] TRADER-001.nautilus_blockchain::data: Block(chain=Ethereum, number=22346765, timestamp=2025-04-25T14:54:47+00:00, hash=0x18a3c9f1e3eec06b45edc1f632565e5c23089dc4ad0892b00fda9e4ffcc9bf91)
2025-04-25T14:55:00.646992000Z [INFO] TRADER-001.nautilus_blockchain::data: Block(chain=Ethereum, number=22346766, timestamp=2025-04-25T14:54:59+00:00, hash=0x110436e41463daeacd1501fe53d38c310573abc136672a12054e1f33797ffeb9)
2025-04-25T14:55:14.369337000Z [INFO] TRADER-001.nautilus_blockchain::data: Block(chain=Ethereum, number=22346767, timestamp=2025-04-25T14:55:11+00:00, hash=0x54e7dbcfc14c058e22c70cbacabe4872e84bd6d3b976258f0d364ae99226b314)
2025-04-25T14:55:38.314022000Z [INFO] TRADER-001.live_blocks: Shutdown signal received, shutting down...
This script demonstrates how to use the blockchain data client to discover and cache Uniswap V3 pools and their associated tokens. It queries the Ethereum blockchain for pool creation events emitted by the Uniswap V3 factory contract, retrieves token metadata (name, symbol, decimals) for each token in the pools via smart contract calls, and stores everything in a local Postgres database.
cargo run --bin sync_tokens_pools --features hypersync
The crate includes both standard integration tests and deterministic network simulation tests using turmoil.
To run standard tests:
cargo nextest run -p nautilus-blockchain
To run turmoil network simulation tests:
cargo nextest run -p nautilus-blockchain --features turmoil
The turmoil tests simulate various network conditions (reconnections, partitions, etc.) in a deterministic way, allowing reliable testing of network failure scenarios without flakiness.
The source code for NautilusTrader is available on GitHub under the GNU Lesser General Public License v3.0. Contributions to the project are welcome and require the completion of a standard Contributor License Agreement (CLA).
NautilusTraderâ„¢ is developed and maintained by Nautech Systems, a technology company specializing in the development of high-performance trading systems. For more information, visit https://nautilustrader.io.
© 2015-2026 Nautech Systems Pty Ltd. All rights reserved.