Quick start
Install dependencies and set up your environment:
npm install @arkade-os/sdk @scure/base
import {
RestArkProvider,
RestIndexerProvider,
MnemonicIdentity,
VtxoScript,
Transaction,
MultisigTapscript,
CLTVMultisigTapscript,
buildOffchainTx,
CSVMultisigTapscript,
networks
} from '@arkade-os/sdk';
import { hex, base64 } from '@scure/base';
// Setup providers
const arkProvider = new RestArkProvider('https://arkade.computer');
const indexerProvider = new RestIndexerProvider('https://arkade.computer');
const info = await arkProvider.getInfo();
// => { signerPubkey: string, fees: ServerFees, ... }
// Convert 33-byte compressed pubkey to 32-byte x-only
const serverPubkey = hex.decode(info.signerPubkey).slice(1);
// Create identity
const identity = MnemonicIdentity.fromMnemonic("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
const myPubkey = await identity.xOnlyPublicKey();
Use @scure/base for encoding, NOT bitcoinjs-lib. The SDK is built on @scure libraries.
Tapscript helpers
The SDK includes helper classes for common Tapscript patterns:
| Helper | Purpose |
|---|
MultisigTapscript | N-of-N multisig scripts |
CLTVMultisigTapscript | Multisig with absolute timelock (CLTV) |
CSVMultisigTapscript | Multisig with relative timelock (CSV) |
VtxoScript | Combine multiple spending paths into a Taproot tree |
Learn how to use these helpers with VTXOs and the two-phase transaction flow
Next steps
Escrow
Build a complete escrow contract
Deep dive
Learn about VTXOs, transaction flow, and Tapscript helpers