Balance
Balance returns the ugnot the drop still holds.
Command
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Balance()"
Result
Package merkledrop is a Merkle-gated airdrop that actually moves GNOT.
It is the successor to r/moul/x/daily/merkledrop/v0, which was generated by the daily pipeline and is deployed on mainnet. v0 works, but it is a demonstration rather than a drop, and its proof scheme is safe by accident. Everything below is what changed and why.
v0 hashed leaves bare and combined nodes commutatively, the OpenZeppelin scheme: leaf = sha256(addr|amount), node = sha256(min||max). Without a leaf/inner tag an inner-node hash is also a valid leaf hash, so anyone who can present a 64-byte leaf preimage can prove membership of a leaf that was never committed.
v0 is not exploitable, but only by arithmetic: an inner preimage is exactly 64 bytes, and a v0 leaf preimage is at most 40 (bech32 address) + 1 + 20 (uint64 has at most 20 digits) = 61 bytes. 61 < 64, so no collision is reachable. Change the leaf encoding, widen the amount, use a different address form, and the forgery goes live with no visible diff at the call site. That is not a property to rely on.
v1 uses gno.land/p/moul/x/merkle/v0, which is the Tendermint scheme: leaves are tagged 0x00 and inner nodes 0x01, so the two preimage spaces cannot overlap at any length.
v0's proof was a bare sibling list of any length, folded until it ran out. v1's proof carries its index and the total leaf count, and the verifier rebuilds the tree shape from them: a proof cannot be replayed at another index, and one of the wrong length is rejected rather than folded. The sibling count is capped at merkle.MaxDepth, so an untrusted caller cannot choose the length of the loop.
v0's root is a `const`, so the drop can never be re-rooted, extended or ended. v1's owner sets the root, the leaf count and an optional closing height, and can sweep the remainder once it closes.
v0 keeps a uint64 ledger and moves nothing; its README says so, but it sits on mainnet reading like an airdrop. v1 sends ugnot from the realm's own address through the banker, and refuses a claim it cannot pay rather than marking it claimed.
The claimer is PreviousRealm().Address(), the immediate caller. Called directly by a user that is the user; called through another realm it is that REALM. This is not a hole, because the leaf binds the address and the proof must match the claimer, so an intermediary can only claim an allocation granted to the intermediary itself. It does mean a wrapper realm cannot claim on a user's behalf, which is deliberate.
Built on gno.land/p/moul/x/merkle/v0.
Balance returns the ugnot the drop still holds.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Balance()"
Claim proves the caller is allocated amount at index and pays it out.
proof is the comma-separated hex sibling list from the tree generator, leaf first. It panics on a closed drop, a double claim, a bad proof, or a drop that cannot cover the amount; nothing is marked claimed in any of those cases.
# 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/daily/merkledrop/v1" -func "Claim" -args $'' -args $'' -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/daily/merkledrop/v1" -func "Claim" -args $'' -args $'' -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
Claims returns the number of allocations claimed.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Claims()"
ClosesAt returns the last height a claim is accepted, or 0 for never.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.ClosesAt()"
DemoProof returns the proof for one seeded allocation, so the drop can be exercised end to end without an off-chain generator. It is empty once a real drop replaces the seeded one.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.DemoProof()"
HasClaimed reports whether the allocation at index was claimed.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.HasClaimed()"
IsClosed reports whether the drop is past its closing height.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.IsClosed()"
Leaf returns the exact preimage committed for one allocation. Reproduce it off chain to rebuild the tree; it is the whole interface between the drop and its generator.
1leaf = "<pkgpath>|<index>|<address>|<amount>"
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Leaf(,,)"
Paid returns the ugnot claimed so far.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Paid()"
Render serves the drop overview at "" and one allocation at "proof/<index>".
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Render()"
Root returns the committed root, hex-encoded, or "" when no drop is set.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Root()"
SetDrop commits a new allocation root. Owner only.
totalLeaves is the number of allocations the root commits to; the verifier needs it to rebuild the tree shape, so a wrong value invalidates every proof rather than weakening any. closesAtHeight is the last height at which a claim is accepted, or 0 for a drop that never closes.
Setting a new root abandons the previous claim ledger: a drop is a commitment, and replacing it starts a new one.
# 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/daily/merkledrop/v1" -func "SetDrop" -args $'' -args $'' -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/daily/merkledrop/v1" -func "SetDrop" -args $'' -args $'' -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
Sweep returns whatever is left to the owner, once the drop has closed. Owner only. A drop with no closing height can never be swept, which is the point of setting one.
# 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/daily/merkledrop/v1" -func "Sweep" -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/daily/merkledrop/v1" -func "Sweep" -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
Total returns the number of allocations the root commits to.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Total()"
Verify checks an allocation against the committed root without claiming it, so a recipient can confirm a proof before spending gas on Claim.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/merkledrop/v1.Verify(,,,)"