Getting started
ChainGate is a complete TypeScript-first framework for seamless interaction with multiple blockchain networks. Manage digital assets, query blockchain data, and execute transactions across supported networks using a unified API — all from Node.js or modern browsers.
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.
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, 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
Here's how to generate an address and check a balance:
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 balance
const ethereum = cg.connect(cg.networks.ethereum, wallet)
const { confirmed } = await ethereum.addressBalance()
console.log('ETH balance:', confirmed.base(), confirmed.symbol)
Send a transaction
// Create an amount and transfer
const amount = cg.networks.bitcoin.amount('0.001')
const tx = await bitcoin.transfer(amount, 'bc1q...')
// Check fees and broadcast
const fees = tx.recommendedFees()
if (fees.normal.enoughFunds) {
tx.setFee('normal')
const broadcasted = await tx.signAndBroadcast()
console.log('TX ID:', broadcasted.transactionId)
}
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()
Most ChainGate methods return Promise-based responses for async operations. Use async/await or standard Promise handling.