code wiki / (root) / nx_bt_v2_merkle_gate.nx

nx_bt_v2_merkle_gate.nx

buildroot/runtime/nx_bt_v2_merkle_gate.nx

3657 B57 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_bt_v2_merkle_gate.nx -- proves the BitTorrent v2 SHA-256 merkle tree + inclusion proofs: build a root over 4 blocks, prove ONE block belongs to the root with log2(n) siblings (verifiable random access), and show tamper detection + wrong-proof rejection. expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_bt_v2_merkle.nx nx_sha256.nx nx_syscalls.nx nx_bt_v2_merkle_gate.nx

imports: nx_bt_v2_merkle.nxnx_sha256.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main g_puts sys_write sys_mmap mk_leaf sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ lp mk_root sys_mmap ↻ mk_node sys_mmap ↻ sha256_init ↻ sha256_update ↻ sha256_final ↻ g_hex sys_mmap ↻ sys_write ↻ g_ck g_puts ↻ mk_memeq mk_proof sys_mmap ↻ mk_node ↻ mk_verify sys_mmap ↻ mk_node ↻ mk_memeq ↻

structs

none

consts

none

functions

8func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: g_ckmain calls 1: sys_write
9func g_ck(name: *u8, cond: i64, st: *i64) -> i64 { st[1]=st[1]+1; if cond==1 { st[0]=st[0]+1; g_puts(" [OK] " as *u8) } else { g_puts(" [FAIL] " as *u8) } g_puts(name); g_puts("\n" as *u8); return 0 }
called by 1: main calls 1: g_puts
10func g_hex(b: *u8, n: i64) -> i64 { let hx: *u8="0123456789abcdef" as *u8; var i: i64=0; while i<n { let o: *u8=sys_mmap(2); o[0]=hx[((b[i] as i64)>>4)&15]; o[1]=hx[(b[i] as i64)&15]; sys_write(1,o,2); i=i+1 } return 0 }
called by 1: main calls 2: sys_mmapsys_write
11func lp(leaves: *u8, i: i64) -> *u8 { return (leaves as i64 + i*32) as *u8 }
called by 1: main
13func main() -> i64