Pure package detail
commitreveal
gno.land/p/g16m0r7rm7fv5hx0ekr7gvx8g4fr7eu08nzhk6gt/commitreveal
Indexed deployment identity with independently loaded latest RPC source. Functions and Render are realm-only RPC capabilities.
Indexed deployment
Identity
- Package path
- gno.land/p/g16m0r7rm7fv5hx0ekr7gvx8g4fr7eu08nzhk6gt/commitreveal
- Block
- 108519
- Deployed (UTC)
- Transaction
- eLYqwx4KUPIZF1219lDXmEUoT9iNjVsdKtpLcI01lZM=
Latest RPC state
Source
package commitreveal
type Entry struct {
Commitment string
Revealed bool
Value string
}
type Registry struct {
entries map[string]*Entry
}
func NewRegistry() *Registry {
return &Registry{entries: make(map[string]*Entry)}
}
func (r *Registry) Commit(id string, commitment string) {
r.entries[id] = &Entry{Commitment: commitment}
}
func (r *Registry) Reveal(id string, value string, hashFn func(string) string) bool {
e, ok := r.entries[id]
if !ok || e.Revealed {
return false
}
if hashFn(value) != e.Commitment {
return false
}
e.Revealed = true
e.Value = value
return true
}
func (r *Registry) Get(id string) (*Entry, bool) {
e, ok := r.entries[id]
return e, ok
}
The verified vm/qfuncs operation accepts realm paths only.
Pure packages expose source files but do not have Realm Render.