Skip to content

Instantly share code, notes, and snippets.

@hclivess
Forked from dakk/tezos-baking-howto.md
Created July 14, 2018 09:21
Show Gist options
  • Save hclivess/863d7df02c02671739f248d3e1488543 to your computer and use it in GitHub Desktop.
Save hclivess/863d7df02c02671739f248d3e1488543 to your computer and use it in GitHub Desktop.
tezos-baking-howto.md

Tezos baking howto

This howto is valid both for Betanet.

Setup

Prereq

You need gcc, m4, git, unzip, rsync and curl. In debian / ubuntu run:

apt-get install build-essential git m4 unzip rsync curl

Create an user and switch to it:

adduser tezos
adduser tezos sudo
su - tezos

Install the node from sources

Checkout the code:

git clone https://gitlab.com/tezos/tezos.git
cd tezos
git checkout betanet

Install Opam (version 2.0 is required):

sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
opam init --comp=4.06.1
opam switch 4.06.1
opam update
eval $(opam env)

Update Opam (if you have already installed opam):

opam update
opam switch 4.06.1 # Run this only if you are not already using 4.06.1 ocaml version
eval $(opam env)

Then compile the tezos node:

make build-deps
make

Update the node

git pull
make build-deps
make

If it fails:

opam update
opam pin list -s | xargs opam pin remove
make build-deps
make

Node configuration

First generate a new identity and setup config:

./tezos-node identity generate

get_peers.sh

curl -s 'http://zeronet-api.tzscan.io/v1/network?state=running&p=0&number=50' | grep -Po '::ffff:([0-9.:]+)' | sed ':a;N;$!ba;s/\n/ /g' | sed 's/::ffff:/--peer=/g'

Start the node

cd tezos
nohup ./tezos-node run --rpc-addr :8732 --connections 10 `bash ../get_peers.sh` &

Funding

Redeem a faucet (only for testnet)

Get a faucet from https://faucet.tzalpha.net/ (it works both for zeronet and alphanet)

Then reedem the faucet:

./tezos-client activate account "my_account" with "./faucet.json"
./tezos-client get balance for "my_account"

You need to have enough tez in the delegate in order to bake. So if the balance is less than 10k, redeem another faucet.

Redeem your contribution (only betanet/mainnet)

First, activate your account using the kyc code:

./tezos-client add address fundraiser <tz1...>
./tezos-client activate fundraiser account fundraiser with <activation_key>

You can check if the account has been activated by getting its balance:

./tezos-client get balance for fundraiser

Then in order to access your funds importing your private key type the following command and write your private data when asked:

./tezos-client import fundraiser secret key "my_account"

Please be careful, you are importing your tezos private keys!

Baking

Register a delegate

Register a new delegate:

./tezos-client register key "my_account" as delegate

Voting a delegate

To vote a delegate, you should first "originate an account"; consider the implicit account called my_account2 with 6900XTZ, delegating to my_account:

./tezos-client originate account "my_originated" for "my_account2" transferring 6900 from "my_account2" --delegate "my_account" --delegatable

If you already have an originated account, you can delegate running:

./tezos-client set delegate for "my_originated" to "my_account"

Start the baker

cd tezos
nohup ./tezos-alpha-baker run with local node "/home/tezos/.tezos-node" "my_account" &
nohup ./tezos-alpha-endorser run "my_account" &
nohup ./tezos-alpha-accuser run &

Backup your keys

You private keys are located in:

  • /home/tezos/.tezos-node/identity.json
  • /home/tezos/.tezos-client/secret_keys.json

References

Donate

Feel free to donate ETH to 0x18f081247ad32af38404d071eb8c246cc4f33534 or BTC to 13TRVwiqLMveg9aPAmZgcAix5ogKVgpe4T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment