program lock_generation
// Neptune Generation Address Lock Script
//
// The simplest Neptune lock pattern. The UTXO stores the Tip5
// hash of a single-field secret. To spend, the prover divines
// the secret, hashes it, and asserts the digest matches the
// lock stored in the UTXO.
//
// Public input: kernel MAST hash (5 fields = 1 Digest)
// Secret input: preimage secret (1 field)
//
// The kernel MAST hash binds this proof to a specific transaction.
// Without reading it, the proof could be replayed on any transaction
// that references the same UTXO.
fn main() {
// The lock hash is baked into the program at deployment time.
// In a real deployment this would be a constant derived from the
// owner's secret key. Here we use a placeholder.
//
// Neptune convention: the lock_script_hash in the UTXO commits
// to the *entire program* including this constant value, so each
// owner has a distinct program hash.
let lock_hash: Digest = divine5()
// Prover supplies the secret preimage.
let secret: Field = divine()
// Hash the secret and verify it matches the lock.
let computed: Digest = hash(secret, 0, 0, 0, 0, 0, 0, 0, 0, 0)
assert_digest(computed, lock_hash)
// Read kernel MAST hash โ binds proof to this transaction.
// If we omit this, the proof is replayable.
let _kernel: Digest = pub_read5()
}
trident/os/neptune/locks/generation.tri
ฯ 0.0%