How to Delegate Tezos XTZ with Tezos Client and Running Your Own Node (Betanet)

Awa Sun Yin
Cryptium Labs
Published in
4 min readAug 3, 2018

On a previous delegation guide (How to Deligate Zopf Tezzies (Tezos’ XTZ) with Pâtissière Awa from Cryptium Bäckerei) I wrote a step-by-step guide on installing Tezos from source. However, there were many issues as it relied on brew. Today’s guideline is dedicated to all the users that are comfortable using their Terminal or console. It includes the following sections:

  1. Installing Tezos from source
  2. Running a Tezos node
  3. Generating a Wallet with Tezos-Client
  4. Delegating XTZ to your favourite baker

Because of recent issues with full nodes (Reddit Thread), this article will include running your own node in the background, as opposed to connecting to a public full node, such as ours.

Let’s roll our sleeves up!

Dairy Swiss Cow — Credit: Meadesineurope

Installing Tezos from Source (no brew)

Note: I’m on MacOS, if you’re using another OS, make sure to adapt the following commands.

  1. Installing XCode:
$ xcode-select --install

2. Installing the right version of OPAM:

$ sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)# NOTE: running this will install the newest version of OPAM (2.0.1). For Tezos, you will need version 2.0.0 instead. I could not find another fix for this besides running:# to install the specific version of OPAM$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30eeb89ee7f3b5e0cf8335416168abbe43d0b20d/Formula/opam.rb# you might need to uninstall the other versions$ brew uninstall --force opam

3. Initialising OPAM (takes a while):

$ opam init --compiler=4.06.1$ eval $(opam env)

4. Cloning Tezos and checking out to Betanet branch:

$ git clone -b betanet https://gitlab.com/tezos/tezos.git

5. Entering the tezos folder:

$ cd tezos

6. I did not have libev installed. Before the next step you will need to install it (sorry about brew here, but seems to be the easiest way):

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null$ brew install libev

7. You should still be on the betanet branch inside the tezos project. Installing all the OCaml dependencies (takes a while):

$ make build-deps

8. Compiling binaries:

$ eval $(opam env)$ make

9. Let’s check what binaries we have, in particular check if you have tezos-client:

$ ls→ README.md                 tezos-accuser-002-PsYLVpVv
_build tezos-admin-client
_opam tezos-baker-002-PsYLVpVv
active_protocol_versions tezos-client
docs tezos-endorser-002-PsYLVpVv
dune tezos-node
dune-project tezos-protocol-compiler
dune-workspace tezos-signer

Generating a Node Identity & Running Your Tezos Node

  1. Let’s configure a node with identity generate with difficulty of at least 26:
$ ./tezos-node identity generate 26→ Generating a new identity... (level: 26.00) |...oo|stored the new identity (30charstring30charstring30cha) into '/Users/<username>/.tezos-node/identity.json'.

2. Let’s run your node

$ nohup ./tezos-node run --rpc-addr 127.0.0.1:8732 --connections 10 &→ [1] 56365
appending output to nohup.out

3. The node will start synching and it will take a while, but you can check on the progress by:

$ ./tezos-client bootstrapped→ Current head: BLB9xxSYJf6M (timestamp: 2018-07-16T04:48:12Z, validation: 2018-08-03T12:51:52Z)[...]Current head: BL1pdeP7p1Yd (timestamp: 2018-07-25T09:38:57Z, validation: 2018-08-03T13:10:16Z)
Bootstrapped.
Synching…

4. Your node will be running in the background, even after finishing the synchronisation. If you somehow stop that process, remember to rerun your node before continuing.

Generating a Wallet with Tezos-Client: Create an implicit account and get it funded

When taking a look at the commands available for tezos-client:

$ ./tezos-client man→ [...]Commands for managing the wallet of cryptographic keys:
list signing schemes
List supported signing schemes.
gen keys <new> [-f --force] [-s --sig <ed25519|secp256k1|p256>]
Generate a pair of keys.
<new>: new secret_key alias
-f --force: overwrite existing secret_key
-s --sig <ed25519|secp256k1|p256>: use custom signature algorithm
[...]

So following the docs, in order to create an account:

  1. Generate an implicit account :
$ ./tezos-client gen keys <implicit account name>→ Enter passphrase to encrypt your key:→ Confirm passphrase:

2. Check that your account has been successfully generated:

$ ./tezos-client list known addresses→ my_implicit_account: tz136characterstring36characterstrin (encrypted sk known)

3. Fund your tz1 address, it’s the one shown above: tz136characterstring36characterstrin

4. Check the balance of your account:

$ ./tezos-client get balance for <tz1>→ 0 ꜩ

Delegate Your Funds to Your Favourite Baker

  1. Adding your favourite baker:
$ ./tezos-client add address cryptium_labs_baker tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8

Remember to substitute cryptium_labs_baker and the tz1 address for your favourite baker’s!

2. Creating an originated account and delegating:

$ ./tezos-client originate account <my_originated_account> --delegatable for <my_implicit_account> transferring <qty> from <my_implicit_account> --delegate cryptium_labs_baker --fee 0.00

Remember to substitute the following:

  • <my_originated_account> the name you wish to give to your originated account
  • <my_implicit_account> for the name you gave to your previously created implicit account
  • <qty> for the amount of XTZ you wish to delegate
  • cryptium_labs_baker for the name of the baker you chose in the previous step
  • Note: --fee 0.0 will automatically set the fee to the minimum value, else the default is 0.05 XTZ.

For example, I ran:

$ ./tezos-client originate account my_originated_account --delegatable for my_implicit_account transferring 0.5 from my_implicit_account --delegate cryptium_labs_baker --fee 0.0→ Node is bootstrapped, ready for injecting operations.+[...]Operation hash: 51characteroperationhash51characteroperationhash51c
Waiting for the operation to be included...
[...]New contract KT136characterstring36characterstrin originated.[...]Contract memorized as my_originated_account.

3. To check that the contract was created and see your KT1 address:

$ ./tezos-client list known contracts→ my_originated_account : KT136characterstring36characterstrin

4. Voilà!

List of Resources:

Other Delegation Guides

--

--