Unsafe Basic Infrastructure

In this tutorial, we’ll present a method to bake on the testnet as a trial. Baking on the mainnet is quite similar except that you don’t need to activate faucet accounts. Another trial alternative is to setup a private network and start baking on it. This is the most simple scenario, but also the least secure, as your private key is stored on the computer.

Prerequisites

We’ll assume that you already checked out the testnet branch of the gitlab repository and built the binaries. We assume you are running a testnet node which stores its state in $HOME/dune-testnet-2019-07-08, and with RPC port 8733 on the local loop 127.0.0.1. You might have to specify -A <addr> -P <port> after dune-client to specify different parameters before running some actions. We also suppose that the current protocol is 004-Pt24m4xi, you might have to change the names of the commands to accomodate with the current protocol.

New Address With Coins

First, we’ll generate a new dn address on which we will transfer some coins using a testnet faucet account. If you are setting up a baker for the mainnet or you already have an account with some rolls, you can directly go to the next section below to register your address as a delegate. If you are working on a private network, there are different solutions to get some coins in a (fresh) address.

Let’s generate a new key called my-baker as follows:

$ dune-client gen keys my-baker

You may want to use option --force if a key with alias my-baker already exists. The command above prints a message as shown below if it succeeds:

Key my-baker registered

Now, let’s get more information on this key. For that, you can either use the command:

$ dune-client list known addresses
my-baker: dn1VR3s5M1ct6iGftzJEzKTexyxH5s1PA5sW (unencrypted sk known)

Or the command below. Note that the option -S will also display the private key:

$ dune-client show address my-baker
Hash: dn1VR3s5M1ct6iGftzJEzKTexyxH5s1PA5sW
Public Key: edpkujfZ7WcmVGe9rUUm9hDMT6uSnwiT1wYdhhUGFy9aVGDudd4b9m

We need to transfer some coins to this address to have rolls. On testnet, you should first download a faucet account from the address: https://faucet.dune.network/. Assuming the downloaded faucet account is dn1VR3s5M1ct6iGftzJEzKTexyxH5s1PA5sW.json, you can activate the account on the testnet as follows (we call the new account my-faucet):

$ dune-client -A 127.0.0.1 -P 8733 activate account my-faucet with <some/prefix/path/>dn1VR3s5M1ct6iGftzJEzKTexyxH5s1PA5sW.json
[...]
$ dune-client get balance for my-faucet
37888.263386 đ

Once the activation is done, we can transfer some of these coins to our baker’s address:

$ dune-client -A 127.0.0.1 -P 8733 transfer 37800 from my-faucet to my-baker --burn-cap 0.257
[...]

Note that we had to increase the burn cap if the my-baker account received no transactions before this transfer.

Register The Address as a Delegate

The next step is to register our baker’s address as a baking account. This is done with the following command:

$ dune-client -A 127.0.0.1 -P 8733 register key my-baker as delegate

Our baker has 3 rolls. Once the registration is done, we should wait 7 cycles for our baker to receive baking/endorsements opportunities on the testnet or mainnet (~20 days on the mainnet, ~10 days on the testnet, it depends on protocol parameters for a private network).

Start Different Binaries

Before you get baking/endorsements opportunities, we can already start different binaries. Normally, you would start all daemons in background with a logging file using, eg., screen or nohup commands.

First, the command to start the baker is of the form:

$ dune-baker-004-Pt24m4xi run with local node $HOME/dune-testnet-2019-07-08 my-baker
Waiting for the node to be synchronized with its peers...
Node synchronized.
Baker started.

Then, the endorser:

$ dune-endorser-004-Pt24m4xi run my-baker
Waiting for the node to be synchronized with its peers...
Node synchronized.
Endorser started.

Finally, we can start the accuser:

$ dune-accuser-004-Pt24m4xi run
Waiting for the node to be synchronized with its peers...
Node synchronized.
Accuser started.

Note that the accuser does not take the key as argument: it will send evidences without caring about which baker is going to include them in its block. Indeed, the accuser will not receive any reward. Running a few accusers is nice, but there is no need for all bakers to run one.