QUICKSTART

Install the library. Inspect the evidence.

Install from PyPI or npm, verify a record, or run full examples from source. Inspect the signed acts and records rather than relying on a generic success flag.

01 / QUICKSTART

A spec you can run, not just read.

Start with the published library for your language. Both packages are at release 0.3.4. The specification remains a draft and the implementations are pre-1.0; APIs, wire and record formats can change between minor releases.

Python package

Requires Python 3.11+. Install in an activated virtual environment.

PYTHON / PACKAGE QUICKSTART
pip install a2cn
python -c "import a2cn; print(a2cn.__version__, a2cn.PROTOCOL_VERSIONS)"
a2cn-verify --help

Copy the complete command sequence.

Print the installed release and its separate protocol-version axes, then inspect the command-line verifier’s options.

a2cn on PyPI ↗

TypeScript package

Requires Node.js 20.18.1+. The package is ESM only.

TYPESCRIPT / PACKAGE INSTALL
npm install @a2cn/a2cn

Copy the complete command sequence.

This example uses public package exports to sign and verify a canonical hash. Save it as example.mjs in your npm project and run node example.mjs.

TYPESCRIPT / ESM EXAMPLE
import {
  PROTOCOL_VERSIONS, generateKeypair,
  hashObject, signJws, verifyJws,
} from "@a2cn/a2cn";

console.log(PROTOCOL_VERSIONS.wire);
const { privateKey, publicKey } = generateKeypair();
const digest = hashObject({ total_minor: 10500000, currency: "USD" });
const token = signJws(digest, privateKey);
console.log(verifyJws(token, publicKey) === digest); // true

Copy the complete command sequence.

@a2cn/a2cn on npm ↗

Verify a record

The Python package installs a2cn-verify. Here, deal/ is a directory you supply containing a deal’s TransactionRecord and session evidence record. Installing the package does not create it. The verifier checks the records and fetches the parties’ DID documents unless you choose offline verification.

PYTHON / VERIFY A RECORD
a2cn-verify deal/

Copy the complete command sequence.

To use saved DID documents without network requests, include them among your inputs and run a2cn-verify deal/ --offline. Offline documents are not checked against the parties’ sites. The npm package exposes library verifiers; it does not include this Python CLI.

Run full examples from source

Installing a library does not run a complete negotiation demo. Use a source checkout for the bilateral examples, MCP servers and platform integrations. Commands below use a POSIX shell; on Windows, activate Python with .venv\Scripts\Activate.ps1. Running the TypeScript repository’s test suite requires Node.js 22.12+.

Python source

PYTHON / SOURCE QUICKSTART
git clone https://github.com/A2CN-protocol/A2CN.git
cd A2CN/reference-implementation/python
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python examples/saas_renewal.py

Copy the complete command sequence.

The SaaS renewal demo negotiates between two reference parties and compares their independently generated TransactionRecord hashes. From the same directory, run python examples/invitation_flow.py for the invitation integration demo.

The MCP server is not shipped in the package. From this checkout, install its optional dependencies with pip install -e '.[mcp]' and run python mcp_server.py.

Python source and demo notes ↗

TypeScript source

TYPESCRIPT / SOURCE QUICKSTART
git clone https://github.com/A2CN-protocol/A2CN.git
cd A2CN/reference-implementation/typescript
npm ci
npx tsx examples/saas_renewal.ts

Copy the complete command sequence.

The source demo uses the checkout’s tsx runner. After npm ci, run npx tsx src/mcp_server.ts for the source MCP server. The MCP server, platform adapters and UBL export are not included in the published npm package.

TypeScript source and demo notes ↗

Source commands follow repository main, which may advance independently of the published packages. Consult the changelog and pin a release tag when you need a reproducible source checkout.

02 / INSPECT / VERIFY

Follow the agreement through to its evidence.

01Inspect the acts
The output includes the signed final offer and acceptance. Compare their session, sender, round and exact offer binding.
02Inspect the TransactionRecord
Look for record_version 0.4, agreed_terms, final_offer, final_acceptance, offer_chain_hash and record_hash. Both parties should print the same record hash.
03Continue with terminal evidence
A SessionEvidenceRecord serves a different purpose. Read the evidence guide and reference evidence functions before handling externally completed or unsigned-counterparty workflows.