This repository contains libraries and generators for testing Nockchain functionality within an Urbit ship. Nockchain is a blockchain implementation built on Urbit's Nock virtual machine.
-
Boot a new fakeship:
./urbit -F zod # or any other fake ship name -
Mount the %base desk:
|mount %base -
Copy the nockchain folders to your ship:
cp -r gen/nockchain /path/to/your-ship/base/gen/ cp -r lib/nockchain /path/to/your-ship/base/lib/
-
Commit the changes:
|commit %base
All Nockchain-related libraries are organized in the lib/nockchain/ directory:
lib/nockchain/tx-engine.hoon- Core blockchain transaction engine implementing UTXO model with Schnorr signatureslib/nockchain/zose.hoon- Secp256k1 elliptic curve cryptography library for Bitcoin-style operationslib/nockchain/zeke.hoon- Keccak/SHA-3 hashing functions and related cryptographic utilitieslib/nockchain/zoon.hoon- Additional cryptographic primitives and utility functionslib/nockchain/pow.hoon- Proof of work stub for testinglib/nockchain/schedule.hoon- Emission schedule stub for testinglib/nockchain/wrapper.hoon- Wrapper types and utilities
The lib/nockchain/ztd/ directory contains a comprehensive STARK implementation:
ztd/one.hoon- Basic STARK field operations and constantsztd/two.hoon- Field arithmetic and polynomial operationsztd/three.hoon- FFT/NTT implementations for polynomial evaluationztd/four.hoon- FRI (Fast Reed-Solomon Interactive Oracle Proof) protocolztd/five.hoon- Constraint system and algebraic intermediate representationztd/six.hoon- STARK prover implementationztd/seven.hoon- STARK verifier implementationztd/eight.hoon- High-level STARK protocol orchestration
gen/nockchain/test-raw-tx.hoon- Tests thenew:raw-txfunction with multiple inputs- Creates a transaction with 2 inputs from different UTXOs
- Uses same key for both inputs (150 + 200 coins)
- Applies different fees (10 + 15 coins)
- Outputs clean summary with tx-id and input details
After copying files and committing to %base, you can:
-
Run the test generator:
+nockchain/test-raw-tx -
Build the tx-engine library in dojo to access types directly:
=tx -build-file /=base=/lib/nockchain/tx-engine/hoon -
Access tx-engine types:
*nname:tx *input:tx
When adding new test generators or library functions:
- Follow Hoon naming conventions (kebab-case)
- Include descriptive comments
- Place Nockchain-related files in the appropriate
nockchain/subdirectories - Update this README with new functionality
See the parent repository for license information.