QSBitcoin for Developers

Complete technical guide for implementing quantum-safe signatures in Bitcoin Core forks and building applications with QSBitcoin.

Implementation Overview

QSBitcoin is a quantum-safe fork of Bitcoin Core v28.0 that adds NIST-standardized post-quantum signatures via a soft fork. The implementation is under active development with core features operational on testnet/regtest.

Key Architecture Components

Source Code & Documentation

RPC Interface

QSBitcoin extends Bitcoin Core's RPC interface with quantum-specific commands:

Extended Commands

# Generate quantum address
getnewaddress "label" "bech32" "ml-dsa|slh-dsa"

# Estimate fees for quantum transactions
estimatesmartfee conf_target "ECONOMICAL" "ml-dsa|slh-dsa"

# Sign message with any algorithm
signmessage "address" "message"

# Verify quantum signatures
verifymessage "address" "signature" "message"

New Quantum Commands

# Get quantum wallet information
getquantuminfo
# Returns:
{
  "enabled": true,
  "algorithms": ["ml-dsa", "slh-dsa"],
  "address_count": {
    "ml-dsa": 5,
    "slh-dsa": 2
  },
  "activation_status": "active"
}

# Estimate transaction fee
estimatetxfee conf_target "ml-dsa|slh-dsa"

Implementation Guide

To create a compatible quantum-safe Bitcoin implementation:

1. Implement Signature Interface

class ISignatureScheme {
    virtual bool Sign(const uint256& hash, vector& sig) = 0;
    virtual bool Verify(const uint256& hash, const vector& sig) = 0;
    virtual size_t GetPublicKeySize() = 0;
    virtual size_t GetPrivateKeySize() = 0;
    virtual size_t GetSignatureSize() = 0;
};

2. Script Interpreter Modifications

3. Consensus Rules

4. Wallet Integration

Critical Implementation Notes

Key Differences from Bitcoin

Common Pitfalls to Avoid

Testing Your Implementation

Essential test cases for quantum-safe implementations:

Unit Tests

  1. Generate quantum addresses and verify bech32 encoding
  2. Create and sign quantum transactions
  3. Verify cross-compatibility with reference implementation
  4. Test soft fork activation on regtest
  5. Validate fee calculations with discounts
  6. Test witness script execution with quantum opcodes

Integration Tests

# Run quantum-specific tests
./build/bin/test_bitcoin -t "*quantum*"

# Test on regtest network
bitcoind -regtest -fallbackfee=0.00001
bitcoin-cli -regtest getnewaddress "" "bech32" "ml-dsa"
bitcoin-cli -regtest generatetoaddress 101 "address"

# Functional tests
build/test/functional/test_runner.py wallet_quantum.py

Contributing to QSBitcoin

We welcome contributions to the reference implementation:

See the Development page for contribution guidelines.