Tezos Bond Loss: Worked Examples
Through the Tez Baker telegram channel we received the following question a few days ago:
Hey guys, have a question. Hypothetical. Say your bond gets slashed due to behaving maliciously. What happens to these Tez? Are they permanently destroyed? Or do they get distributed to other bakers?
Half is burnt and half goes to the baker who bakes the next block. The same conditions are applied for double baking (creating two different blocks with the same key but different node ids).
First Worked Example
There have been a few examples of double baking due to everyone learning the technology; here is the first example we found opQKVbn1QGLGvRTdtKwgJwvaYsaWPJreeCCFA5raDsEz3ejFG2f
Noting that the address as is a private, anonymous baker who is now doing well so we hope they don’t mind us using this operation as an example tz1NEujRQicEoM7LAF5W63mLbxwiMS4CLauJ
The lost bond for this cycle was 504 XTZ.
252 XTZ were burnt.
On the positive side the lucky baker that picked up the remaining 252 XTZ was tz1NpWrAyDL9k2Lmnyxcgr9xuJakbBxdq7FB; as it happens this is one of the two private whales we have been tracking in our tezos delegation service network chart. We affectionately named this address “Old Humpy” (the other we named “Big Blue”, not very creative but they fit).
What is interesting is the baker lost 504 XTZ as in cycle 28 the block deposit was 224 XTZ!¹
So how did they lose 504 XTZ if bond was 224?
Their total bond for Cycle 28 was 532 XTZ.
They were originally allocated 1 block (bond: 1 * 224 XTZ = 224XTZ) and 11 endorsements (bond: 11 * 28 XTZ = 308 XTZ) for Cycle 28 (total bond: 224 XTZ + 308 XTZ = 532 XTZ).
The reward split (TZScan’s api) for that cycle is as follows:
They received all their rewards for the block they baked (1 * 16 XTZ = 16 XTZ) and the endorsements they completed (11 * 2 XTZ = 22 XTZ).
However, as you can see they were fined 504 XTZ and 36 XTZ rewards were rescinded.
Bond Loss — Initial Assumption
Unfortunately for this baker the fine and rescinded rewards are calculated off everything you have completed in the cycle, up to and including the offense.
The double bake occurred at level 117865.
Prior to that point in time they had achieved 10 endorsements
Penalty Calculation — Initial Assumption
Loss of all bond up to and including the offending operation.
In this example the 504 XTZ fine were comprised of 1 * 224 XTZ Block Bond and 10 * 28 XTZ Endorsement Bond.
Rescinded Rewards Calculation — Initial Assumption
Loss of all rewards up to and including the offending operation.
In this example the 36 XTZ rescinded rewards were comprised of 1 * 16 XTZ Block Rewards and 10 * 2 XTZ Endorsement Rewards.
Red Herring — Initial Assumption
From this example, you could conclude that you only lose your deposits for all the previous blocks and endorsements in the cycle because the baker had one successful endorsement after the double baking and there was no fine. Although, could it have been that no baker picked it up? The endorsement was at 118446 and Tez Baker baked a block at 118488 and we didn’t pick it even though we run the accuser process. So, we happily concluded that you only lose your deposit for all previous operations and you are good going forward. So, we thought we would check another double bake to ensure our understanding is correct!
Baker tz1N674Rm7uMVVXzPsqnGX6VTn2xWoLCdcF6 doubled baked at level 88872 as you see below.
This was picked up a block later and a fine of 567 XTZ was issued. This matched our previous thesis as the baker had 19 previous endorsements at 21 XTZ per endorsements (19 * 21(endorse deposit) + 168 (block deposit) = 567). In fact, this baker was fortunate, as they missed 5 endorsements which would have cost then another 95 XTZ.
The first fine can be seen here https://tzscan.io/oodBXzubwMxT1xjhZiRw7q3nA4UetJfShiiYnNsJe8UawV5DCZj
So all good but what is this? a second fine? https://tzscan.io/double-baking
It seems that you do get fined for future endorsements and blocks as well and this fine was raised in 90002. Not sure why at this level but other bakers didn’t pick it up (software configuration differences?).
The second fine can be seen here https://tzscan.io/onuCJSH7cq3eMzq1rj5XKwDGGDj1ADtp48bUZdjhzTMzfo1XvEz
Note, that this was raised at 90002 and so the baker got away with the last endorsement at 90086 as no other baker pulled it up. The second fine was for 126 XTZ and that was for the 6 endorsements (6 * 21 XTZ). So some interesting questions; why didn’t other bakers pick up the fine before block 90002 and why didn’t anyone pick up the last endorsement? Also is there a time limit to raise the penalty and does the fine have to be raised in the same cycle?
So for double baking we lose all deposits and rewards for the cycle
Well, not exactly we have another baker tz1aviwxpVSjzBnepQMdMjEGksxgkKMKUZS6 that triple baked at 50777 and was fined 732 XTZ. They continued to endorse and bake and you see another 6 penalties until we get to 50787 and then is stops. The baker continued endorsing and baking but there were no more fines. At this point we can’t explain why this was the case. Is 7 fines the max that can be issues, seems doubtful? Our next step is to start looking at the source code to figure this out but that is for a later article.
Another point of confusion is that in the double baking evidence above, the Lost Deposit and Lost Reward column are not necessary consistent with a particular penalty. For example, if you look at the third to the bottom, “Bake’n’Rolls” raised a 12 XTZ fine for an endorsement but has zero for the Lost Rewards and we know you get 2 XTZ for a priority zero endoresement². For some reason this 2 XTZ is captured in the line above with 6 XTZ but should that mean its deposit is higher (12 XTZ per endorsement) but this seems to appear two lines below in “Foundation Baker 5”. We can’t make up a narrative as to why this is the case! It maybe a bug on the TZScan side as we are viewing data via their API.
Questions we still need Answering
What does the accuser process do? When baking you have a number of processes running: the node, the baker, the endorser and the accuser. The node and the accuser don’t require access to your key so what exactly does the accuser do? We are not completely sure but we are guessing that it notifies the network of a double bake which can be picked by by the next baker, baking the next block.
Do all fines have to be raised in that cycle? So if you double bake on the last block of the cycle can you ever be fined? Is there a limit to the number of fines that can raise on a double bake? We know something stopped further fines being issued; could it have even been a software switch on the foundation bakers? As we were still in betanet at the time, would the foundation be possibly testing various configurations on their nodes? What we do know is that it stopped issuing fines otherwise the baker would have lost a lot of money.
What is the trigger to put the penalty information in a block? The first time there is a double baking violation the baker of the next block picks it up straight away. The subsequent endorsements, in the same cycle, don’t get picked up straight away and in fact most of the bakers are ignoring it. Could it be that some bakers are running different configurations, which picks up these violations, where the rest of us are missing them.
Moral of the Story
If you double bake then switch off your baking and endorsements process immediately. Don’t switch it on until the next cycle. This will at least reduce the risk of you losing your deposit and rewards for up and coming endorsements and blocks. Until we fully understand the extent of future fines its better to be safe and switch of the processes until next cycle.
The mechanism seems to have been designed so that large influence attracts large punishment.
It gets very expensive, very quickly if you are big baker.
Yin and yang at work in Tezos.
If you know more on the subject please feel free to add comments to help us fill in the missing gaps.
Things to Note
- ¹ Deposits are going up each cycle until we reach cycle 64. Deposit for an endorsement is the same as the cycle number. e.g. Cycle 21 has a deposit of 21 XTZ. Deposits for baking a block is the cycle number * 8 XTZ.
- ² You get 2 XTZ rewards for endorsing a priority zero block. For You get half of that for a priority one block , 0.666 for a priority two block, etc (2 (rewards)/(priority + 1)). A priority one enforcement is created when we have a priority one block. A priority one block is when the allocated baker for the block doesn’t bake and it falls to the second baker in the queue.