# ChainGate > ChainGate is a TypeScript multi-chain wallet SDK and REST API. A single package (`chaingate`) and a single API key cover Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Bitcoin Testnet, and any EVM chain via JSON-RPC (Polygon, Arbitrum, Base, Avalanche, BNB Smart Chain, Sonic, and custom nodes). One unified interface exposes wallets, addresses, balances, gas/fee estimation, transfers, block explorers, and RPC proxying for Node.js and the browser. Orientation (read this first): - **Packages.** `chaingate` (core SDK) · `chaingate-react` (React hooks + providers; bundles `chaingate`, no need to install both). - **Install.** `npm install chaingate` · `npm install chaingate-react`. - **Built-in networks (`cg.networks.*`).** UTXO: `bitcoin`, `litecoin`, `dogecoin`, `bitcoincash`, `bitcointestnet`. EVM: `ethereum`. Any other EVM chain is registered with `cg.networks.evmRpc({ rpcUrl, chainId, name, symbol, decimals? })`. - **Hosted JSON-RPC proxies (`cg.rpcUrls.*`).** Ethereum, Polygon, Arbitrum, Base, Avalanche, BNB Smart Chain (`bnb`), Sonic, Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Bitcoin Testnet. Works with ethers.js, viem, web3.js, or plain `fetch`; also usable as the `rpcUrl` argument of `evmRpc()`. - **Core entry points.** `new ChainGate({ apiKey })`, `newWallet(language?, numberOfWords?)`, `importWallet({ phrase | seed | xpriv | privateKey | xpub | publicKey | keystore })`, `createWalletFromString(input)`, `deserializeWallet(data, askForPassword?)`, `cg.connect(network, wallet)` → connector, `cg.explore(network)` → explorer, `cg.exploreGlobal()`. - **Connector methods (per chain).** `.address()`, `.addressBalance()` → `{ confirmed, unconfirmed }`, `.transactionHistory(...)`, `.transfer(amount, to)` → tx with `recommendedFees()` / `setFee()` / `signAndBroadcast()`, plus token/NFT/custom-UTXO variants. `.signMessage()` / `.verifyMessage()` on supported chains. - **Amounts.** `cg.networks..amount(value)` and `cg.networks..amountFromCurrency(fiat, value)`; `Amount` is precision-safe across ETH↔wei/gwei, BTC↔satoshis, and 120+ fiat currencies (`.toCurrency('usd')`). - **Security model.** Wallet creation, import, derivation, and signing are synchronous and fully local; private keys and seed phrases never leave the device. API key is required only for network reads/broadcasts. In-memory encryption is AES-256-GCM with PBKDF2; serialized backup blobs use the same scheme. - **REST API.** Base URL `https://api.chaingate.dev` · auth via `?api_key=` query parameter · free key at `https://api.chaingate.dev/dashboard`. - **Ecosystem position.** Replaces multi-vendor stacks: Infura/Alchemy (EVM RPC), Etherscan/Mempool.space (explorers), bitcoinjs-lib (UTXO transactions), and a separate fiat pricing provider. ## Start here - [Getting started — `chaingate`](https://docs.chaingate.dev/): install, `newWallet()`, `new ChainGate({ apiKey })`, connect, balance, transfer; end-to-end quick start. - [Getting started — `chaingate-react`](https://docs.chaingate.dev/react): `` + `` wiring; `useWallet()` / `useChainGate()` usage. ## Networks & utilities - [Supported networks](https://docs.chaingate.dev/networks/overview): list and shape of `cg.networks.*`; UTXO vs EVM; built-in vs RPC-only. - [Network properties](https://docs.chaingate.dev/networks/network-metadata): chain IDs, decimals, native tokens, address types; `isValidAddress()`, `identifyAddressType()`. - [Create amounts](https://docs.chaingate.dev/networks/utilities/create-amounts): `cg.networks..amount()` and `amountFromCurrency()`; ETH↔wei/gwei, BTC↔satoshis, 120+ fiats. - [Validate addresses](https://docs.chaingate.dev/networks/utilities/address-validation): `isValidAddress()` (EIP-55 checksum, CashAddr, SegWit/Taproot/legacy detection); `identifyAddressType()`. - [Sign & verify messages](https://docs.chaingate.dev/networks/utilities/sign-verify-messages): EIP-191 on EVM, Bitcoin message format on UTXO; Sign-In with Ethereum (SIWE), server auth. ## Wallet — create & import - [Create wallet](https://docs.chaingate.dev/wallet/create-import-wallet/create-wallet): `newWallet(language?, numberOfWords?)` → `{ phrase, wallet }`; BIP39, synchronous, no API key. - [Import from mnemonic phrase](https://docs.chaingate.dev/wallet/create-import-wallet/import-from-phrase): `importWallet({ phrase })`; BIP39; MetaMask / Ledger / Trezor compatible. - [Import from BIP32 seed](https://docs.chaingate.dev/wallet/create-import-wallet/import-from-seed): `importWallet({ seed })`; hex string or `Uint8Array`. - [Import from xpriv](https://docs.chaingate.dev/wallet/create-import-wallet/import-from-xpriv): `importWallet({ xpriv })`; BIP32 extended private key HD subtree. - [Import from private key](https://docs.chaingate.dev/wallet/create-import-wallet/import-from-private-key): `importWallet({ privateKey })`; hex, WIF, or `Uint8Array`; single-address wallet. - [Import from keystore JSON](https://docs.chaingate.dev/wallet/create-import-wallet/import-from-keystore): `importWallet({ keystore, password })`; Web3/legacy JSON (ethers.js, web3.js, MyEtherWallet). - [View-only wallet](https://docs.chaingate.dev/wallet/create-import-wallet/import-view-only): `importWallet({ xpub })` or `{ publicKey }`; read-only — no signing, no private key. - [Auto-detect credential](https://docs.chaingate.dev/wallet/create-import-wallet/auto-detect): `createWalletFromString(input)`; detects phrase / xpriv / xpub / hex / WIF. - [Restore from serialized data](https://docs.chaingate.dev/wallet/create-import-wallet/deserialize): `deserializeWallet(data, askForPassword?)`; rehydrate encrypted or plain blobs. ## Wallet — addresses, balances, history - [Derive addresses](https://docs.chaingate.dev/wallet/addresses-balances/addresses): `connector.address()`; SegWit / Taproot / legacy / CashAddr selection. - [Derivation paths & accounts](https://docs.chaingate.dev/wallet/addresses-balances/derivation-paths): BIP44 / BIP84; custom paths; multi-account HD derivation. - [Address balances](https://docs.chaingate.dev/wallet/addresses-balances/balances): `connector.addressBalance()` → `{ confirmed, unconfirmed }`; `.toCurrency('usd')` for 120+ fiats. - [Transaction history](https://docs.chaingate.dev/wallet/addresses-balances/transaction-history): paginated on-chain history; Ethereum pending transactions (null block height). ## Wallet — transfers - [Transfer funds](https://docs.chaingate.dev/wallet/transfers/transfer-funds): `connector.transfer(amount, to)` → tx with `recommendedFees()`, `setFee(tier | Fee)`, `signAndBroadcast()`; identical API for BTC / LTC / DOGE / BCH / ETH. - [Send ERC-20 tokens](https://docs.chaingate.dev/wallet/transfers/token-transfers): token transfer API with auto gas estimation; USDC, USDT, DAI on Ethereum / Polygon / BSC / custom EVM RPC. - [Send NFT transfers](https://docs.chaingate.dev/wallet/transfers/nft-transfers): ERC-721 and ERC-1155 transfers; arbitrary smart-contract calls via `callSmartContractFunction()`. - [Custom UTXO transactions](https://docs.chaingate.dev/wallet/transfers/custom-utxo-transactions): explicit inputs/outputs, dust-aware change, multi-recipient; bitcoinjs-lib alternative for BTC/LTC/DOGE/BCH. ## Wallet — security & storage - [Encrypt in memory](https://docs.chaingate.dev/wallet/security-storage/encryption): AES-256-GCM + PBKDF2; password prompted only at signing time, not on every public read. - [Serialize & export](https://docs.chaingate.dev/wallet/security-storage/serialization): encrypted backup blob (phrase / seed / xpriv / private key); restored via `deserializeWallet()`. ## Explorers (no wallet required) - [Explorers overview](https://docs.chaingate.dev/explore/overview): `cg.explore(network)` per-chain, `cg.exploreGlobal()` for market data; programmatic Etherscan / Mempool.space alternative. - [Working with amounts](https://docs.chaingate.dev/explore/amounts): `Amount` object returned by every balance, fee, and token value; precision-safe unit and fiat conversion. - [EVM explorer](https://docs.chaingate.dev/explore/explorers/evm-explorer): `EvmExplorer`; `getAddressBalance`, `getTokenBalances`, `getNetworkStatus` (gas tracker, base fee gwei), token metadata, pending transactions. - [UTXO explorer](https://docs.chaingate.dev/explore/explorers/utxo-explorer): `UtxoExplorer`; balances, UTXOs, blocks, mempool, `broadcastTransaction` for BTC / LTC / DOGE / BCH / tBTC. - [EVM RPC explorer](https://docs.chaingate.dev/explore/explorers/evm-rpc-explorer): `EvmRpcExplorer`; standard JSON-RPC over any EVM — `getBalance`, `getTransactionReceipt`, `getFeeData`. - [Global explorer](https://docs.chaingate.dev/explore/explorers/global-explorer): `cg.exploreGlobal()`; prices (ETH/USD, BTC/USD), market caps, networks info, logos — 34+ chains. ## RPC - [ChainGate RPC endpoints](https://docs.chaingate.dev/rpc/chaingate-rpc): `cg.rpcUrls.*` hosted proxies for Ethereum, Polygon, Arbitrum, Base, Avalanche, BNB Smart Chain (`bnb`), Sonic, Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Bitcoin Testnet — 12 networks; compatible with ethers.js, viem, web3.js, `fetch`. - [Use external RPCs in ChainGate](https://docs.chaingate.dev/rpc/custom-rpc): `cg.networks.evmRpc({ rpcUrl, chainId, name, symbol, decimals? })` registers any EVM chain (Infura, Alchemy, self-hosted); EIP-1559 auto-detected; same connector API as built-in networks. ## React hooks & providers - [`useWallet()`](https://docs.chaingate.dev/react/useWallet): exposes `{ wallet, newWallet, importWallet, deserializeWallet, createWalletFromString, closeWallet }`; requires ``. Throws if used outside the provider. - [`useChainGate()`](https://docs.chaingate.dev/react/useChainGate): exposes `{ chaingate, initializeChainGate({ apiKey }) }`; `chaingate` in turn gives `explore`, `connect`, `exploreGlobal`, `networks`, `rpcUrls`. Requires ``. ## REST API reference Base URL `https://api.chaingate.dev` · Auth `?api_key=` · [API introduction](https://docs.chaingate.dev/docs-api/chaingate-api). Native EVM network for `{network}`: `ethereum`. Native UTXO networks for `{network}`: `bitcoin`, `litecoin`, `dogecoin`, `bitcoincash`, `bitcointestnet`. Any RPC-capable network is also reachable through `POST /rpc/{network}`. ### EVM endpoints - `GET /evm/{network}/addressBalance` — [Get address balance](https://docs.chaingate.dev/docs-api/get-evm-network-address-balance) - `GET /evm/{network}/addressTokenBalances` — [Get address token balances (ERC-20)](https://docs.chaingate.dev/docs-api/get-evm-network-address-token-balances) - `GET /evm/{network}/addressTransactionCount` — [Get transaction count (nonce)](https://docs.chaingate.dev/docs-api/get-evm-network-address-transaction-count) - `GET /evm/{network}/addressHistory` — [Get address history](https://docs.chaingate.dev/docs-api/get-evm-network-address-history) - `GET /evm/{network}/latestBlock` — [Get latest block](https://docs.chaingate.dev/docs-api/get-evm-network-latest-block) - `GET /evm/{network}/blockByHeight` — [Get block by height](https://docs.chaingate.dev/docs-api/get-evm-network-block-by-height) - `GET /evm/{network}/blockByHash` — [Get block by hash](https://docs.chaingate.dev/docs-api/get-evm-network-block-by-hash) - `GET /evm/{network}/transactionDetails` — [Get transaction details](https://docs.chaingate.dev/docs-api/get-evm-network-transaction-details) - `GET /evm/{network}/networkStatus` — [Get network status — gas tracker, base fee, congestion](https://docs.chaingate.dev/docs-api/get-evm-network-network-status) - `GET /evm/{network}/feeRate` — [Get fee rate estimates](https://docs.chaingate.dev/docs-api/get-evm-network-fee-rate) - `GET /evm/{network}/estimateGas` — [Estimate gas for a transaction](https://docs.chaingate.dev/docs-api/get-evm-network-estimate-gas) - `POST /evm/{network}/broadcastTransaction` — [Broadcast signed transaction](https://docs.chaingate.dev/docs-api/post-evm-network-broadcast-transaction) - `POST /evm/{network}/callSmartContractFunction` — [Call smart contract function](https://docs.chaingate.dev/docs-api/post-evm-network-call-smart-contract-function) - `GET /evm/{network}/tokenData` — [Get ERC-20 token data](https://docs.chaingate.dev/docs-api/get-evm-network-token-data) - `GET /evm/{network}/tokenLogo` — [Get token logo](https://docs.chaingate.dev/docs-api/get-evm-network-token-logo) - `GET /evm/{network}/logo` — [Get network logo (EVM)](https://docs.chaingate.dev/docs-api/get-evm-network-logo) - `GET /evm/{network}/ownedTokens` — [Get owned ERC-721 tokens](https://docs.chaingate.dev/docs-api/get-evm-network-owned-tokens) - `GET /evm/{network}/nft/metadata` — [Get NFT metadata](https://docs.chaingate.dev/docs-api/get-evm-network-nft-metadata) - `GET /evm/{network}/nft/metadata/image` — [Get NFT image](https://docs.chaingate.dev/docs-api/get-evm-network-nft-metadata-image) - `GET /evm/{network}/nft/metadata/animation` — [Get NFT animation](https://docs.chaingate.dev/docs-api/get-evm-network-nft-metadata-animation) ### UTXO endpoints - `GET /utxo/{network}/addressBalance` — [Get address balance](https://docs.chaingate.dev/docs-api/get-utxo-network-address-balance) - `GET /utxo/{network}/addressHistory` — [Get address history](https://docs.chaingate.dev/docs-api/get-utxo-network-address-history) - `GET /utxo/{network}/utxosByAddress` — [Get UTXOs by address](https://docs.chaingate.dev/docs-api/get-utxo-network-utxos-by-address) - `GET /utxo/{network}/latestBlock` — [Get latest block](https://docs.chaingate.dev/docs-api/get-utxo-network-latest-block) - `GET /utxo/{network}/blockByHeight` — [Get block by height](https://docs.chaingate.dev/docs-api/get-utxo-network-block-by-height) - `GET /utxo/{network}/blockByHash` — [Get block by hash](https://docs.chaingate.dev/docs-api/get-utxo-network-block-by-hash) - `GET /utxo/{network}/transactionDetails` — [Get transaction details](https://docs.chaingate.dev/docs-api/get-utxo-network-transaction-details) - `GET /utxo/{network}/mempool` — [Get mempool / pending transactions](https://docs.chaingate.dev/docs-api/get-utxo-network-mempool) - `GET /utxo/{network}/feeRate` — [Get fee rate estimates](https://docs.chaingate.dev/docs-api/get-utxo-network-fee-rate) - `POST /utxo/{network}/estimateTransactionSize` — [Estimate transaction size](https://docs.chaingate.dev/docs-api/post-utxo-network-estimate-transaction-size) - `POST /utxo/{network}/broadcastTransaction` — [Broadcast signed transaction](https://docs.chaingate.dev/docs-api/post-utxo-network-broadcast-transaction) - `GET /utxo/{network}/logo` — [Get network logo (UTXO)](https://docs.chaingate.dev/docs-api/get-utxo-network-logo) ### Global endpoints - `GET /global/markets` — [Market data — prices, market caps](https://docs.chaingate.dev/docs-api/get-global-markets) - `GET /global/networksInfo` — [Networks info + embedded market data](https://docs.chaingate.dev/docs-api/get-global-networks-info) - `GET /global/logo/{network}` — [Network logo (any chain)](https://docs.chaingate.dev/docs-api/get-global-logo-network) ### JSON-RPC proxy - `POST /rpc/{network}` — [Raw JSON-RPC for any supported network](https://docs.chaingate.dev/docs-api/post-rpc-network); backs `cg.rpcUrls.*`; accepts standard Ethereum JSON-RPC on EVM chains and Bitcoin-style RPC on UTXO chains. ## Changelog - [1.1.1 — address validation, custom UTXO transactions, fewer dependencies](https://docs.chaingate.dev/changelog/version-1-1-0) - [1.0 — one SDK, every blockchain; ethers.js dependency removed](https://docs.chaingate.dev/changelog/version-1-0-0) - [Sonic network + native token support across all chains](https://docs.chaingate.dev/changelog/sonic-migration-native-token-support) - [Market data embedded in `/global/networksInfo`](https://docs.chaingate.dev/changelog/networksinfo-market-data-update) - [New `/global/networksInfo` endpoint](https://docs.chaingate.dev/changelog/global-networks-info-endpoint) - [0.6.0 — major refactor + React support (`chaingate-react`)](https://docs.chaingate.dev/changelog/version-0-6-0) - [New EVM/UTXO block endpoints & deprecations](https://docs.chaingate.dev/changelog/evm-utxo-block-endpoints) - [Fiat support in the SDK (`.toCurrency`, `amountFromCurrency`)](https://docs.chaingate.dev/changelog/fiat-in-sdk) - [Market data on the ChainGate API](https://docs.chaingate.dev/changelog/market-data-endpoint) - [Docs launch announcement](https://docs.chaingate.dev/changelog/docs-launch-announcement) ## Optional - [Dashboard — free API key](https://api.chaingate.dev/dashboard) - [GitHub — drakensoftware/chaingate](https://github.com/drakensoftware/chaingate) - [Changelog RSS feed](https://docs.chaingate.dev/changelog/rss.xml) - [Discord](https://discord.gg/QgxJqmtF) - [X / Twitter](https://x.com/ChainGateJs)