Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Using backend wallets

Backend wallets are server-side wallets that enable your application to sign transactions, manage assets, and interact with blockchains programmatically. Each backend wallet corresponds to a private/public key pair, with the private key securely stored and managed by Openfort.

Account types

Openfort backend wallets support two main blockchain ecosystems:

EVM accounts (EOA)

Externally Owned Accounts (EOAs) for EVM-compatible networks:

  • Direct private key control, securely managed by Openfort
  • Generate new accounts or import existing private keys
  • Support across all EVM-compatible networks
  • Sign messages, typed data, and transactions

Solana accounts

Native Solana accounts:

  • Private keys securely managed by Openfort
  • Support for native Solana transactions
  • Off-chain message signing capabilities
  • Available on Mainnet and Devnet

Managing accounts

Creating accounts

Create new backend accounts with an optional name. Account names help you organize and identify your wallets.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
// Create an EVM backend account
const account = await openfort.accounts.evm.backend.create({
  name: 'MyWallet',
});
 
console.log('Account ID:', account.id);
console.log('Address:', account.address);

Listing accounts

Retrieve all backend accounts in your project with pagination support.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
// List all EVM backend accounts
const result = await openfort.accounts.evm.backend.list({ limit: 10 });
 
console.log(`Found ${result.total} accounts:`);
for (const account of result.accounts) {
  console.log(`  - ${account.address} (${account.id})`);
}
 
// Paginate through results
const nextPage = await openfort.accounts.evm.backend.list({
  limit: 10,
  skip: 10,
});

Retrieving accounts

Retrieve a specific account by its ID or blockchain address.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
// Retrieve by ID
const accountById = await openfort.accounts.evm.backend.get({
  id: 'dac_...',
});
 
// Retrieve by address
const accountByAddress = await openfort.accounts.evm.backend.get({
  address: '0x1234567890123456789012345678901234567890',
});

Importing accounts

Import existing wallets into Openfort by providing the private key. This enables you to migrate existing wallets or use keys generated elsewhere.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
// Import an EVM account using a hex-encoded private key
const account = await openfort.accounts.evm.backend.import({
  privateKey: '0x0123456789abcdef...', // 32-byte hex-encoded private key
  name: 'ImportedWallet',
});
 
console.log('Imported account:', account.address);

Exporting accounts

Export the private key from a backend account. This is useful for migrating to another provider or for backup purposes.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
// Export the private key
const privateKey = await openfort.accounts.evm.backend.export({
  id: 'dac_...',
});
 
console.log('Private key:', `0x${privateKey}`);

Signing messages

Backend wallets can sign arbitrary messages for authentication or verification purposes.

EVM
import Openfort from '@openfort/openfort-node';
 
const openfort = new Openfort(YOUR_SECRET_KEY, {
  walletSecret: YOUR_WALLET_SECRET,
});
 
const account = await openfort.accounts.evm.backend.create({
  name: 'SigningWallet',
});
 
// Sign a message
const message = 'Hello, Openfort!';
const signature = await account.signMessage({ message });
 
console.log('Signature:', signature);
Copyright © 2023-present Alamas Labs, Inc