Skip to main content

Universal Golden Seed Consensus Protocol (GCP-1 & GQS-1)

Project description

Universal Binary Golden Seed - Hex Representation

Language-agnostic, pure machine representation

iφ = 0 + i × φ where φ = (1 + √5)/2 ≈ 1.618033988749895

Installation

As a Python Package

Install the golden-quantum package for programmatic access:

# Install from source (development mode)
pip install -e .

# Or install from PyPI (when published)
pip install golden-quantum

Standalone Scripts

The repository also includes standalone CLI scripts that work without installation:

  • universal_qkd.py - Universal QKD Key Generator (GCP-1)
  • gqs1.py - Golden Quantum Standard Test Vectors (GQS-1)

Quick Start

Python Package API

from gq import UniversalQKD, GQS1

# Generate keys using GCP-1 (Universal QKD)
generator = UniversalQKD()
key = next(generator)
print(key.hex())  # 3c732e0d04dac163a5cc2b15c7caf42c

# Generate test vectors using GQS-1
vectors = GQS1.generate_test_vectors(10)
print(vectors[0])  # a01611f01e8207a27c1529c3650c4838

Command Line Tools

# After pip install -e .
gq-universal -n 10          # Generate 10 universal QKD keys
gq-test-vectors -n 10       # Generate 10 GQS-1 test vectors

# Or use standalone scripts
python universal_qkd.py -n 10
python gqs1.py -n 10

Seed Values

16-byte seed (iφ):

0000000000000000A8F4979B77E3F93F

32-byte seed (iφ + 2×φ for consensus):

0000000000000000A8F4979B77E3F93FA8F4979B77E3F93FA8F4979B77E3F93F

Usage in any language

  1. Read binary file as raw bytes

    • Use golden_seed_16.bin for 16-byte seed
    • Use golden_seed_32.bin for 32-byte seed
  2. Interpret as IEEE 754 double-precision (little-endian complex)

    • Bytes 0-7: Real part = 0.0
    • Bytes 8-15: Imaginary part = φ ≈ 1.618033988749895
  3. XOR with block hashes for deterministic tie-breaking

    • Provides deterministic fork resolution when work scores are equal
    • All nodes will select the same fork, preventing stalling
  4. No dependencies, no interpretation layer

    • Pure binary representation
    • Works across all modern architectures
    • Language-agnostic implementation

Example Code

Note: The examples below are simplified for clarity. Production code should include comprehensive error handling appropriate for your language and use case.

Python

Library Usage:

with open('golden_seed_32.bin', 'rb') as f:
    seed = f.read(32)

# XOR with block hash for tie-breaking
block_hash = b'\x00' * 32  # Your block hash here
result = bytes(a ^ b for a, b in zip(block_hash, seed))

Universal QKD Key Generator (GCP-1):

This repository includes a production-grade Universal QKD (Quantum Key Distribution) key generator implementing the Golden Consensus Protocol v1.0 (universal_qkd.py). This protocol provides:

  • Deterministic, synchronized key generation across nodes
  • Cryptographic forward secrecy via state ratcheting
  • Basis-matching simulation (~50% efficiency, mimicking quantum systems)
  • XOR folding for key hardening
  • Infinite key stream generation
# Generate 10 keys (default)
python universal_qkd.py

# Generate 100 keys
python universal_qkd.py -n 100

# Output in JSON format with binary representation
python universal_qkd.py -n 20 --json --binary

# Save to file
python universal_qkd.py -n 50 -o keys.txt

# Quiet mode (keys only, no headers)
python universal_qkd.py -n 5 --quiet

# Verify seed checksum only
python universal_qkd.py --verify-only

# Save JSON output to file
python universal_qkd.py -n 100 --json -o keys.json

First key (for cross-implementation validation):

3c732e0d04dac163a5cc2b15c7caf42c

GQS-1 Test Vector Generation:

For test vector generation and compliance testing, use gqs1.py:

# Generate 10 test vectors (default)
python gqs1.py

# Generate 100 test vectors
python gqs1.py -n 100

# Output in JSON format
python gqs1.py -n 20 --json

# Save to file
python gqs1.py -n 50 -o vectors.txt

# Quiet mode (vectors only, no headers)
python gqs1.py -n 5 --quiet

# Verify seed checksum only
python gqs1.py --verify-only

For more options, run:

python gqs1.py --help
python universal_qkd.py --help

C/C++

#include <stdio.h>
#include <stdint.h>

int main() {
    FILE *f = fopen("golden_seed_32.bin", "rb");
    if (!f) return 1;
    
    uint8_t seed[32];
    if (fread(seed, 1, 32, f) != 32) {
        fclose(f);
        return 1;
    }
    fclose(f);
    
    // XOR with block hash for tie-breaking
    uint8_t block_hash[32] = { /* your block hash */ };
    uint8_t result[32];
    for (int i = 0; i < 32; i++) {
        result[i] = block_hash[i] ^ seed[i];
    }
    return 0;
}

Rust

use std::fs;

fn main() {
    let seed = fs::read("golden_seed_32.bin").unwrap();
    let block_hash = vec![0u8; 32];  // Your block hash here
    let result: Vec<u8> = block_hash.iter()
        .zip(seed.iter())
        .map(|(a, b)| a ^ b)
        .collect();
}

Go

package main

import "os"

func main() {
    seed, _ := os.ReadFile("golden_seed_32.bin")
    blockHash := make([]byte, 32)  // Your block hash here
    result := make([]byte, 32)
    for i := range seed {
        result[i] = blockHash[i] ^ seed[i]
    }
}

JavaScript/Node.js

const fs = require('fs');
const seed = fs.readFileSync('golden_seed_32.bin');
const blockHash = Buffer.alloc(32);  // Your block hash here
const result = Buffer.from(blockHash.map((b, i) => b ^ seed[i]));

Java

import java.nio.file.Files;
import java.nio.file.Paths;

byte[] seed = Files.readAllBytes(Paths.get("golden_seed_32.bin"));
byte[] blockHash = new byte[32];  // Your block hash here
byte[] result = new byte[32];
for (int i = 0; i < 32; i++) {
    result[i] = (byte)(blockHash[i] ^ seed[i]);
}

Files

  • golden_seed.hex - Hex representation (this file format)
  • golden_seed_16.bin - 16-byte binary seed
  • golden_seed_32.bin - 32-byte binary seed

Security

See SECURITY.md for security policy and vulnerability reporting.

License

This seed is part of the COINjecture protocol and follows the same license as the main codebase.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

golden_quantum-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

golden_quantum-1.0.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file golden_quantum-1.0.0.tar.gz.

File metadata

  • Download URL: golden_quantum-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for golden_quantum-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c10b0286ca4f8784493f0758084bc5b965870e0bd663c5fbca22b94588703821
MD5 28c3a14287cdacffcdb760813900e7bb
BLAKE2b-256 c7a9c5b2f330286f4f34a8ea1748917663d509d89c6da3cd6d774fa93f5266b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for golden_quantum-1.0.0.tar.gz:

Publisher: python-publish.yml on beanapologist/seed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file golden_quantum-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: golden_quantum-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for golden_quantum-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8866fb4f1e13fa160127822cdc4aac4ca9a6edbe642c9629870ac0e2219c60ba
MD5 835cf8eaf43c21141bda601e63022984
BLAKE2b-256 e77561c0975756281a6e9ffe36129f6f8d23045428beb28a77423b1424f4b19e

See more details on using hashes here.

Provenance

The following attestation bundles were made for golden_quantum-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on beanapologist/seed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page