Getting started
ChainGate is a TypeScript-first framework for building multi-chain crypto apps. A single library covers Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash — plus any EVM chain you want — one API for wallets, balances, gas estimation, transfers, and JSON-RPC, usable from Node.js or any modern browser.
Manage digital assets, query blockchain data, and execute transactions across supported networks using a unified API.
ChainGate is designed with security in mind: Your private key never leaves your device. All signing operations, address generation, and sensitive cryptographic logic are executed locally in memory. ChainGate servers never have access to your private keys or seed phrases.
Supported blockchains
ChainGate currently supports these networks (expanded regularly):
Need another chain? Request integration.
Installation
Install ChainGate via npm:
npm install chaingate
You can obtain a free API key at ChainGate's Dashboard. One key unlocks every chain, every RPC proxy, and every market-data endpoint — no need to combine an Etherscan API key, an Infura key, and a separate provider per UTXO network.
Create a wallet
Wallet creation is synchronous and does not require an API key:
import { newWallet } from 'chaingate'
const { phrase, wallet } = newWallet()
console.log('Recovery phrase:', phrase)
You can also import an existing wallet from a mnemonic phrase, seed, private key, xpriv, xpub, public key, or keystore file.
Initialize ChainGate
To interact with blockchain networks (balances, transactions, blocks, gas prices, etc.) you need a ChainGate instance with your API key:
import { ChainGate } from 'chaingate'
const cg = new ChainGate({ apiKey: 'your-api-key-from-dashboard' })
Quick start example
Derive an address and check a balance on two different networks from the same wallet:
import { newWallet, ChainGate } from 'chaingate'
const { phrase, wallet } = newWallet()
const cg = new ChainGate({ apiKey: 'your-api-key-from-dashboard' })
// Connect wallet to Bitcoin
const bitcoin = cg.connect(cg.networks.bitcoin, wallet)
console.log('Bitcoin address:', await bitcoin.address())
// Connect wallet to Ethereum and check the balance
const ethereum = cg.connect(cg.networks.ethereum, wallet)
const { confirmed } = await ethereum.addressBalance()
console.log('ETH balance:', confirmed.base(), confirmed.symbol)
console.log('ETH → USD:', await confirmed.toCurrency('usd'))
Send a transaction
The same flow works for every supported chain — Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Ethereum, and any custom EVM RPC network:
// Create an amount and transfer
const amount = cg.networks.bitcoin.amount('0.001')
const tx = await bitcoin.transfer(amount, 'bc1q...')
// Review recommended fees and broadcast
const fees = tx.recommendedFees()
if (fees.normal.enoughFunds) {
tx.setFee(fees.normal)
const broadcasted = await tx.signAndBroadcast()
console.log('TX ID:', broadcasted.transactionId)
}
Swap cg.networks.bitcoin for cg.networks.litecoin, cg.networks.dogecoin, cg.networks.bitcoincash, or cg.networks.ethereum — the helpers (amount(), transfer(), recommendedFees(), signAndBroadcast()) have the same signature everywhere.
Query blockchain data (without a wallet)
You can query blockchain data without connecting a wallet using explorers:
const btcExplorer = cg.explore(cg.networks.bitcoin)
const balance = await btcExplorer.getAddressBalance('bc1q...')
const block = await btcExplorer.getLatestBlock()
// Current Ethereum gas price (in gwei)
const ethExplorer = cg.explore(cg.networks.ethereum)
const status = await ethExplorer.getNetworkStatus()
console.log('Base fee:', status.currentBaseFeeGWei, 'gwei')
Most ChainGate methods return Promise-based responses for async operations. Use async/await or standard Promise handling.