Coder Social home page Coder Social logo

merkle-earnings-cli's Introduction

Merkle Earnings CLI

 _     _                                 ___  ___          _    _        _____                 _
| |   (_)                                |  \/  |         | |  | |      |  ___|               (_)
| |    ___   _____ _ __   ___  ___ _ __  | .  . | ___ _ __| | _| | ___  | |__  __ _ _ __ _ __  _ _ __   __ _ ___
| |   | \ \ / / _ \ '_ \ / _ \/ _ \ '__| | |\/| |/ _ \ '__| |/ / |/ _ \ |  __|/ _` | '__| '_ \| | '_ \ / _` / __|
| |___| |\ V /  __/ |_) |  __/  __/ |    | |  | |  __/ |  |   <| |  __/ | |__| (_| | |  | | | | | | | | (_| \__ \
\_____/_| \_/ \___| .__/ \___|\___|_|    \_|  |_/\___|_|  |_|\_\_|\___| \____/\__,_|_|  |_| |_|_|_| |_|\__, |___/
                  | |                                                                                   __/ |
                  |_|                                                                                  |___/
Usage: mearnings [options]

Livepeer Earnings Merkle Tree Tool

Options:
  -V, --version                         output the version number
  -g, --generate                        Generate a new Earnings Merkle Tree at the snapshot round
  -e, --earnings <address>              Get earnings for an address up until the snapshot round
  -ve --verify <address>                Verify the merkle tree for an address
  -h, --help

Install

$ npm install

Build

$ npm run build && npm i -g

If you run into permissioning errors using sudo npm i -g can provide a shortcut without having to alter npm permissioning.

Run

You will need to set the following environment variables in the .env file in this directory:

  • L1_RPC_URL: The URL for a L1 Ethereum Mainnet JSON-RPC provider.
  • L2_RPC_URL: THe URL for a L2 Arbitrum One Mainnet JSON-RPC provider.
$ mearnings [options]

To list usage options:

$ mearnings --help

Usage

There will be a prompt for a LIP number for the following commands. You can enter LIP-73.

Generate the snapshot Merkle Tree

mearnings -g

Generates a new earnings Merkle Tree at the L1 snapshot round. The root of this snapshot Merkle Tree will be printed.

Fetch the earnings (pending stake and pending fees) of an address

mearnings -e <address>

  • <address> is an ETH address that you want to fetch earnings for

Fetches the pendingStake (the stake of the address plus any rewards) and pendingFees (the fees of the address that have not been withdrawn) for an address at the L1 snapshot round.

Verify that an address is included in the snapshot Merkle Tree

mearnings -ve <address>

  • <address> is an ETH address that you want to verify is included in the snapshot Merkle tree

Verifies that an address and its earnings are included in the snapshot Merkle tree. This command will use the leaves of the snapshot Merkle Tree ( in earningsTree.JSON) to re-generate the snapshot Merkle Tree, check that the root matches the one included on-chain in the L2 MerkleSnapshot contract and that a proof of inclusion in the Merkle Tree can be computed for the address.

merkle-earnings-cli's People

Contributors

kautukkundan avatar kyriediculous avatar yondonfu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.