The Infrastructure Behind Quantum Genesis: How We Built the First Verifiably Quantum NFT Pipeline
- System Architecture Overview
- The Quantum Layer: Qiskit Runtime + Origin QCloud
- Seed Derivation: From Measurement Distribution to SHA-256
- Deterministic RNG: Cryptographic-Grade Visual Generation
- SVG Generation: Algorithmic Aesthetics at Scale
- IPFS + Pinata: Immutable Metadata with Redundancy
- Smart Contract: Gas-Optimized ERC-721 with EIP-2981
- Verification Layer: Open-Source Reproducibility
System Architecture Overview

Quantum Genesis NFT #19 — primeira peça IBM Quantum ibm_fez

Quantum Genesis NFT #42 — IBM Quantum ibm_fez

Quantum Genesis NFT #55 — mintado via web3.py no Polygon
Quantum Genesis isn't just an NFT drop — it's a distributed quantum-classical pipeline spanning three compute paradigms:
┌─────────────────┐ ┌──────────────────┐ ┌────────────────────┐
│ QUANTUM LAYER │────▶│ CLASSICAL LAYER │────▶│ BLOCKCHAIN LAYER │
│ │ │ │ │ │
│ IBM Quantum │ │ SHA-256 Seed │ │ Polygon Mainnet │
│ Origin Quantum │ │ Deterministic │ │ ERC-721 + EIP-2981 │
│ 4,096–8,000 │ │ RNG (xorshift) │ │ 5% Royalties │
│ shots/NFT │ │ SVG Generation │ │ Metadata Frozen │
└─────────────────┘ │ PNG + IPFS │ └────────────────────┘
└──────────────────┘
Every layer is auditable. Every transition is deterministic. The only non-deterministic event — the quantum measurement — happens once, is recorded, and then the entire pipeline becomes reproducible from that single seed.
The Quantum Layer: Qiskit Runtime + Origin QCloud
IBM Quantum: SamplerV2 on ibm_fez / ibm_torino
We used Qiskit Runtime's SamplerV2 primitive — the production-grade interface for near-term quantum algorithms. Key decisions:
- Transpilation:
generate_preset_pass_manager(optimization_level=1)— balances circuit depth vs. fidelity for 12-qubit GHZ-style circuits on 156/133-qubit heavy-hex topologies - Error mitigation: Twirled readout error mitigation (TREM) enabled by default in SamplerV2
- Shots: 4,096 per NFT — statistically significant for entropy extraction while keeping queue time reasonable (~19s/NFT on ibm_fez)
- Batch submission: 20 circuits per job to amortize queue overhead
Circuit specification: 12 qubits, H on all (superposition), CNOT ladder (entanglement), measure all. This creates a maximally entangled state where measurement outcomes are fundamentally unpredictable.
Origin Quantum: pyqpanda3 on WK_C180
Access via QCloudService API. Different SDK, different topology:
- Measurement syntax:
measure([0,1,2...], [0,1,2...])— explicit qubit→classical bit mapping - Shots: 8,000 per NFT — higher for entropy margin on less-characterized hardware
- Latency: ~45s/NFT including API overhead
First 18 NFTs (1–18) on Origin. Remaining 82 (19–100) on IBM. Both produce cryptographically equivalent seeds.
Seed Derivation: From Measurement Distribution to SHA-256
Raw quantum output: a probability distribution over 2¹² = 4,096 possible bitstrings, each with a count from N shots.
We don't just hash a single shot. We hash the entire distribution:
def derive_quantum_seed(measurement_counts: dict, shots: int) -> str:
"""
measurement_counts: {bitstring: count} from quantum hardware
Returns: 64-char hex string (256-bit seed)
"""
# Serialize deterministically: sorted by bitstring
serialized = ''.join(f'{bs}:{count}' for bs, count in sorted(measurement_counts.items()))
# Domain separation: include shots and processor ID
domain = f'QGENESIS:v1:shots={shots}:{serialized}'
return hashlib.sha256(domain.encode()).hexdigest()
Why the full distribution? A single shot has ~1 bit of entropy. The distribution of 4,096 shots over 4,096 outcomes captures the full quantum state statistics — min-entropy scales with shots. Our seeds have provably higher entropy than any single-shot derivation.
Deterministic RNG: Cryptographic-Grade Visual Generation
The 256-bit seed initializes a custom QuantumRNG based on xorshift128+ seeded by SHA-512:
class QuantumRNG:
def __init__(self, seed_hex: str):
# SHA-512 expands 256-bit seed to 512-bit state
state = hashlib.sha512(bytes.fromhex(seed_hex)).digest()
self.s = [int.from_bytes(state[i:i+8], 'little') for i in (0, 8, 16, 24)]
def next_u64(self) -> int:
s0, s1, s2, s3 = self.s
result = (s0 + s3) & 0xFFFFFFFFFFFFFFFF
t = s1 << 17
self.s[2] = s2 ^ s0 ^ t ^ (t >> 45)
self.s[3] = s3 ^ s1 ^ (s1 >> 27)
self.s[0] = s0 ^ s2 ^ (s0 >> 25)
self.s[1] = s1
return result
def random(self) -> float:
return self.next_u64() / 2**64
Properties:
- Period: 2¹²⁸ − 1 (sufficient for 100 NFTs × ~10⁴ calls each)
- Equidistribution: 64-bit output passes BigCrush test suite
- Deterministic: Same seed → identical visual output, every time
- No external dependencies: Pure Python, auditable
SVG Generation: Algorithmic Aesthetics at Scale
The RNG drives every visual parameter through a curated design system:
| Primitive | Parameters Driven by RNG |
|---|---|
| Circles | Count (3–12), radii, positions, stroke/fill, gradients |
| Rectangles | Count, dimensions, rotation, corner radius, skew |
| Ellipses | Radii, rotation, stroke width, dash patterns |
| Bézier curves | Control points, stroke, fill, symmetry |
| Polygons | Sides (3–12), radius, rotation, star vs convex |
| Gradients | Type (linear/radial), stops, colors, angle |
Color harmony system (algorithmic, not random):
- Complementary — base hue + 180°
- Analogous — base hue ± 30°
- Triadic — base hue, +120°, +240°
- Split-complementary — base hue, ±150°
- Tetradic — two complementary pairs
Perceptual uniformity via OKLCH color space — not HSL/RGB. This ensures visual harmony regardless of RNG output.
IPFS + Pinata: Immutable Metadata with Redundancy
Each NFT gets two IPFS pins:
- Image (PNG) — 2048×2048, lossless, ~200–500KB
- Metadata (JSON) — ERC-721 standard + Quantum Genesis extensions
Pinning strategy (three-fold redundancy):
- Pinata (primary, managed)
- Local IPFS node (self-hosted, always online)
- Filebase (S3-compatible, geographic redundancy)
Metadata schema (abridged):
{
"name": "Quantum Genesis #42",
"description": "Seeded by IBM Quantum ibm_fez measurement...",
"image": "ipfs://bafybei.../42.png",
"external_url": "https://quantumartlab.com/genesis/42",
"attributes": [
{"trait_type": "Quantum Seed", "value": "2cf1b403..."},
{"trait_type": "Processor", "value": "IBM ibm_fez"},
{"trait_type": "Entropy Level", "value": "Maximum"},
{"trait_type": "Entropy Score", "value": 97},
{"trait_type": "Qubit Config", "value": "GHZ-12"},
{"trait_type": "Quantum Phase", "value": "Entangled"},
{"trait_type": "Color Harmony", "value": "Triadic"},
{"trait_type": "Complexity Score", "value": 84},
{"trait_type": "Shots", "value": 4096},
{"trait_type": "Timestamp", "value": "2026-03-19T14:23:12.000Z"}
]
}
Smart Contract: Gas-Optimized ERC-721 with EIP-2981
Custom Solidity contract deployed on Polygon mainnet (0x488fCfaEA5fDf1cF6BAED5e8A34D7858033E1a27):
- Batch minting:
mintBatch(address[] to, uint256[] tokenIds)— 10–20 NFTs/tx - Gas per NFT: ~35,000 (vs ~150,000 on Ethereum mainnet)
- EIP-2981 royalties: 5% to creator, enforced on all marketplaces
- Metadata freezing:
setTokenURIcalled once after full batch upload, then_frozen = true - No admin keys: Owner can only withdraw royalties, not modify contract
Total deployment + 100 mints: ~$8.40 MATIC. Equivalent on Ethereum: $200–400.
Verification Layer: Open-Source Reproducibility
Every claim is verifiable by anyone with the seed:
- Clone:
git clone https://github.com/marceloclaudecode01/quantum-art-lab - Install:
pip install -r requirements.txt - Run:
python generate.py --seed 2cf1b4034f223f5c3e6a83019656e65597828ae375db07b2ef358ac523dde706 - Output: identical SVG → identical PNG → identical IPFS hash
The generator is deterministic, dependency-minimal, and versioned. If the seed produces the art, the provenance is proven. No trust required — only math and physics.
Quantum Genesis — Technical architecture documented, auditable, reproducible.
View Source on GitHub → |
Contract on PolygonScan →
Comentários
Postar um comentário