A comprehensive, pure Dart Web3 SDK for EVM-compatible blockchains and multi-chain support.
- Pure Dart Implementation - No native dependencies (FFI, C++, Rust bindings), works on all Dart/Flutter platforms
- Modular Architecture - Import only what you need, each package is independently usable
- Multi-Chain Support - Core EVM support with extensions for Solana, Polkadot, Tron, TON, and Bitcoin
- Hardware Wallets - Built-in support for Ledger, Trezor, Keystone, and various MPC solutions
- Type-Safe - Leverages Dart's type system for compile-time error checking
- Modern Standards - Supports EIP-1559, EIP-4844 (Blob), EIP-7702, ERC-4337 (Account Abstraction)
Add the packages you need to your pubspec.yaml:
dependencies:
# Core functionality
dart_web3_core: ^0.1.0
dart_web3_crypto: ^0.1.0
dart_web3_abi: ^0.1.0
# Client and provider
dart_web3_provider: ^0.1.0
dart_web3_client: ^0.1.0
# Or use the meta-package for everything
dart_web3: ^0.1.0graph LR
A[Setup] --> B[Core Components]
B --> C[Connect & Sign]
C --> D[Interact]
D --> E[Advanced Features]
style A fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#bbf,stroke:#333,stroke-width:2px
style C fill:#bfb,stroke:#333,stroke-width:2px
style D fill:#fbf,stroke:#333,stroke-width:2px
style E fill:#fbb,stroke:#333,stroke-width:2px
import 'package:dart_web3/dart_web3.dart';
void main() async {
final client = ClientFactory.createPublicClient(
rpcUrl: 'https://eth.llamarpc.com',
chain: Chains.ethereum,
);
final blockNumber = await client.getBlockNumber();
print('Current Block: $blockNumber');
}import 'package:dart_web3/dart_web3.dart';
void main() async {
final client = ClientFactory.createPublicClient(rpcUrl: '...');
final contract = ERC20(address: '0x...', client: client);
final symbol = await contract.symbol();
final balance = await contract.balanceOf('0x...');
print('$symbol Balance: ${EthUnit.formatEther(balance)}');
}import 'package:dart_web3/dart_web3.dart';
void main() async {
final client = ClientFactory.createPublicClient(rpcUrl: '...');
final multicall = Multicall(client: client);
final results = await multicall.aggregate([
contract.getBalanceRequest('0xUser1'),
contract.getBalanceRequest('0xUser2'),
client.getEthBalanceRequest('0xUser1'),
]);
}import 'package:dart_web3/dart_web3.dart';
void main() async {
final signer = PrivateKeySigner.fromHex('0x...');
final smartAccount = await SimpleSmartAccount.create(
signer: signer,
rpcUrl: '...',
entryPoint: '0x...',
);
final txHash = await smartAccount.sendTransaction(
to: '0x...',
value: EthUnit.ether('0.01'),
);
}import 'package:dart_web3/dart_web3.dart';
import 'package:dart_web3_solana/dart_web3_solana.dart';
void main() async {
// Use Ethereum core for EVM
final evmBalance = await evmClient.getBalance('0x...');
// Use Solana extension for non-EVM
final solClient = SolanaClient(endpoint: '...');
final solBalance = await solClient.getBalance('...');
}We provide a variety of examples to help you get started with the SDK:
| Example | Description |
|---|---|
| Connectivity | Check connectivity across multiple networks |
| Wallet Management | HD Wallet derivation, mnemonic generation, and signing |
| Token Interactions | Reading ERC-20 metadata and balances |
| Account Abstraction | ERC-4337 Smart Account setup and UserOps |
Find more details in the Usage Guide.
graph TD
subgraph L0 [Layer 0: Core Primitives]
Core[dart_web3_core]
end
subgraph L1 [Layer 1: Cryptography & Encoding]
Crypto[dart_web3_crypto]
ABI[dart_web3_abi]
end
subgraph L2 [Layer 2: Connectivity & Identity]
Provider[dart_web3_provider]
Signer[dart_web3_signer]
Chains[dart_web3_chains]
end
subgraph L3 [Layer 3: Client & Interaction]
Client[dart_web3_client]
Contract[dart_web3_contract]
end
subgraph L4 [Layer 4: Advanced Features]
ENS[dart_web3_ens]
AA[dart_web3_aa]
NFT[dart_web3_nft]
Swap[dart_web3_swap]
end
subgraph Ext [Extensions & Hardware]
Solana[dart_web3_solana]
Bitcoin[dart_web3_bitcoin]
Ledger[dart_web3_ledger]
end
Core --> Crypto
Crypto --> ABI
ABI --> Provider
Provider --> Client
Signer --> Client
Chains --> Client
Client --> Contract
Client -.-> ENS
Client -.-> AA
Client -.-> NFT
L2 --- Ext
The SDK is divided into specialized layers. Click on a package to see its dedicated documentation.
Low-level primitives for cryptography, encoding, and data models.
dart_web3_core: Essential types (EthAddress,BigIntunits), RLP encoding, and byte manipulation.dart_web3_crypto: Security-first crypto engine.secp256k1,BIP-39mnemonics,BIP-44HD Wallets, andKeccakhashing.dart_web3_abi: Robust ABI v2 codec for encoding/decoding Solidity types, functions, and events.
Standardized interfaces for connecting to blockchains and managing identities.
dart_web3_provider: JSON-RPC 2.0 gateway supporting HTTP and WebSockets with middleware support.dart_web3_signer: Universal signing abstraction for Private Keys, Passkeys, and Hardware Wallets (Ledger/Trezor).dart_web3_chains: Comprehensive registry of EVM networks (metadata, RPCs, contract addresses).
The primary developer surface for building DApps.
dart_web3_client: High-levelPublicClientandWalletClientfor composable blockchain interaction.dart_web3_contract: Type-safe wrapper for smart contracts (read state, write transactions, watch events).dart_web3_events: Recursive event filter polling and WebSocket subscription management.
Specialized modules for complex Web3 workflows.
dart_web3_aa: Account Abstraction (ERC-4337) toolkit. Smart Accounts, Bundlers, and Paymasters.dart_web3_ens: Ethereum Name Service resolution and avatar fetching.dart_web3_multicall: Batch aggregate on-chain calls into a single RPC request.dart_web3_reown: WalletConnect v2 integration (formerly Reown).dart_web3_nft: Metadata fetching and standard interfaces for ERC-721/ERC-1155.dart_web3_swap: DEX aggregation interfaces and utilities.dart_web3_bridge: Cross-chain bridging utilities.dart_web3_debug: Trace API and debugging tools.dart_web3_mev: MEV bundle submission and protections.
Air-gapped and secure-element integration.
dart_web3_ledger: Connect via USB/BLE to Ledger Nano S/X/Stax.dart_web3_trezor: Connect via USB Bridge to Trezor One/T/Safe.dart_web3_keystone: Air-gapped QR communication with Keystone devices.dart_web3_bc_ur: Blockchain Uniform Resource (BC-UR) protocol for QR code transmission.
Beyond the EVM. Native support for other major blockchains.
dart_web3_solana: Solana SVM support (SPL tokens, Programs, PDAs).dart_web3_bitcoin: Bitcoin UTXO management, SegWit, and PSBTs.dart_web3_polkadot: Substrate/Polkadot support with SCALE codec.dart_web3_tron: TRON network support (TRC-20, Bandwidth/Energy).dart_web3_ton: The Open Network (TON) support (Bag of Cells, Jettons).
This project uses Melos for monorepo management.
# Install melos globally
dart pub global activate melos
# Bootstrap the workspace
melos bootstrap
# Run tests
melos test
# Run analysis
melos analyzeMIT License - see LICENSE for details.
This SDK is inspired by and references:
- viem - Modern TypeScript EVM library
- ethers.js - Classic TypeScript EVM library
- alloy - Rust Ethereum SDK
- blockchain_utils - Pure Dart crypto utilities
- on_chain - Multi-chain Dart library