Once you’ve selected a baker that meets your needs1 you can delegate your XTZ to put your voting power to work and begin earning rewards on your stake. Tezos however has one of the more complex delegation systems. Delegating requires moving funds between two types of user controlled addresses with a multi-week delay in staking and rewards. In this guide we walk through our recommended process for delegating to an external baker.

In this guide, we’ll walk through Originating a new KT1 account beneath a tz Implicit Account and delegating from that Originated Account to a Baker. The Baker will then post bonds on your behalf and bake/endorse blocks. The Baker will receive rewards directly from the protocol into it’s tz account, after which they’re typically expected to pay out those rewards, minus some fee for their baking service, back to your originated account. Here’s how to do that.

Staking Overview Staking Interaction among the Delegate, Baker, and Protocol

Setup

To begin, we recommend using the latest mainnet build of the tezos-client binary for your platform 2. You can do so by following the reference build instructions. Once acquired, you’ll need a public Tezos node to talk to, which we’ll pin in a helpful alias around our tezos client. We’ll then use this tezos-client to verify that our node is up to date like so:

# Create a helpful alias that connects to Blockscale’s public nodes:
alias tezos-client="/path/to/tezos-client --addr tezos-rpc.nodes.polychainlabs.com --port 443 --tls"

# Verify that we can talk to these nodes and that they’re up to date
tezos-client bootstrapped
> {
>   "block": "BM9AcJ82s5iMzLLZjHHm8HJM6QuHzyigY6Qcu9bT3WD3eFa8yyn",
>   "timestamp": "2019-06-03T00:59:27Z"
> }

The last command returns a block hash. Search for this block hash on tzscan and verify that it is a valid and recent mainnet block to ensure we’re on the right network and ready to broadcast operations. You’re now ready to start working with our keys.

Prepare your Keys

How you store, protect and backup your keys is one of the most important steps to get right before doing anything else like delegating. There’s no “correct” answer to this: proper key storage is relative to your risk tolerance, technical ability and the value of your funds. To minimize key exposure we generally recommend using a hardware wallet like a Nano Ledger S. If you haven’t already done so, consider first moving your funds, or moving a newly activated fundraiser account to a new address generated on your ledger whose seed words are securely and durably stored:

You can setup a Nano Ledger S3 for use with Tezos by first installing the Tezos Wallet app through ledger live. The latest app version is 2.1.0.

Tezos Ledger App Install the Tezos Ledger App

Once installed, open the Tezos Wallet app on your ledger and use your tezos-client to list connected ledgers and their keys. Note that you may need to run this command multiple times for the ledger to be recognized.

tezos-client list connected ledgers

When your ledger is found, it will provide a command to run to import your desired key. We like to use the secp256k1 curve, which reuses some of Bitcoin’s battle tested code, and you can import a pointer to the key inside of your ledger by running the provided command like so.

# Import key with the alias “ledger” for easily reference
tezos-client import secret key ledger "ledger://absorb-bless-clinic-dinner/secp256k1/0'/0'"

# Now display our public key
tezos-client show address ledger

If you have yet to activate a fundraiser account, you can do so like:

# Activate your fundraiser account named “legacy”
tezos-client activate fundraiser account legacy with <activation_code>

If your keys are alternatively in an (un)encrypted string, you can import them directly like so:

# Import raw key with the alias “legacy” for easily reference
tezos-client import secret key legacy encrypted:....

You may now choose to migrate your funds into your hardware wallet, which can be done through the transfer command. After each command, verify the details of the transaction on-chain using the tzscan.io or tzbeta.net block explorer:

# Check your full balance
tezos-client get balance for legacy

# Always start with a test transfer
tezos-client transfer 1 from legacy to ledger
# Verify you can transfer with your ledger
tezos-client transfer 0.1 from ledger to legacy
# Transfer the full amount, minus fees
tezos-client transfer <full balance - 0.00276> from legacy to ledger

Now that we have online access to our funds, we can begin the process of delegation.

Originating an Account

The accounts we’ve just setup begin with tz and are known as Implicit accounts. Implicit accounts can hold funds, but cannot interact with smart contracts or delegate to a baker. To do either, we must create a special sub-account tied to these. These sub-accounts are known as Originated accounts and their address begins with KT1. We can now create a new originated account that will still be controlled by our ledger and thereby still be protected from many risks:

# Originate a new account, managed by our ledger keys and 
# initialize with 1 XTZ.  Replace the <baker> section with 
# the tz... address of a baker you’ve previously selected

tezos-client originate account ledger_originated \
    for ledger transferring 1 from account \
    --delegate <baker> --delegatable

Funding the Delegation

Tezos is a delegator friendly network. Delegators always retain full control over their funds, can move between bakers or wallets at any time and have no direct slashing risk if a baker malfunctions or acts maliciously. We will now verify that our delegation is setup correctly, verify that we retain control over our originated account and then fully delegate our funds – knowing that we can move them at any time.

To independently verify that our delegation is setup correctly, again visit tzscan, search for your KT1 address and verify on the right-hand side of the page that (1) Originated, Spendable and Delegatable are all true and (2) that the Delegate points to the baker you had intended. It should look something like the following:

Implicit Account on TzScan Implicit Account on TzScan

Now, we’ll verify that we can move funds, signed by our ledger, from this originated account. We’ll do this with the following command, carefully verifying the destination address on your ledger before approving the transaction:

tezos-client transfer .1 from ledger_originated to ledger

Lastly, now that we’ve verified our delegation is setup properly and that we can move funds with our ledger between our Implicit and Originated accounts, we’re ready to fully fund our delegation. This can be done like so, again verifying all addresses on your ledger:

# Check your full balance
tezos-client get balance for ledger

# Update `<full balance>` and transfer the full 
# amount minus fees to your originated address
tezos-client transfer <full balance - 0.00276> from ledger to ledger_originated

What’s Next

Now that your funds are securely delegated, you’ll slowly begin to participate in staking and governance. You won’t however see the effect for at least 19 days. Every cycle, which lasts ~4096 minutes or 2.8 days, a snapshot of balances is randomly chosen. This balance will contribute to staking powers 7 cycles or ~19 days later. In that cycle the power you contributed will increase the likelihood that your baker is selected to endorse or bake, in which case bond will be posted and rewards will be reserved for you. These rewards will be released an additional 5 cycles or 14 days later, after which you should expect to receive your share of rewards.

While the current Tezos delegation process achieves some usability wins like fully user-controlled funds and insulating users from direct slashing risk, the process is currently far from easy. New proposals like Burebrot that are still be reviewed aim to further simplify this, and we’re excited to be a a part of a network where holders can vote with their stake on new proposals that responsibly mature the network.

Footnotes

  1. Security, Governance history, accounting and expected rewards are all factors to consider when selecting an external baker – or deciding to bake on your own. 

  2. Tezbox also provides some of the easiest to use interfaces around delegation. 

  3. As of this writing, the Ledger X isn’t yet fully supported but work is in progress.