Get a receiving address
In cryptocurrency, an address is a publicly shareable identifier you use to receive funds. Each blockchain has its own address format (e.g., Bitcoin addresses look different from Ethereum addresses).
When you initialize a wallet with ChainGate, you can easily retrieve the default address for any supported currency.
Example: Ethereum addressβ
Below is a minimal example showing how to get an Ethereum address from a new wallet:
import { initializeWallet } from 'chaingate'
async function example() {
  const { wallet, phrase } = await initializeWallet.create()
  // Select "ethereum" from the wallet
  const ethereum = wallet.currency('ethereum')
  // Retrieve the address
  const address = await ethereum.getAddress()
  console.log(address)
  // e.g., "0xE7c19D5A90352b5eE0144363D1191E2549Ca2146"
}
How addresses workβ
- Shareable: Addresses are safe to share publicly. They only reveal where funds can be sent, not how they can be accessed.
- Unique formats: Each blockchain has its own address style (e.g., Bitcoin addresses look different from Ethereum addresses).
- Derivation paths: If your wallet is initialized from a mnemonic phrase or seed, you can generate many addresses following standard derivation paths.
Using other currenciesβ
You can pass any currency identifier supported by ChainGate to .currency(...). For example, to retrieve a Bitcoin address:
const bitcoin = wallet.currency('bitcoin')
const btcAddress = await bitcoin.getAddress()
console.log(btcAddress)
info
Each currency instance (like bitcoin or ethereum) has its own methods and properties depending on that blockchain's rules and standards.
Key pointsβ
- Addresses are public: Itβs completely safe to share them so others can send you funds.
- One wallet, multiple currencies: A single wallet instance can hold multiple currency sub-wallets (Bitcoin, Ethereum, etc.).
- Derivation paths: By default, the address is derived using the currencyβs default derivation path (e.g., m/44'/60'/0'/0/0for Ethereum).
- Advanced usage: Advanced users can derive other accounts/addresses by using custom derivation paths.