Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

vouch/v0 package

Overview

Package vouch is a web of trust other realms can gate on: one address vouches for another, in writing, optionally with GNOT locked behind it.

The one call that matters is a plain read:

Example
1import "gno.land/r/moul/x/social/vouch/v0"
2
3func Claim(cur realm) {
4	if !vouch.IsTrusted(cur.Previous().Address(), 2) {
5		panic("get two people to vouch for you first")
6	}
7	…
8}

IsTrusted takes no cur realm on purpose. A read with no realm token is borrowed: gno opens no realm frame for it, so it costs the caller nothing beyond the read and cannot be tricked into acting as anybody. Nothing here branches on who is asking, and no read in this realm ever will: the answer to "is this address trusted" must not depend on who wants to know.

What it does, and what it refuses to do

Vouch is payable. Any coins sent with it are locked as a bond on that vouch, which is the voucher putting their own money where their claim is. A bond is optional and zero is the ordinary case. Revoke takes the vouch back and credits the bond to the voucher, who collects it with Withdraw.

There is no slashing in v0 and that is the interesting half. Slashing needs an arbiter, somebody who decides a vouch was a lie, and every candidate is a design question rather than a feature: a DAO vote is a popularity contest, a challenge market pays whoever is loudest, an oracle is one key that can confiscate anybody's money. The bond is still worth having without it, because an illiquid deposit is a cost a hundred throwaway addresses cannot all pay at once.

No token

This realm issues none, deliberately. A transferable vouch is a bought reputation, and the moment a vouch can be sold the score stops measuring what it says it measures. The bond is GNOT: value at risk, without being a market in trust itself. The README says what would change the answer.

Function

Revoke

func Revoke(cur realm, target address) int64

Revoke withdraws the caller's vouch for target and credits any bond back to them. The coins do not move here: call Withdraw to collect them.

Splitting it in two is the pull-payment pattern. A realm that sent on revoke would be handing control to the recipient in the middle of its own state change, and a recipient that refuses the coins could make revoking impossible.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/social/vouch/v0" -func "Revoke" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/social/vouch/v0" -func "Revoke" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx