Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BoAT Attestor User Guide

BoAT Attestor (boat-attest) runs on a VisionFive2 RISC-V board and attests system metrics (memory, CPU usage) to the HashAnchor blockchain attestation platform.

Each attestation creates a tamper-proof, on-chain record of the board's resource usage at a specific point in time.

Prerequisites

  • VisionFive2 board running Debian Linux (riscv64)
  • Python 3.11 with venv
  • Network connectivity to HashAnchor (hashanchor.xid.network)
  • A HashAnchor tenant account with API key

Installation

1. Set up the environment

mkdir -p ~/boatattestor
python3 -m venv ~/boatattestor/venv
~/boatattestor/venv/bin/pip install requests "eth_account<0.11" "pydantic<2" ed25519

2. Deploy the program

Copy boat-attest.py and boat-attest (launcher script) to ~/boatattestor/.

chmod +x ~/boatattestor/boat-attest ~/boatattestor/boat-attest.py

3. Register the device

The device must be registered with your HashAnchor tenant before it can submit attestations.

Step 1: Pre-register (from any machine with your API key)

curl -X POST https://hashanchor.xid.network/v1/device/register \
  -H "Authorization: Bearer ha_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"deviceId": "BoatAttestor-VF2-YOUR_MAC"}'

The device ID is derived from eth0's MAC address with colons removed. Find it with:

cat /sys/class/net/eth0/address
# Example: 6c:cf:39:00:b0:8c → BoatAttestor-VF2-6ccf3900b08c

Step 2: Run boat-attest once (on the board)

The first run generates an Ed25519 keypair. Then register the public key:

~/boatattestor/boat-attest --dry-run
# Note the "Device key loaded/created: <public_key_hex>"

Step 3: Activate with public key

curl -X POST https://hashanchor.xid.network/v1/device/register \
  -H "Authorization: Bearer ha_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"deviceId": "BoatAttestor-VF2-YOUR_MAC", "publicKey": "PUBLIC_KEY_HEX", "algorithm": "ed25519"}'

You should see {"status":"activated",...}.

Usage

API Key Mode

~/boatattestor/boat-attest --api-key ha_YOUR_API_KEY

Or set the environment variable:

export HASHANCHOR_API_KEY=ha_YOUR_API_KEY
~/boatattestor/boat-attest

x402 Pay-per-Use Mode

Requires a funded wallet with USDC deposited into the Circle Gateway on Arc Testnet.

One-time wallet setup:

  1. The first run without --api-key creates a wallet at ~/.boat-attest-wallet.json
  2. Fund the wallet with USDC on Arc Testnet (chain ID 5042002, faucet: https://faucet.circle.com)
  3. Deposit USDC into the Gateway contract using gateway-deposit.py:
~/boatattestor/venv/bin/python3 ~/boatattestor/gateway-deposit.py 50000

Then run without --api-key:

~/boatattestor/boat-attest

Dry Run

Preview what would be attested without submitting:

~/boatattestor/boat-attest --dry-run

Debug Mode

Enable verbose output:

BOAT_DEBUG=1 ~/boatattestor/boat-attest --api-key ha_YOUR_API_KEY

What Gets Attested

Each attestation captures a JSON snapshot:

{
  "timestamp": 1773475236,
  "memory": { "total_kb": 8079824, "available_kb": 6967860, "used_kb": 1111964 },
  "cpu": { "user": 299902, "system": 309210, "idle": 22432569, ... },
  "loadavg": { "1min": 0.8, "5min": 0.55, "15min": 0.39 }
}

The JSON is SHA-256 hashed, signed with the device's Ed25519 key, and submitted to HashAnchor. The timestamp ensures each submission produces a unique hash.

Verification

After a successful attestation, verify the hash on-chain:

https://hashanchor.xid.network/v1/verify/0xYOUR_HASH

Files

File Location Purpose
boat-attest ~/boatattestor/ Launcher script
boat-attest.py ~/boatattestor/ Main program
gateway-deposit.py ~/boatattestor/ USDC Gateway deposit helper
venv/ ~/boatattestor/ Python virtual environment
.boat-attest-device.json ~/ Ed25519 device keypair
.boat-attest-wallet.json ~/ Secp256k1 wallet (x402 mode)

Periodic Attestation

To attest every hour via cron:

crontab -e
# Add:
0 * * * * ~/boatattestor/boat-attest --api-key ha_YOUR_API_KEY >> ~/boatattestor/attest.log 2>&1

About

BoAT Attestor on VisionFive2 board (from Starfive)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages