Skip to main content

Getting Started

Install Voltaire and start making type-safe JSON-RPC requests to Ethereum nodes.

Installation

Creating a Provider

Use a standard EIP-1193 provider (like window.ethereum, viem, or ethers):
All EIP-1193 providers work with Voltaire’s request builders.

Your First Request

Get Block Number

Simplest request - no parameters:

Get Account Balance

Request with branded Address parameter:

Call Contract Method

Execute read-only contract call:

Error Handling

Requests throw errors on failure:

Subscribing to Events

Subscribe to blockchain events using EventEmitter pattern:

Unsubscribe

Remove event listeners:

Common Patterns

Check Account State

Get balance, nonce, and code in parallel:

Estimate Gas for Transaction

Query Historical State

Use block numbers to query historical data:

Next Steps

Method API

Learn about method calls, parameters, and response handling.

Type System

Understand auto-generated types and branded primitives.

Events

Master async generator subscriptions for real-time updates.

Usage Patterns

Explore recipes for common blockchain interaction patterns.

Troubleshooting

”Type ‘string’ is not assignable to type ‘Address’”

Use branded primitive constructors:

Request returns RequestArguments not result

Request builders return {method, params} objects, not results. Always use with provider.request():
  • Method API - Detailed method documentation
  • eth Methods - All 40 eth namespace methods
  • Events - Event handling patterns
  • Address - Address primitive documentation
  • Hex - Hex primitive documentation