Skip to content

Instantly share code, notes, and snippets.

@dakk
Last active March 6, 2022 21:22
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save dakk/bdf6efe42ae920acc660b20080a506dd to your computer and use it in GitHub Desktop.
Save dakk/bdf6efe42ae920acc660b20080a506dd to your computer and use it in GitHub Desktop.
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 latest-release

Install Opam (version 2.0 is required):

wget https://github.com/ocaml/opam/releases/download/2.0.0-rc4/opam-2.0.1-rc4-x86_64-linux
sudo mv opam-2.0.1-rc4-x86_64-linux /usr/local/bin/opam
sudo chmod a+x /usr/local/bin/opam
opam init --comp=4.09.1 --disable-sandboxing
opam switch 4.09.1
opam update
eval $(opam env)

Update Opam (if you have already installed opam):

opam update
opam switch 4.09.1 # Run this only if you are not already using 4.09.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

Fast sync from a snapshot

First download the latest snapshot for tezos 0.3 from here, and uncompress it: https://www.tzdutch.com/quicksync/

Then run the following command:

./tezos-node snapshot import ../mainnet-*

And run the node normally.

Start the node

cd tezos
nohup ./tezos-node run --rpc-addr 127.0.0.1:8732 --connections 10 

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-003-PsddFKi3 run with local node "/home/tezos/.tezos-node" "my_account"
cd tezos
./tezos-endorser-003-PsddFKi3 run "my_account"
cd tezos
./tezos-accuser-003-PsddFKi3 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 TEZ to tz1THsLcunLo8CmDm9f2y1xHuXttXZCpyFnq or ETH to 0x18f081247ad32af38404d071eb8c246cc4f33534 or BTC to 13TRVwiqLMveg9aPAmZgcAix5ogKVgpe4T

@hclivess
Copy link

@valia

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!

You need to change "tezos" in your path to what your path username is

@dakk
Copy link
Author

dakk commented Mar 30, 2019

@valia there's another error; the protocol has no version 3, so binary files have different names; I updated the tutorial

@dakk
Copy link
Author

dakk commented Mar 30, 2019

@asbjornenge you can now :) tz1THsLcunLo8CmDm9f2y1xHuXttXZCpyFnq
@kiahmed it depends on your stake; a rough estimation is that you need 10% of your stake balance as bond.

@blockchain-app12
Copy link

$./tezos-baker-005-PsBabyM1 run with local node "/home/tezos/.tezos-node" "my_account"
The above command working fine.
But we need baker rum with remote tezos node.
For Example :
$./tezos-baker-005-PsBabyM1 --addr x.x.x.x --port 8732 run with local node "/home/tezos/.tezos-node" "my_account"
This command not working.
How to run tezos baker with remote node server.

@dakk
Copy link
Author

dakk commented Jun 15, 2020

no clue, maybe your node ports are closed

@JakubS83
Copy link

JakubS83 commented Mar 15, 2021

Hi, for solo baking I need deposit. Do you know the rules for losing deposit? Do I need static public IP address?

@dakk
Copy link
Author

dakk commented Mar 16, 2021

@jaku

Hi, for solo baking I need deposit. Do you know the rules for losing deposit? Do I need static public IP address?

No, you don't need static IP address.
Slashing (losing deposit) occurs only if you act badly; you won't slash if your node goes down (you only loose the reward), or other server problems.

@JakubS83
Copy link

@jaku

Hi, for solo baking I need deposit. Do you know the rules for losing deposit? Do I need static public IP address?

No, you don't need static IP address.
Slashing (losing deposit) occurs only if you act badly; you won't slash if your node goes down (you only loose the reward), or other server problems.

OK, thank you. Do you have any link for more information, tech spec etc.?

@dakk
Copy link
Author

dakk commented Mar 17, 2021

Sure @jaku

@jaku

Hi, for solo baking I need deposit. Do you know the rules for losing deposit? Do I need static public IP address?

No, you don't need static IP address.
Slashing (losing deposit) occurs only if you act badly; you won't slash if your node goes down (you only loose the reward), or other server problems.

OK, thank you. Do you have any link for more information, tech spec etc.?

Sure, that's an introduction: https://tezos.com/get-started

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