Skip to content

Merkle Claims

Gabriel Montes edited this page Mar 11, 2021 · 1 revision

The Merkle Claims app is built on top of the sol-mass-payouts contract.

Motivation

This app was created to help the recipients of claim groups to claim their tokens with easy. So instead of requiring the recipient to know all the claim group ID, the paid balance and the Merkle proof, only the ID is required.

How to create a claim group that works with the app

In order to fill-in the missing information, the app expects the claim group to be created with a special-formatted memo field having the URL where all the [account, balance, proof] records are stored in JSON format.

The dataset format is as follows:

[
  {
    "account": "0x1234000000000000000000000000000000000000",
    "amount": "2200000000000000",
    "proof": ["0x0000000000000000000000000000000000000000000000000000000000000000"]
  },
  {
    "account": "0x5678000000000000000000000000000000000000",
    "amount": "35000000000000000",
    "proof": ["0x0000000000000000000000000000000000000000000000000000000000000000"]
  }
]

That JSON shall be hosted at an URL accessible to the recipient's browser and the claim group shall be created with a memo field containing that URL:

"datasetUri=http://example.com/dataset.json"

Helper scripts

This repository contains two scripts in the packages/merkle-box-lib folder that helps in the process of creating the dataset and the claim group that the simplified-workflow Merkle Claims app supports.

create-dataset.js

This scripts reads a JSON file containing all the accounts and the amount to be paid to and generates the dataset having the proper Merkle proofs.

scripts/create-dataset.js ./recipients.json > dataset.json

Once the dataset.json file is generated, it has to be hosted in a public URL.

create-claim-group.js

This script requires the token symbol (or address), the dataset URL and the withdraw unlock time (Unix timestamp or date ISO string). Then it reads the dataset from the URL provided and creates the claim group.

NODE_URL=http://eth.node.url MNEMONIC="twelve words..." scripts/create-claim-group.js USDC http://example.com/dataset.json 2021-12-31T23:59

Once the claim group is created, the details will be shown in the terminal.