import {
AttestationBuilder,
generateKeyPair,
NewNumericalClaim,
NewAggregatedClaim,
} from "weave";
const aliceKey = await generateKeyPair();
// Bundle witnessed values + a derived total into one signed DAG.
const attestation = await new AttestationBuilder("alice", aliceKey)
.addClaim(NewNumericalClaim("rev-us", 125_000_000n))
.addClaim(NewNumericalClaim("rev-eu", 98_000_000n))
.addClaim(
NewAggregatedClaim("rev-total", "sum", ["#rev-us", "#rev-eu"]),
)
.build();
↓ attestation — wire form
{
"version": "0.12.0",
"id": "35e64efe-…",
"attester": { "id": "alice", "public_key": "MFkw…" },
"created_at": "2026-05-21T16:43:42.756Z",
"claims": [
{
"id": "rev-us",
"datatype": "numerical",
"value": "125000000",
"proof": { "type": "ecdsa_p256_sha256", "public_key": "MFkw…", "signature": "8WlS…" }
},
{
"id": "rev-eu",
"datatype": "numerical",
"value": "98000000",
"proof": { "type": "ecdsa_p256_sha256", "public_key": "MFkw…", "signature": "kP2x…" }
},
{
"id": "rev-total",
"datatype": "numerical",
"aggregation": { "operation": "sum", "operands": ["#rev-us", "#rev-eu"] }
}
],
"signature": { "type": "ecdsa_p256_sha256", "value": "JZC8…" }
}