烘焙奖励作为操作
2 个回答
- 投票数
-
- 2019-04-21
奖励是协议的一部分,并且都在链上.但是从通常的意义上讲,它们不是"交易",因为通常交易需要用户干预.但是,资金从"冰柜"到代表的转移是根本的.从概念上讲,冷冻室暂时持有烘烤和背书的所有纽带和奖励.
要在链上查找此信息,我们必须查看我们期望获得奖励的周期的最后一个阶段.
blockNumForRewards = (rewardedCycleNum + 6) * numOfBlocksInCycle
例如,对于周期93,周期93的奖励在周期98的最后一个块中被解锁,因此我们需要查看块编号
(93 + 6) * 4096 = 405,504
.知道区块编号后,我们可以查询该区块通过从tzscan之类的区块浏览器获取哈希值.在这种情况下,
BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf
是我们的块哈希:/chains/main/blocks/BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf
很显然,这里有很多信息,但让我们关注处理余额变化的路径,特别是
metadata > balance_updates
.示例:{ "protocol": "PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP", "chain_id": "NetXdQprcVkpaWU", "hash": "BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf", "metadata": { ... "balance_updates": [ // this is what we care about ] } ... }
该块的这一部分是余额更新,无论用户如何干预,该更新都保留了协议需要应用的内容.在很多区块中,这部分将只包括当前的区块贝克,其锁定的奖励和纽带.在周期的最后一个区块中,
balance_updates
还包括参与周期93的每个面包师的所有奖励和债券解锁.无论如何,让我们深入研究一位面包师的细节,以进一步理解.为了说明起见,我已经过滤出一位特定面包师
tz1ivoFE...TD
的交易."balance_updates": [ ... { "kind": "freezer", "category": "deposits", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-10368000000" }, { "kind": "freezer", "category": "fees", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-9362" }, { "kind": "freezer", "category": "rewards", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-321000000" }, { "kind": "contract", "contract": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "change": "10689009362" }, ...
在
balance_updates
数组内,它将包括需要针对所有这些地址(包括"冰柜")进行调整的每个"交易".每笔交易也为它们提供了一些线索.以上内容是每个面包师所见的非常典型的情况.有3个"冰柜"相关的交易和一个"合同". "冰柜"交易的不同之处在于其
category
(deposits
,fees
和rewards
).这些类别很容易解释.以防万一,您的存款和奖励将包括烘焙和背书保证金和奖励.请注意,这些冷冻室操作为负值,它们暗示从freezer
减去这些余额."合同"交易是什么改变了有关面包师的余额.这与用户发起的交易非常相似.如果我们将3个冰柜类别的余额加起来,它们将加起来为面包师的找零余额.
The rewards happen as part of the protocol and it's all on chain. But they are not a "transaction" in the normal sense of the word, as usually a transaction requires some user intervention. But there is fundamental movements of funds from the "freezer" to the delegates. Conceptually, the freezer temporarily holds all the bonds and rewards for baking and endorsing.
To find this information on chain, we have to look at the very last block of the cycle we'd expect the reward.
blockNumForRewards = (rewardedCycleNum + 6) * numOfBlocksInCycle
For example, for cycle 93, the rewards for cycle 93 gets unlocked at the last block of cycle 98, so we need to look at block number
(93 + 6) * 4096 = 405,504
.After we knowing the block number, We can query for the block with our node by getting the hash from a block explorer like tzscan. In this case,
BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf
is our block hash:/chains/main/blocks/BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf
Obviously there is a lot of information in here, but let's focus on the path that handles the balance changes, specifically
metadata > balance_updates
. Example:{ "protocol": "PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP", "chain_id": "NetXdQprcVkpaWU", "hash": "BLdha4dMeWYxYkuP46eCgYwsgBYiKPNFLvgiu5NqgdxPLhkgzUf", "metadata": { ... "balance_updates": [ // this is what we care about ] } ... }
This portion of the block is the balance updates that retains to what the protocol needs to apply regardless of the user interventions. In a lot of the blocks, this portion will just include the current block baker with its locked rewards and bonds. In the last block of the cycle,
balance_updates
also includes all the rewards and bonds unlocks for every baker that participated in cycle 93.Anyhow, let's dig into the specifics of one baker to understand further. For illustration, I've filtered out transactions for one particular baker
tz1ivoFE...TD
."balance_updates": [ ... { "kind": "freezer", "category": "deposits", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-10368000000" }, { "kind": "freezer", "category": "fees", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-9362" }, { "kind": "freezer", "category": "rewards", "delegate": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "level": 93, "change": "-321000000" }, { "kind": "contract", "contract": "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD", "change": "10689009362" }, ...
Inside of
balance_updates
array, it will include every "transaction" that needs to be adjusted for all these addresses including the "freezer". Each transaction also gives some clues on what they are for.The above is pretty typical what we'll see per baker. There are 3 "freezer" related transactions and one "contract". The "freezer" transaction are different by their
category
(deposits
,fees
andrewards
). The categories are pretty self explanatory. Just in case you are wonder, deposits and rewards will include both baking and endorsements bonds and rewards. Notice that those freezer operations are negative values and they imply that these balances are subtracted fromfreezer
.The "contract" transaction is what changes the balance to the baker in question. This is pretty similar to a user initiated transaction. If we add up the 3 freezer category's balances, they would add up to the change balance for the baker.
-
这是正确的答案.我的回答回答了以下问题:面包师如何信任/奖励其代表,而不是如何通过协议本身来奖励面包师.为了消除任何混乱,我删除了答案.This is the correct answer. My answer answered the question of how baker credit/reward their delegators, not how a baker is rewarded via the protocol itself. To remove any confusion, I've deleted my answer.
- 1
- 2019-04-23
- lostdorje
-
@Frank如何知道"tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD"是面包师? 2.为什么存款,费用和奖励全都是负数.你能帮我理解吗?@Frank how to know that "tz1ivoFEvbfbUNav5FwLvmxzMGcNXWxY9qTD" is the baker ? 2. Why deposits , fees and rewards all are in negative. Could you please help me understand ?
- 0
- 2020-02-23
- user3759202
-
1.面包师的地址只是一个例子,但本节仅包括面包师.2."请注意,这些冷冻室操作为负值,这意味着从冷冻室中减去了这些余额."冷冻店是连锁店要存储的东西,因此我们要为冷冻店进行负余额更改,而将正余额更改作为奖励.零和1.That baker address is just an example, but this section only include bakers. 2. "Notice that those freezer operations are negative values and they imply that these balances are subtracted from freezer." Freezer is what the chain is storing, so we are making a negative balance change for the freezer and a positive balance change as the reward. It's zero sum.
- 0
- 2020-02-23
- Frank
-
@弗兰克我仍然对冰箱里的东西感到困惑.我见过一些样本,其中存款为正,奖励也为正.在哪种情况下,此blochHash是可能的,我们可以找到存款和奖励为正数@Frank I am still confused with the freezer stuff. I have seen few samples where deposit is positive and reward is also positive. In which scenario this is possible for this blochHash we can find the deposit and reward as positive
- 0
- 2020-02-24
- user3759202
-
- 2019-04-24
"简短版本"的答案是,这是通过
consensus
达成的,这是用于加密货币的区块链中极为重要的概念.不幸的是,许多人只是不太了解它.在这方面,术语"共识"基本上可以归结为:(这实际上是一个非常简化的描述,未考虑冻结的奖励或存款等) Tezos协议的代码规定,当一个帐户烘烤一个区块时,该帐户的余额仅增加了16英镑.由于每个人都运行相同的协议,因此每个人都同意,当一个帐户烘烤一个区块时,该帐户的余额增加了16英镑.多数民众赞成.
The "short version" answer is that this is accomplished through
consensus
, which is an extremely important concept in blockchains that are used for cryptocurrency. Unfortunately many people just dont really understand it; in this aspect essentially the term "consensus" boils down to:(and this really is a very simplified description here, not taking into account freezing rewards or deposits, etc) The code for the Tezos protocol dictates that when an account bakes a block, that account's balance simply goes up by ꜩ16. Since everyone is running the same protocol, everyone agrees that when an account bakes a block, that account's balance goes up by ꜩ16. Thats consensus.
当烘焙奖励记入面包师行时,它们如何在链上出现?这是"交易"操作吗?我该如何识别它们?