Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.dfns.co/llms.txt

Use this file to discover all available pages before exploring further.

This guide covers how to create wallets, add networks, and manage wallet metadata using the Dfns API and SDK.

Prerequisites

  • Service account or authenticated user with Wallets:Create permission
  • Dfns SDK installed and configured
  • Understanding of wallets and keys

Creating a wallet

Create a wallet on a specific network using the SDK:
import { DfnsApiClient } from '@dfns/sdk'

const dfns = new DfnsApiClient({
  baseUrl: 'https://api.dfns.io',
  // Your signer configuration
})

const wallet = await dfns.wallets.createWallet({
  body: {
    network: 'EthereumSepolia', // or 'Ethereum', 'Polygon', etc.
    name: 'My Wallet'
  }
})

console.log('Wallet ID:', wallet.id)
console.log('Address:', wallet.address)
console.log('Network:', wallet.network)

Request parameters

ParameterRequiredDescription
networkYesThe blockchain network (see supported networks)
nameNoHuman-readable name for the wallet
tagsNoArray of tags for organization

Response

The response includes:
{
  id: 'wa-xxx-xxx',
  network: 'EthereumSepolia',
  address: '0x...',
  signingKey: {
    id: 'ke-xxx-xxx',
    scheme: 'ECDSA',
    curve: 'secp256k1'
  },
  status: 'Active',
  dateCreated: '2024-01-15T10:30:00Z',
  name: 'My Wallet',
  tags: []
}

Adding a network to an existing wallet

For keys that support multiple networks (e.g., EVM chains), add additional networks to an existing wallet’s key:
// First, get the key ID from an existing wallet
const existingWallet = await dfns.wallets.getWallet({
  walletId: 'wa-xxx-xxx'
})

const keyId = existingWallet.signingKey.id

// Create a new wallet on a different network using the same key
const polygonWallet = await dfns.wallets.createWallet({
  body: {
    network: 'Polygon',
    name: 'My Polygon Wallet',
    keyId: keyId // Use existing key
  }
})
Not all key types support all networks. EVM chains share the same key type (secp256k1), so a single key can be used across Ethereum, Polygon, Arbitrum, etc.

Deriving wallets from a master key (HD)

The recommended pattern is independent keys (the default in Creating a wallet) or shared-key reuse (see Adding a network to an existing wallet). HD derivation is intended for cases where you need BIP-32 path semantics, for example to integrate with systems or tooling that assume hierarchical derivation. Each key share is generated independently by the MPC network, with stronger isolation than HD: compromising one key share reveals nothing about another.
Derive a child wallet from an existing master key by passing signingKey.deriveFrom with a keyId and an optional path. If path is omitted, Dfns auto-generates one.
const wallet = await dfns.wallets.createWallet({
  body: {
    network: 'Ethereum',
    name: 'Customer 0001',
    signingKey: {
      deriveFrom: {
        keyId: 'key-xxx-xxx',
        path: 'm/0/1' // optional, auto-generated if omitted
      }
    }
  }
})

Path format

The path follows BIP-32 syntax: m/<index>(/<index>)*, with non-negative integer indices (e.g., m/0, m/0/1/2). Hardened paths (with ') are not supported. Each unique path under the same master key derives a distinct wallet with its own address.

Creating wallets with tags

Use tags to organize wallets and target them with policies:
const wallet = await dfns.wallets.createWallet({
  body: {
    network: 'Ethereum',
    name: 'Treasury Wallet',
    tags: ['treasury', 'cold-storage', 'eth-mainnet']
  }
})

Managing wallet tags

Adding tags

await dfns.wallets.tagWallet({
  walletId: 'wa-xxx-xxx',
  body: {
    tags: ['operations', 'high-volume']
  }
})

Removing tags

await dfns.wallets.untagWallet({
  walletId: 'wa-xxx-xxx',
  body: {
    tags: ['high-volume'] // Tags to remove
  }
})

Updating wallet metadata

Update the wallet name:
await dfns.wallets.updateWallet({
  walletId: 'wa-xxx-xxx',
  body: {
    name: 'Updated Wallet Name'
  }
})

Listing wallets

List all wallets in your organization:
const wallets = await dfns.wallets.listWallets()

for (const wallet of wallets.items) {
  console.log(`${wallet.name}: ${wallet.address} (${wallet.network})`)
}

Filtering by tags

Filter wallets by tags:
const wallets = await dfns.wallets.listWallets({
  query: {
    tags: 'treasury' // Wallets with this tag
  }
})

Getting wallet details

Get details for a specific wallet:
const wallet = await dfns.wallets.getWallet({
  walletId: 'wa-xxx-xxx'
})

console.log('Wallet:', wallet)

Getting wallet assets

Retrieve token balances:
const assets = await dfns.wallets.getWalletAssets({
  walletId: 'wa-xxx-xxx'
})

for (const asset of assets.assets) {
  console.log(`${asset.symbol}: ${asset.balance}`)
}
See displaying balances for more details on working with balances.

Error handling

Handle common errors:
try {
  const wallet = await dfns.wallets.createWallet({
    body: {
      network: 'Ethereum',
      name: 'My Wallet'
    }
  })
} catch (error) {
  if (error.status === 403) {
    console.error('Permission denied - check Wallets:Create permission')
  } else if (error.status === 400) {
    console.error('Invalid request:', error.message)
  } else {
    console.error('Error creating wallet:', error)
  }
}

Webhooks

Subscribe to wallet events:
  • wallet.created - New wallet created
  • wallet.activated - Wallet activated
  • wallet.tags.modified - Wallet tags changed
See webhooks guide for configuration.

Wallets API

Complete API reference

Wallets and keys

Understand the wallet model

Create transfers via API

Send transfers from wallets

Display balances

Query wallet assets
Last modified on April 30, 2026