← Back to Home

Microledger Protocol: Bank-Anchored State Channels Specification

Complete technical specification for bilateral transaction ledgers with institutional trust

What is BASC?

Bank-Anchored State Channels (BASC) is the technical implementation of the Microledger protocol, providing a lightweight, bilateral transaction system with institutional trust backing. This specification defines the reference implementation for peer-to-peer value transfer with centralized trust establishment through existing financial institutions.

System Architecture

Payer

(Agent)
Microledger (BASC)

Payee

(Service)

Payer Bank

Settlement Layer

Payee Bank

Inter-bank Settlement

Core Components

1. Identity Registry

2. Bank Service

3. Microledger Protocol

Block Specifications

Base Block Structure

interface Block {
  blockNumber: number;                    // Sequential, starts at 1
  blockType: "genesis" | "transaction" | "settlement";
  previousBlockHash?: string;             // null for genesis block
  digitalFingerprint: string;             // SHA-256 of canonical representation
  timeImprint: string;                    // ISO-8601 timestamp
  controllingIdentifiers: string[];       // Both party IDs
  signatures: Signature[];               // Signatures from all controlling parties
}

interface Signature {
  algorithm: "RSA" | "ECDSA" | "Ed25519";
  publicKeyId: string;                   // Reference to signing party
  value: string;                         // Base64-encoded signature
}

Genesis Block

Establishes the bilateral Microledger with dedicated bank commitment.

interface GenesisBlock extends Block {
  blockType: "genesis";
  bankCommitment: {
    bank: string;                        // Bank identifier
    escrowId: string;                    // Unique escrow reference
    dedicatedAmount: number;             // Amount locked for this Microledger
    channelId: string;                   // Unique Microledger identifier
    expiration: string;                  // ISO-8601 expiration timestamp
    bankSignature: string;               // Bank's cryptographic commitment
  };
}

Example:

{
  "blockNumber": 1,
  "blockType": "genesis",
  "digitalFingerprint": "sha256:abc123...",
  "timeImprint": "2024-08-22T10:30:00Z",
  "controllingIdentifiers": ["agent-123", "weather-api"],
  "bankCommitment": {
    "bank": "first-national-bank",
    "escrowId": "escrow-xyz789",
    "dedicatedAmount": 100.00,
    "channelId": "channel-agent123-weather",
    "expiration": "2024-08-29T10:30:00Z",
    "bankSignature": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
  },
  "signatures": [
    {
      "algorithm": "RSA",
      "publicKeyId": "agent-123",
      "value": "dGVzdCBzaWduYXR1cmUgZm9yIGFnZW50"
    },
    {
      "algorithm": "RSA", 
      "publicKeyId": "weather-api",
      "value": "dGVzdCBzaWduYXR1cmUgZm9yIHdlYXRoZXI="
    }
  ]
}

Transaction Block

Records individual peer-to-peer transactions within the Microledger.

interface TransactionBlock extends Block {
  blockType: "transaction";
  previousBlockHash: string;             // Required for transaction blocks
  transaction: {
    from: string;                        // Payer identifier
    to: string;                          // Payee identifier
    amount: number;                      // Transaction amount
    currency: string;                    // Currency code (USD, EUR, etc.)
    service?: string;                    // Service identifier
    metadata?: Record;      // Additional transaction data
  };
}

Example:

{
  "blockNumber": 5,
  "blockType": "transaction",
  "previousBlockHash": "sha256:def456...",
  "digitalFingerprint": "sha256:ghi789...",
  "timeImprint": "2024-08-22T11:45:30Z",
  "controllingIdentifiers": ["agent-123", "weather-api"],
  "transaction": {
    "from": "agent-123",
    "to": "weather-api",
    "amount": 0.05,
    "currency": "USD",
    "service": "current_weather",
    "metadata": {
      "location": "New York",
      "units": "metric",
      "requestId": "req_abc123"
    }
  },
  "signatures": [
    {
      "algorithm": "RSA",
      "publicKeyId": "agent-123",
      "value": "YWdlbnQgc2lnbmF0dXJlIGZvciB0cmFuc2FjdGlvbg=="
    },
    {
      "algorithm": "RSA",
      "publicKeyId": "weather-api", 
      "value": "d2VhdGhlciBzaWduYXR1cmUgZm9yIHRyYW5zYWN0aW9u"
    }
  ]
}

Settlement Block

Final Microledger closure and balance reconciliation.

interface SettlementBlock extends Block {
  blockType: "settlement";
  previousBlockHash: string;
  channelSummary: {
    totalTransactions: number;           // Count of transaction blocks
    totalAmount: number;                 // Sum of all transactions
    finalBalance: Record; // Final balance per party
    settlementMethod: "cooperative" | "unilateral" | "expired";
    settlementReason?: string;           // Optional closure reason
  };
}

Example:

{
  "blockNumber": 42,
  "blockType": "settlement",
  "previousBlockHash": "sha256:jkl012...",
  "digitalFingerprint": "sha256:mno345...",
  "timeImprint": "2024-08-22T16:00:00Z", 
  "controllingIdentifiers": ["agent-123", "weather-api"],
  "channelSummary": {
    "totalTransactions": 40,
    "totalAmount": 12.50,
    "finalBalance": {
      "agent-123": 87.50,
      "weather-api": 12.50
    },
    "settlementMethod": "cooperative",
    "settlementReason": "Planned channel closure"
  },
  "signatures": [
    {
      "algorithm": "RSA",
      "publicKeyId": "agent-123", 
      "value": "ZmluYWwgYWdlbnQgc2lnbmF0dXJlIGZvciBzZXR0bGVtZW50"
    },
    {
      "algorithm": "RSA",
      "publicKeyId": "weather-api",
      "value": "ZmluYWwgd2VhdGhlciBzaWduYXR1cmUgZm9yIHNldHRsZW1lbnQ="
    }
  ]
}

Protocol Flow

1. Microledger Establishment

Step 1: Identity Registration

POST /identities/agent-123
X-Signature: <timestamp-signature>

{
  "timestamp": "2024-08-22T10:00:00Z",
  "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
}

Step 2: Escrow Creation

POST /customers/agent-123/escrow
X-Signature: <request-signature>

{
  "recipient": "weather-api",
  "amount": 100.00,
  "activeDurationInSeconds": 604800,  // 7 days
  "expirationInSeconds": 86400        // 1 day grace period
}

Response includes X-Proof-of-Funds header with bank commitment.

Step 3: Genesis Block Creation

Both parties co-sign genesis block referencing the bank commitment.

2. Transaction Execution

Step 1: Service Request with State Update

GET /weather/current?location=NYC
X-State-Channel-Block: <base64-encoded-transaction-block>
X-Channel-ID: channel-agent123-weather

The X-State-Channel-Block contains the signed transaction block that both parties have agreed upon.

Step 2: Service Response with Acknowledgment

HTTP/1.1 200 OK
X-State-Channel-Ack: <base64-encoded-counter-signature>
X-Channel-Balance: 99.95

{
  "temperature": 22,
  "condition": "sunny",
  "humidity": 65
}

3. Microledger Settlement

Cooperative Closure

Both parties agree on final state and co-sign settlement block:

POST /channels/channel-agent123-weather/settle
X-State-Channel-Block: <base64-encoded-settlement-block>

{
  "method": "cooperative",
  "finalBalance": {
    "agent-123": 87.50,
    "weather-api": 12.50
  }
}

Cryptographic Specifications

Hash Function

Digital Signatures

Public Key Formats

Data Encoding

Key Features

Security Considerations

Double-Spending Prevention

Signature Verification

Dispute Resolution

Privacy Protection

Implementation Requirements

Mandatory Features

  1. Block Validation: Verify signatures and hash integrity
  2. State Synchronization: Both parties maintain identical Microledger state
  3. Commitment Verification: Validate bank commitments before Microledger creation
  4. Settlement Processing: Handle cooperative and unilateral closures

Optional Features

  1. Automatic Reconciliation: Periodic state synchronization checks
  2. Backup and Recovery: Microledger state backup mechanisms
  3. Monitoring and Alerts: Balance and expiration notifications
  4. Batch Processing: Multiple transactions in single block

Error Handling

Testing Framework

Unit Tests

Integration Tests

Load Tests

Technical Collaboration

Interested in contributing to the specification or building implementations?


This specification provides the foundation for implementing the Microledger protocol through bank-anchored state channels that enable secure, efficient peer-to-peer transactions with institutional trust backing.