@sequence0/sdk
v2.2.1
Published
Sequence0 Network SDK — Decentralized threshold signatures for any blockchain
Maintainers
Readme
@sequence0/sdk
Decentralized threshold signatures for any blockchain. Create wallets, sign transactions, and broadcast to 67 chains — no private keys required.
Install
npm install @sequence0/sdkQuick Start
import { Sequence0 } from '@sequence0/sdk';
// 1. Initialize the SDK
const s0 = new Sequence0({ network: 'mainnet' });
// 2. Create a threshold wallet (DKG ceremony with 24 agents)
const wallet = await s0.createWallet({ chain: 'ethereum' });
console.log('Address:', wallet.address);
console.log('Threshold:', wallet.threshold); // { t: 16, n: 24 }
// 3. Sign and send a transaction
const txHash = await wallet.sendTransaction({
to: '0xRecipientAddress',
value: '1000000000000000000', // 1 ETH in wei
});
console.log('TX Hash:', txHash);What's New in v2.0.1
Bitcoin Taproot (P2TR) Support
Full Bitcoin Taproot transaction lifecycle: address derivation, UTXO management, transaction building, FROST Schnorr signing, and broadcast. FROST-secp256k1 produces BIP-340 compatible Schnorr signatures that are native to Taproot key-path spends.
import { BitcoinTaprootAdapter } from '@sequence0/sdk';
const btc = new BitcoinTaprootAdapter({ network: 'mainnet' });
// Derive a Taproot address from a FROST group public key
const addr = btc.deriveAddress('02abcdef...');
console.log(addr.address); // bc1p...
// Get balance and UTXOs
const balance = await btc.getBalance('bc1p...');
const utxos = await btc.getUTXOs('bc1p...');
// Build a transaction
const unsignedTx = await btc.buildTransaction(
{ to: 'bc1p...recipient', amount: 50000, feeRate: 15 },
'bc1p...sender'
);
// Or use via the Wallet class for automatic signing
const wallet = await s0.createWallet({ chain: 'bitcoin' });
const txHash = await wallet.sendTransaction({
to: 'bc1p...recipient',
amount: 50000,
feeRate: 15,
});ERC-4337 Account Abstraction
Smart accounts backed by FROST threshold signing. Enables gas-sponsored transactions, batch calls, and programmable transaction validation.
import { Sequence0Account } from '@sequence0/sdk';
// Create a new AA wallet backed by FROST
const account = await Sequence0Account.create({
threshold: 16,
committeeSize: 24,
chain: 'ethereum',
ownerPrivateKey: '0x...',
bundlerUrl: 'https://api.pimlico.io/v2/1/rpc?apikey=YOUR_KEY',
});
console.log('Smart Account:', account.getAddress());
// Send a single transaction
const txHash = await account.sendTransaction({
to: '0xRecipient',
value: BigInt('1000000000000000000'),
});
// Batch multiple calls
const txHash2 = await account.sendBatchTransaction([
{ to: '0xTokenA', data: '0xa9059cbb...' },
{ to: '0xTokenB', data: '0xa9059cbb...' },
]);
// Sign messages
const sig = await account.signMessage('Hello from Sequence0 AA!');Features
| Feature | Description | |---------|-------------| | Multi-Chain | Ethereum, Bitcoin, Solana, Polygon, Arbitrum, Base, and 60+ more (67 total) | | Threshold Signing | FROST (t-of-n) — no single point of failure | | No Private Keys | Keys are sharded across the agent network | | Bitcoin Taproot | Native P2TR support with BIP-340 Schnorr signatures | | Account Abstraction | ERC-4337 smart accounts with batched transactions | | Real-Time Events | WebSocket subscriptions for signing progress | | Chain Adapters | Auto-builds chain-native transactions |
Supported Chains
EVM (secp256k1)
Ethereum, Polygon, Arbitrum, Optimism, Base, BSC, Avalanche, and 40+ more
Bitcoin (Taproot/Schnorr)
Full P2TR lifecycle: address derivation, UTXO selection, transaction building, Schnorr signing, and broadcast via the BitcoinTaprootAdapter.
Solana (Ed25519)
Native SOL transfers with versioned transactions.
Note: Dogecoin and Litecoin support wallet creation and raw message signing via
sign(). FullsendTransaction()support for these UTXO chains is coming soon.
API Reference
Sequence0 -- Main Client
const s0 = new Sequence0({
network: 'mainnet', // 'mainnet' | 'testnet'
agentUrl: '...', // Agent node URL (optional)
timeout: 30000, // Request timeout (optional)
});Ownership Verification
Every /sign request requires an ownership proof. Configure an ownerSigner or ownerPrivateKey when creating the SDK instance:
// Option 1: Private key (SDK derives signer automatically)
const s0 = new Sequence0({
network: 'mainnet',
ownerPrivateKey: '0xYourPrivateKey...',
});
// Option 2: Custom signer function
const s0 = new Sequence0({
network: 'mainnet',
ownerSigner: async (digest: Uint8Array) => {
// Sign the 32-byte digest and return 65-byte hex signature
return myWallet.signDigest(digest);
},
});When creating a wallet, pass the creator address to record ownership on-chain:
const wallet = await s0.createWallet({
chain: 'ethereum',
creator: '0xYourAddress...',
});Methods
| Method | Returns | Description |
|--------|---------|-------------|
| createWallet(options) | Promise<Wallet> | Create a new threshold wallet via DKG |
| getWallet(walletId) | Promise<Wallet> | Get an existing wallet |
| listWallets() | Promise<WalletDetail[]> | List all wallets |
| requestSignature(walletId, message) | Promise<string> | Submit a signing request (returns requestId) |
| signAndWait(walletId, message, timeout?) | Promise<string> | Sign and wait for result |
| getStatus() | Promise<StatusResponse> | Get network status |
| health() | Promise<HealthResponse> | Health check |
| subscribe(walletId?) | Promise<WsClient> | Subscribe to real-time events |
| refreshKeys(walletId) | Promise<void> | Proactive key rotation |
Wallet -- Threshold Wallet
const wallet = await s0.createWallet({
chain: 'ethereum',
threshold: { t: 16, n: 24 }, // optional, default shown
curve: 'secp256k1', // auto-detected from chain
});Methods
| Method | Returns | Description |
|--------|---------|-------------|
| sign(transaction) | Promise<SignedTransaction> | Sign a transaction |
| sendTransaction(transaction) | Promise<string> | Sign + broadcast (returns tx hash) |
| broadcast(signedTx) | Promise<string> | Broadcast a signed transaction |
| signMessage(message) | Promise<string> | Sign a message (EIP-191 for EVM) |
| signTypedData(typedData) | Promise<string> | Sign EIP-712 typed data |
| getBalance() | Promise<string> | Get native token balance |
| info() | Record<string, unknown> | Get wallet summary |
BitcoinTaprootAdapter -- Bitcoin P2TR
import { BitcoinTaprootAdapter } from '@sequence0/sdk';
const btc = new BitcoinTaprootAdapter({ network: 'mainnet' });| Method | Returns | Description |
|--------|---------|-------------|
| deriveAddress(pubkeyHex) | TaprootAddressInfo | Derive bc1p... address from FROST public key |
| getBalance(address) | Promise<string> | Get balance in satoshis |
| getUTXOs(address) | Promise<TaprootUtxo[]> | Fetch unspent outputs |
| getFeeRates() | Promise<FeeRateEstimate> | Get recommended fee rates |
| buildTransaction(tx, from) | Promise<string> | Build unsigned transaction |
| buildUnsignedTx(inputs, outputs, feeRate) | UnsignedTaprootTx | Build with explicit inputs/outputs |
| attachSignature(unsignedTx, sig) | Promise<string> | Attach FROST Schnorr signature |
| broadcast(signedTx) | Promise<string> | Broadcast to Bitcoin network |
| getTransaction(txid) | Promise<any> | Get transaction details |
| getBlockHeight() | Promise<number> | Get current block height |
Sequence0Account -- ERC-4337 Smart Account
import { Sequence0Account } from '@sequence0/sdk';
const account = await Sequence0Account.create({
threshold: 16,
committeeSize: 24,
chain: 'ethereum',
ownerPrivateKey: '0x...',
bundlerUrl: 'https://bundler.example.com',
});| Method | Returns | Description |
|--------|---------|-------------|
| Sequence0Account.create(options) | Promise<Sequence0Account> | Create new AA wallet via DKG |
| Sequence0Account.fromExisting(walletId, pubkey, options) | Promise<Sequence0Account> | Reconnect to existing wallet |
| getAddress() | string | Get smart account address |
| sendTransaction(tx) | Promise<string> | Build, sign, submit UserOperation |
| sendBatchTransaction(txs) | Promise<string> | Batch multiple calls |
| signMessage(message) | Promise<string> | Sign with EIP-191 prefix |
| buildUserOp(callData) | Promise<PackedUserOperation> | Build unsigned UserOp |
| submitUserOp(userOp, bundlerUrl?) | Promise<string> | Submit to bundler |
| estimateUserOpGas(userOp) | Promise<UserOperationGasEstimate> | Estimate gas |
| waitForUserOp(hash, timeout?) | Promise<UserOperationReceipt> | Wait for inclusion |
| getBalance() | Promise<string> | Get native token balance |
| isDeployed() | boolean | Check if deployed on-chain |
Chain Adapters
Use chain adapters directly for advanced control:
import {
EthereumAdapter,
BitcoinTaprootAdapter,
SolanaAdapter,
} from '@sequence0/sdk';
const eth = new EthereumAdapter('ethereum', 'https://eth.llamarpc.com');
const btc = new BitcoinTaprootAdapter({ network: 'mainnet' });
const sol = new SolanaAdapter('mainnet');WebSocket Events
const ws = await s0.subscribe('my-wallet-id');
ws.on('SigningStarted', (e) => console.log('Signing started:', e));
ws.on('SigningComplete', (e) => console.log('Signature:', e.signature));
ws.on('WalletCreated', (e) => console.log('New wallet:', e.public_key));
ws.on('FeeCollected', (e) => console.log('Fee collected:', e.tx_hash));
ws.on('Heartbeat', (e) => console.log('Peers:', e.connected_peers));Error Handling
import { Sequence0Error, DkgError, SigningError, TimeoutError } from '@sequence0/sdk';
try {
await wallet.sendTransaction({ to: '0x...', value: '100' });
} catch (e) {
if (e instanceof TimeoutError) {
console.log('Signing network busy, try again');
} else if (e instanceof SigningError) {
console.log('Signing failed:', e.message);
}
}Any Language (HTTP)
This SDK wraps an internal HTTP + JSON interface exposed by every agent node. The SDK handles connection and discovery automatically, but you can also integrate from any language -- Python, Go, Rust, Java, etc. -- by calling the agent's HTTP endpoint directly:
# Health check
curl http://AGENT_HOST:8080/health
# Create a wallet (DKG)
curl -X POST http://AGENT_HOST:8080/dkg/initiate \
-H 'Content-Type: application/json' \
-d '{"wallet_id":"my-wallet","participants":["peer1","peer2"],"threshold":2,"curve":"secp256k1"}'
# Sign a message
curl -X POST http://AGENT_HOST:8080/sign \
-H 'Content-Type: application/json' \
-d '{"wallet_id":"my-wallet","message":"48656c6c6f"}'
# Poll for signature
curl http://AGENT_HOST:8080/sign/REQUEST_IDTestnet agents: Operated by Sequence0 at 3.140.248.117 (ports 8080-8082).
Mainnet: Auto-discover agents from the on-chain AgentRegistry, or connect to a known agent URL.
Full HTTP reference: sequence0.network/docs
Networks
| | Mainnet | Testnet |
|---|---|---|
| Chain ID | 800801 | 800800 |
| RPC | https://rpc.sequence0.network | https://testnet-rpc.sequence0.network |
| Explorer | https://explorer.sequence0.network | https://testnet.sequence0.network |
Economics
Signing fees are always paid in ETH on the Sequence0 chain (chain 800801). Fees are collected by the FeeCollector contract and distributed to participating agents.
License
MIT (c) Sequence0 Network
