npm package: @sequence0/agent
Description: SEQUENC∑0 Network — Run an agent node. Powered by Sig∑a.
Latest version: 3.7.5

# @sequence0/agent (Legacy npm wrapper)

> **Legacy npm wrapper** for the Sequence0 FROST signing agent binary. This package installs a platform-specific native binary via npm but is no longer the recommended installation method.

> **Recommended:** Install via `curl -fsSL https://install.sequence0.network | sh` — no Node.js required. This installs [BlockClaw](https://sequence0.network/blockclaw), which manages the agent binary automatically with AI-powered monitoring, self-healing, and an interactive CLI.
>
> **App developers:** Use [`@sequence0/sdk`](https://www.npmjs.com/package/@sequence0/sdk) to build applications on top of the Sequence0 network.

## Install

```bash
# Recommended: BlockClaw (manages agent binary, no Node.js required)
curl -fsSL https://install.sequence0.network | sh
blockclaw setup
```

### Alternative: npm install

```bash
# Legacy npm install (requires Node.js)
npm install -g @sequence0/agent

# Or one-shot with npx
npx @sequence0/agent --network mainnet
```

## Quick Start

```bash
# Run on mainnet
sequence0-agent --network mainnet

# Run on testnet
sequence0-agent --network testnet

# Custom config
sequence0-agent \
  --network mainnet \
  --port 9000 \
  --api-port 8080 \
  --data-dir ~/.sequence0/data
```

## Alternative Installation

```bash
# curl installer
curl -fsSL https://install.sequence0.network | sh

# Build from source
git clone https://github.com/sequence0network/sequence0.git
cd sequence0/agent-node
cargo build --release

# Docker
docker run -d -p 9000:9000 -p 8080:8080 sequence0/agent --network mainnet
```

## First Run

On the first start, the agent automatically generates a new wallet:

```
$ sequence0-agent --network mainnet

  Starting Sequence0 Agent v3.6.2
  Network: mainnet (chain 800801)

  ╔══════════════════════════════════════════════════════╗
  ║  New Wallet Generated                               ║
  ╠══════════════════════════════════════════════════════╣
  ║  Address:     0x7a3b...c4f2                         ║
  ║  Private Key: 0x9e1f...8a3d                         ║
  ╠══════════════════════════════════════════════════════╣
  ║  Save your private key — it will NOT be shown again ║
  ╚══════════════════════════════════════════════════════╝
```

**Important:** The private key is shown **only once** on first run. Copy it somewhere safe.

The wallet keystore is encrypted (AES-256-GCM) and saved to `~/.sequence0/data/wallet.json`. On subsequent runs, the agent loads this keystore automatically.

### Wallet Management

The agent resolves your wallet using a 3-tier priority:

| Priority | Source | Use Case |
|----------|--------|----------|
| 1 | `SEQUENCE0_WALLET_KEY=0x...` env var | CI/CD, automation |
| 2 | Keystore at `~/.sequence0/data/wallet.json` | Normal restarts |
| 3 | Interactive generation (first run) | Initial setup |

### Registration

**Free for the first 1,000 agents!** No registration fee required — just fund your wallet with a small amount of ETH on the Sequence0 chain for gas (~0.001 ETH). After 1,000 agents have joined, the standard 0.1 ETH registration fee applies.

The agent auto-registers on the AgentRegistry contract at startup. Once registered, it begins receiving DKG and signing requests.

For testnet ETH, use the faucet: https://faucet.sequence0.network

## How It Works

`@sequence0/agent` is a thin npm wrapper (used internally by BlockClaw) that installs the correct native binary for your platform:

| Package | OS | Arch |
|---|---|---|
| `@sequence0/agent-darwin-arm64` | macOS | Apple Silicon |
| `@sequence0/agent-darwin-x64` | macOS | Intel |
| `@sequence0/agent-linux-x64` | Linux | x86_64 |
| `@sequence0/agent-linux-arm64` | Linux | ARM64 |

npm resolves `os` + `cpu` fields automatically — only your platform's binary (~20MB) is downloaded.

## CLI Options

| Flag | Default | Description |
|------|---------|-------------|
| `--network` | mainnet | Network: `mainnet` or `testnet` |
| `--port` | 9000 | P2P listen port |
| `--api-port` | 8080 | Agent control port |
| `--data-dir` | ~/.sequence0/data | Persistent key storage |
| `--log-level` | info | Log level: debug, info, warn, error |
| `--rpc-url` | (auto) | Custom RPC URL |
| `--bootstrap` | (auto) | Bootstrap peer multiaddr |

## What the Agent Does

On startup, the agent:
1. Connects to the Sequence0 RPC (chain 800801 mainnet / 800800 testnet)
2. Joins the P2P mesh via bootstrap peers and Kademlia DHT + GossipSub
3. Auto-registers on the AgentRegistry contract (FREE for first 1,000 agents)
4. Begins receiving DKG ceremonies and signing requests
5. Earns fees in the target chain's native token (ETH, SOL, BTC, etc.) for every co-signed transaction

## Agent Communication

When managed by BlockClaw (recommended), the agent communicates via IPC (Unix domain socket at `~/.sequence0/agent.sock`). BlockClaw handles all agent interactions automatically.

For direct binary usage, the agent exposes an HTTP interface on port 8080. See the [SDK documentation](https://sequence0.network/docs) for details.

## Earning Fees

Agents earn fees for every transaction they co-sign:

- **Fee model:** 30% of target chain gas fee, collected on the target chain in its native token (ETH on Ethereum, SOL on Solana, BTC on Bitcoin, etc.)
- **Fee collection:** Built into the signed transaction itself as an extra output/transfer
- **Fee split:** 80% to participating agents, 10% treasury, 9% reserve, 1% maker rewards
- **Node earnings:** Node runners earn in the native token of whatever chain they sign for
- **Governance:** The FeeCollector contract on the Sequence0 chain manages fee rates and split ratios

## Requirements

- 2+ CPU cores, 4GB RAM, 50GB SSD
- Public IP with port 9000 (P2P) open
- Registration: FREE for first 1,000 agents (0.1 ETH after)

## 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` |

## Merkle Batch Signing

The SDK includes Merkle batch signing utilities for high-throughput scenarios. Build a Merkle tree from up to 1024 transaction hashes, sign the root once, and verify individual proofs on-chain via the BatchVerifier contract.

```typescript
import { buildMerkleTree, verifyMerkleProof } from '@sequence0/sdk';

const txHashes = ['0xabc...', '0xdef...', '0x123...'];
const { root, proofs, leafCount } = buildMerkleTree(txHashes);

// Verify a single leaf locally
const valid = verifyMerkleProof(root, txHashes[0], proofs.get(0)!);
```

See the [@sequence0/sdk README](https://www.npmjs.com/package/@sequence0/sdk) for full batch signing and committee discovery documentation.

## Uninstall

```bash
# If using BlockClaw (recommended):
blockclaw uninstall

# If using the standalone npm package:
npm uninstall -g @sequence0/agent

# (Optional) Remove wallet keystore and all local data
rm -rf ~/.sequence0
```

> **Warning:** `~/.sequence0/data/wallet.json` contains your encrypted wallet keystore. Back up your private key before deleting this directory.

## License

MIT