PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/moul/agents/commit/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
moul / agents / commit
Files
4 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/moul/agents/commit/v0
gno
0.9

Files (4)

  • README.mdmarkdown
  • gnomod.tomltoml
  • commit.gnogno
  • commit_test.gnogno
README.mdPreviewRaw
# p/moul/agents/commit/v0 — shared commitment helpers

A tiny pure package: the one place the agent demos agree on *how* a
commitment is computed. On-chain realms should store commitments (hashes) to
off-chain material — reports, patches, verdicts — not the material itself.
When several realms do that, they need to compute hashes the same way, or
they can't verify each other's commitments.

```go
commit.Hash(parts...)          // hex SHA-256, length-prefixed (no boundary collisions)
commit.Verdict(vote, salt)     // canonical commit-reveal commitment for a hidden bool
commit.Short(hexHash)          // abbreviate for display
```

`Hash` length-prefixes each part, so `Hash("ab","c") != Hash("a","bc")` — a
small detail that matters the moment a commitment concatenates
attacker-influenced fields.

`Verdict` is the scheme the [jury](../../../r/moul/agents/jury/v0/) demo uses for
blind voting: commit `Verdict(vote, salt)` during the commit phase, then
reveal `(vote, salt)` — anyone can recompute and confirm the vote wasn't
changed after the fact.

Pure, deterministic, no realm state. Import it; don't reinvent the hashing.

```sh
gno test .
```

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

> ⚠️ **Disclaimer:** provided as-is, without warranty; not security-audited. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.