Giter VIP home page Giter VIP logo

backerei's Introduction

Bäckerei

Bäckerei is tooling that we wrote for the Cryptium Tezos Bäckerei. At a high level it manages the payments from us, the baker, to our delegators. Bäckerei is initialised with a TZ1 address which is used for baking. When run, it connects to a full-node and scans the entire transaction history to determine who the delegators are and how much they should get paid. Note that this full-node must be trusted.

You can check out all the configuration options in $HOME/.backerei.yaml. You can set your fee, the RPC URL of your full node, etc.

When run, Bäckerei reads and updates a simple JSON database file. You can see ours here. All your delegators can use that file to check whether they have been paid correctly, and on top of it you can build front-ends on it like this one.

Bäckerei also allows you to specify a different payout address. This means that you can pay from a KT1 account on a separate server instead of having to pay directly from your Nano Ledger S.

Note that Bäckerei calculates idealized payouts, not realized payouts. On-chain and off-chain delegators will be paid according to what your baker would have made if you had successfully baked and endorsed all scheduled blocks and endorsement slots (plus realized fees). This is roughly equivalent to insuring liveness.

Usage

Initialization

Initialize Bäckerei with the tz1 address of your baker, for example that of Cryptium Labs, the address you want to send payouts from, the alias associated with that address, the path to your database file, and the first cycle in which you baked or endorsed blocks:

backerei init \
  --tz1 tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8 \
  --from tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8 \
  --from-name payout \
  --client-config-file $HOME/.tezos-client/config \
  --starting-cycle 11

More options can be passed if desired. Run backerei init --help for a full list. You can also edit the config file directly.

Executing payouts

Bäckerei is stateful and will calculate outstanding payouts automatically. Simply run:

backerei payout

By default, that command will execute a dry run and only display what payouts need to be sent.

In order to actually send transactions, run:

backerei payout --no-dry-run

In order to run continuously (so that payouts will be sent as soon as new cycle starts):

backerei payout --no-dry-run --continuous

Bäckerei is fairly well tested, but be careful! Ensure you trust the Tezos node to which you are connecting. In any case, you would be well-advised to pay from an isolated account with the minimal requisite balance.

Verifying payouts

You can find historical payout logs for Cryptium Labs here and cross-check against a payout database generated locally.

Development

Stack required for the build process. Once Bäckerei is installed, you can uninstall Stack.

Building

make build

Testing

make test

Linting

Not required unless you want to modify the code and contribute upstream.

First, install Hlint:

stack install hlint

Then run:

make lint

Debugging

To run an interactive REPL with Bäckerei scoped:

make repl

Cleaning up

To remove all build files:

make clean

Installing

~/.local/bin will need to be on your $PATH.

make install

Licensing

GPLv3. See LICENSE for full terms.

backerei's People

Contributors

clacke avatar cwgoes 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.