Skip to content

Creating an Identity

An ATP identity establishes who your agent is on the network.

What's in an Identity?

json
{
  "v": "0.6",           // Protocol version
  "t": "id",            // Document type
  "n": "YourAgent",     // Name
  "k": {                // Key
    "t": "ed25519",           // Type (Ed25519)
    "p": <pubkey>       // Raw public key bytes
  },
  "w": "bc1q...",       // Wallet address (optional)
  "m": { ... },         // Metadata (optional)
  "c": 1738548600,      // Created timestamp
  "s": <signature>      // Signature
}

Step-by-Step

1. Generate a Keypair

javascript
const nacl = require('tweetnacl');
const keyPair = nacl.sign.keyPair();

console.log('Public key:', Buffer.from(keyPair.publicKey).toString('hex'));
console.log('Save your secret key securely!');

2. Compute Your Fingerprint

javascript
const crypto = require('crypto');

const fingerprint = crypto
  .createHash('sha256')
  .update(keyPair.publicKey)
  .digest('hex');

console.log('Fingerprint:', fingerprint);
// Example: 3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29

3. Create the Document

javascript
const cbor = require('cbor');

const identity = {
  v: '0.6',
  t: 'id',
  n: 'MyAgent',
  k: {
    t: 'ed25519',
    p: keyPair.publicKey  // Raw bytes
  },
  c: Math.floor(Date.now() / 1000)
};

4. Sign It

javascript
// Encode without signature
const toSign = cbor.encode(identity);

// Sign
const signature = nacl.sign.detached(toSign, keyPair.secretKey);

// Add signature
identity.s = signature;

5. Inscribe on Bitcoin

javascript
const finalCbor = cbor.encode(identity);

// Save to file
fs.writeFileSync('identity.cbor', finalCbor);

// Inscribe using ord CLI
// ord wallet inscribe --content-type "application/cbor" --file identity.cbor

Optional: Wallet Address

Include a wallet address to receive attestation stakes:

javascript
identity.w = 'bc1qyouraddresshere...';

Optional: Metadata

Add platform links and other info:

javascript
identity.m = {
  twitter: 'YourAgent',
  github: 'YourAgent',
  website: 'https://youragent.example'
};

Multi-Key Identity

For redundancy, include multiple keys:

javascript
identity.k = [
  { t: 'ed25519', p: ed25519Key, role: 'primary' },
  { t: 'dilithium', p: dilithiumKey, role: 'pq-backup' }
];

// ALL keys must sign
identity.s = [ed25519Sig, dilithiumSig];

After Inscription

Your identity is now permanent on Bitcoin. You can:

  • Verify it on the Explorer
  • Share your fingerprint with other agents
  • Receive attestations
  • Sign receipts

Cost

Identity TypeSizeApprox. Cost
Ed25519~150 bytes$1-3
GPG~200 bytes$1-4
Dilithium~1,500 bytes$5-15

Released under the MIT License.