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
Payee
Payer Bank
Payee Bank
Core Components
1. Identity Registry
- Purpose: Maintains trust-on-first-use mapping of entity names to public keys
- Trust Model: Centralized registry prevents identity spoofing
- Registration: Entities register with timestamp + signature proof of key ownership
2. Bank Service
- Purpose: Provides escrow commitments and settlement services
- Escrow Creation: Locks specific funds for dedicated bilateral Microledgers
- Commitment Signing: Creates cryptographic guarantees preventing double-spending
- Settlement Processing: Handles final Microledger closure and fund distribution
3. Microledger Protocol
- Genesis: Microledger establishment with bank commitment
- Transactions: Bilateral P2P transaction execution
- Settlement: Cooperative or unilateral Microledger closure
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
- Algorithm: SHA-256 (required for all implementations)
- Canonical Representation: JSON with sorted keys, no whitespace for hash computation
- Encoding: Hex string (lowercase)
Digital Signatures
- Supported Algorithms: RSA (RSASSA-PKCS1-v1_5), ECDSA (secp256k1), Ed25519
- Message: SHA-256 hash of the block's digital fingerprint
- Encoding: Base64
Public Key Formats
- RSA: PEM format (PKCS#1 or PKCS#8)
- ECDSA: PEM format with explicit curve parameters
- Ed25519: PEM format as specified in RFC 8410
Data Encoding
- JSON: Required for human readability, documentation, and interoperability testing
- CBOR: Optional for production efficiency and bandwidth optimization
- Hash Computation: Always use canonical JSON representation regardless of transport encoding
- Backward Compatibility: All implementations must support JSON; CBOR support is optional
Key Features
- Bilateral Architecture: Private transaction channels between two parties
- Cryptographic Integrity: All transactions cryptographically signed and linked
- Independent Settlement: Each party settles with chosen financial institution
- Energy Efficient: 99.9% less energy than traditional blockchain
Security Considerations
Double-Spending Prevention
- Each bank commitment is unique to one bilateral Microledger
- Bank validates that escrow funds haven't been committed elsewhere
- Microledger ID prevents replay attacks across different Microledgers
Signature Verification
- All blocks must be signed by both controlling parties
- Bank commitments must be verified against bank's public key
- Invalid signatures result in Microledger closure
Dispute Resolution
- Complete Microledger history provides cryptographic audit trail
- Banks can verify final state from transaction sequence
- Unilateral closure possible if one party becomes unresponsive
Privacy Protection
- Transaction details only visible to Microledger participants
- Banks only see escrow commitments and final settlements
- No global broadcast of transaction history
Implementation Requirements
Mandatory Features
- Block Validation: Verify signatures and hash integrity
- State Synchronization: Both parties maintain identical Microledger state
- Commitment Verification: Validate bank commitments before Microledger creation
- Settlement Processing: Handle cooperative and unilateral closures
Optional Features
- Automatic Reconciliation: Periodic state synchronization checks
- Backup and Recovery: Microledger state backup mechanisms
- Monitoring and Alerts: Balance and expiration notifications
- Batch Processing: Multiple transactions in single block
Error Handling
- Invalid Signature: Reject block and maintain previous state
- State Mismatch: Initiate reconciliation protocol
- Expired Commitment: Automatic Microledger closure
- Bank Unavailable: Queue settlement until bank accessible
Testing Framework
Unit Tests
- Block creation and validation
- Signature generation and verification
- Hash computation and verification
- Microledger state updates
Integration Tests
- End-to-end Microledger lifecycle
- Multi-party signature coordination
- Bank commitment validation
- Settlement processing
Load Tests
- High-frequency transaction processing
- Multiple concurrent Microledgers
- Large transaction history handling
- Memory and CPU usage optimization
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.