Instantly share code, notes, and snippets.

Embed
What would you like to do?
tezos-baking-howto.md

Tezos baking howto

This howto is valid for Betanet on Ubuntu or Debian

Setup

Prereq

You have to install some dependencies. In debian / ubuntu run:

sudo apt-get install build-essential git m4 unzip rsync curl libev-dev libgmp-dev pkg-config libhidapi-dev

If you are using ubuntu, install bubblewrap using this deb file:

wget http://security.ubuntu.com/ubuntu/pool/universe/b/bubblewrap/bubblewrap_0.2.1-1_amd64.deb
sudo dpkg -i ./bubblewrap_0.2.1-1_amd64.deb

If you are using debian, install bubblewrap using the apt-get:

sudo apt-get install bubblewrap

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 mainnet

Install Opam (version 2.0 is required):

wget https://github.com/ocaml/opam/releases/download/2.0.0-rc4/opam-2.0.0-rc4-x86_64-linux
sudo mv opam-2.0.0-rc4-x86_64-linux /usr/local/bin/opam
sudo chmod a+x /usr/local/bin/opam
opam init --comp=4.06.1 --disable-sandboxing
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://api.tzscan.io/v2/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 127.0.0.1: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

Start the baker

Use screen to start the baker and run it in background; it will ask you for the encryption key.

cd tezos
./tezos-baker-002-PsYLVpVv run with local node "/home/tezos/.tezos-node" "my_account"
cd tezos
./tezos-endorser-002-PsYLVpVv run "my_account"
cd tezos
./tezos-accuser-002-PsYLVpVv run

Voting

If you don't want to bake, you can vote another 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"

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

@grshabl

This comment has been minimized.

Copy link

grshabl commented Jul 13, 2018

Hi, thank you for your guide, could you tell me, where I can find baking key to send to my friends , because I wanna be their baker ?

@Jovi1945

This comment has been minimized.

Copy link

Jovi1945 commented Jul 15, 2018

./tezos-client list known addresses

@sandhyarg1

This comment has been minimized.

Copy link

sandhyarg1 commented Jul 15, 2018

Thanks for this post. I started by baker using "nohup ./tezos-alpha-baker ......" command. It seems to be working fine, but is not asking the password for my baking account which is weird as it needs it for baking. Am i missing something or did I setup something wrong?

When will the ./tezos-alpha-baker command ask the password for baking account?

@adamiak

This comment has been minimized.

Copy link

adamiak commented Jul 17, 2018

On Linux Mint (18.3 & 19) the make build-deps command fails on two packages: conf-gmp and conf-hidapi. To resolve it, run:

$ apt install libgmp-dev libusb-dev libhidapi-dev

@eduardoalthaus

This comment has been minimized.

Copy link

eduardoalthaus commented Jul 18, 2018

How to make a multi signature address?

@ValiantThor

This comment has been minimized.

Copy link

ValiantThor commented Jul 21, 2018

I keep seeing No Such File or Directory error when running these:

cd tezos
nohup ./tezos-baker-001-PtCJ7pwo run with local node "/home/tezos/.tezos-node" "my_account" &
nohup ./tezos-baker-002-PsYLVpVv run with local node "/home/tezos/.tezos-node" "my_account" &
nohup ./tezos-endorser-001-PtCJ7pwo run "my_account" &
nohup ./tezos-endorser-002-PsYLVpVv run "my_account" &
nohup ./tezos-accuser-001-PtCJ7pwo run &
nohup ./tezos-accuser-002-PsYLVpVv run &

here is one of the errors:
nohup: ignoring input and appending output to 'nohup.out'
nohup: failed to run command './tezos-baker-001-PtCJ7pwo': No such file or directory

Also the get_peers.sh file doesn't seem to get saved after the curl command is ran and so the bash command also gets a no file or directory error. Please help!

@rxx

This comment has been minimized.

Copy link

rxx commented Jul 22, 2018

Had an issue with hidapi install. You need to install hidapi and hidapi-dev in your system also.

@tingham

This comment has been minimized.

Copy link

tingham commented Jul 23, 2018

Had to:

apt-get install bubblewrap 

On Ubuntu 16.04 prior to opam init

@dsousadev

This comment has been minimized.

Copy link

dsousadev commented Jul 24, 2018

I think I set up everything correctly. My node is running and showing output from prevalidator and validator. Is there a way I can be sure everything is running correctly and I am baking?

@nathansenn

This comment has been minimized.

Copy link

nathansenn commented Jul 27, 2018

I keep seeing No Such File or Directory error

this fixed my issue
use "$HOME/.tezos-node"

screen -dmS tezosbaker ./tezos-baker-002-PsYLVpVv run with local node "$HOME/.tezos-node"

@eduardoalthaus

This comment has been minimized.

Copy link

eduardoalthaus commented Jul 29, 2018

Tested on Ubuntu 16.04 x64 and Ubuntu 18.04 x64
/tezos$ make build-deps
Makefile:12: *** Unexpected opam version (found: 2.0.0, expected: 2.0.0~rc3). Stop.

@yellowred

This comment has been minimized.

Copy link

yellowred commented Jul 30, 2018

Eduardo, uninstall opam and install again with sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/2.0/shell/install.sh). It takes branch 2.0 where install.sh binded to 2.0.0rc3 instead of 2.0.0rc4 in master. Guess the command in docs is too weakly defined.

@woodyjon

This comment has been minimized.

Copy link

woodyjon commented Jul 31, 2018

Hello @yellowred , I have the same problem as Eduardo. Thank you for your response. But how do you uninstall opam? Thanks!

@tzbakery

This comment has been minimized.

Copy link

tzbakery commented Jul 31, 2018

I am stuck at
Start the node
cd tezos
nohup ./tezos-node run --rpc-addr :8732 --connections 10 bash ../get_peers.sh &

It keeps giving me "nohup: ignoring input and appending output to 'nohup.out'" and just freezes on that

Anyone have any ideas?

@eduardoalthaus

This comment has been minimized.

Copy link

eduardoalthaus commented Aug 1, 2018

Thanks @yellowred it worked.

@woodyjon

This comment has been minimized.

Copy link

woodyjon commented Aug 1, 2018

@eduardoalthaus how did you uninstall opam? Thanks.

@dakk

This comment has been minimized.

Copy link
Owner

dakk commented Aug 1, 2018

@tzbakery , the nohup command run the tezos-node in background, so you can keep the node running even if you logout; use tail -f nohup.log to see the log of the node

@eduardoalthaus

This comment has been minimized.

Copy link

eduardoalthaus commented Aug 1, 2018

@woodyjon
rm -rf $(opam config var root)
rm -f $(which opam) $(which opam-admin)

Font

@jupiter50

This comment has been minimized.

Copy link

jupiter50 commented Aug 1, 2018

If I want a model where I had a private baker that only connected to a separate outer public node, what are the steps to create this public node and then steps to restrict the private baker to it?

@dakk

This comment has been minimized.

Copy link
Owner

dakk commented Aug 2, 2018

@jupiter50 in the private baker you have to:

  • limit outgoing connections on tezos port only to your public node
  • set as static node only the public one with --peer
@angrycardo

This comment has been minimized.

Copy link

angrycardo commented Aug 3, 2018

Instaling opam with

sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/2.0/shell/install.sh)

still throws the following error when make build-deps:

Makefile:11: *** Unexpected opam version (found: 2.0.0~rc3, expected: 2.0.0). Stop.

If you check the file https://raw.githubusercontent.com/ocaml/opam/2.0/shell/install.sh you can see that at line 8 the version is VERSION='2.0.0~rc3'

So, any idea about installing the 2.0.0 one?

@postables

This comment has been minimized.

Copy link

postables commented Aug 5, 2018

If you're having troubles installing a node, try my script
https://github.com/RTradeLtd/TezosDelegationService/blob/develop/Scripts/tezos_install.sh

@woodyjon

This comment has been minimized.

Copy link

woodyjon commented Aug 14, 2018

I again had the same problem as @angrycardo, where the opam version was not accepted by tezos make command. This method for installing opam worked for me and allowed me to build tezos successfully:

$ wget https://github.com/ocaml/opam/releases/download/2.0.0-rc4/opam-2.0.0-rc4-x86_64-linux
$ sudo mv opam-2.0.0-rc4-x86_64-linux /usr/local/bin/opam
$ sudo chmod a+x /usr/local/bin/opam

From this guide: https://github.com/tezoscommunity/FAQ/blob/master/Compile_Betanet.md

@Sm00g15

This comment has been minimized.

Copy link

Sm00g15 commented Nov 11, 2018

how do we know when our chain is fully in sync with the current HEAD?

@DreamXzxy

This comment has been minimized.

Copy link

DreamXzxy commented Nov 22, 2018

how do we know when our chain is fully in sync with the current HEAD?

git rev-parse HEAD

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