bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 2쪽 중 2쪽
contrast, Bitcoin’s mining inflation impoverishes Bitcoin holders as a whole, and central
banking enrishes the financial sector at the expense of savers
9
dynamically adapts to reflect the average participation. This is necessary if
only to deal with lost coins.
First quarter Protocol amendments are suggested by submitting the hash of
a tarball of .ml and .mli files representing a new protocol. Stakeholders may
approve of any number of these protocols. This is known as “approval voting”,
a particularly robust voting procedure.
Second quarter The amendment receiving the most approval in the first
quarter is now subject to a vote. Stakeholders may cast a vote for, against or
can choose to explicitely abstain. Abstentions count towards the quorum.
Third quarter If the quorum is met (including explicit abstentions), and the
amendment received 80% of yays, the amendment is approved and replaces the
test protocol. Otherwise, it is rejected. Assuming the quorum reached was q,
the minimum quorum Q is updated as such:
Q 0:8Q + 0:2q:
The goal of this update is to avoid lost coins causing the voting procedure
to become stuck over time. The minimum quorum is an exponential moving
average of the quorum reached over each previous election.
F ourth quarter Assuming the amendment was approved, it will have been
running in the testnet since the beginning of the third quarter. The stakeholders
vote a second time to confirm they wish to promote the test protocol to the main
protocol. This also requires the quorum to be met and an 80% supermajority.
We deliberately chose a conservative approach to amendments. However,
stakeholders are free to adopt amendments loosening or tightening this policy
should they deem it beneficial
3.2 Proof-of-stake mechanism
3.2.1 Overview
Our proof-of-stake mechanism is a mix of several ideas, including Slasher[ 1],
chain-of-activity[2], and proof-of-burn. The following is a brief overview of the
algorithm, the components of which are explained in more details below.
Each block is mined by a random stakeholder (the miner) and includes mul-
tiple signatures of the previous block provided by random stakeholders (the
signers). Mining and signing both offer a small reward but also require making
a one year (unbonding will happen after one cycle, and not one year as initially
suggested. Prolonging the period longer than a cycle did not really improve se-
curity at the cost of immobilizing a lot of capital) safety deposit to be forfeited
in the event of a double mining or double signing.
10
The protocol unfolds in cycles of 2048 blocks. At the beginning of each cycle,
a random seed is derived from numbers that block miners chose and committed
to in the penultimate cycle, and revealed in the last. Using this random seed, a
follow the coin strategy is used to allocate migning rights and signing rights to
a specific addresses for the next cycle. See figure 1.
3.2.2 Clock
The protocol imposes minimum delays between blocks. In principle, each block
can be mined by any stakeholder. However, for a given block, each stakeholder
is subject to a random minimum delay. The stakeholder receiving the highest
priority may mine the block one minute after the previous block. The stake-
holder receiving the second highest priority may mine the block two minutes
after the previous block, the third, three minutes, and so on.
This guarantees that a fork where only a small fraction of stakeholder con-
tribute will exhibit a low rate of block creation. If this weren’t the case, a CPU
denial of service attacks would be possible by tricking nodes into verifying a
very long chain claimed to have a very high score.
3.2.3 Generating the random seed
Every block mined carries a hash commitment to a random number chosen by
the miner. These numbers must be revealed in the next cycle under penalty
of forfeiting the safety bond. This harsh penalty is meant to prevent selective
whitholding of the numbers which could be sued to attack the entropy of the
seed.
Malicious miners in the next cycle could attempt to censor such reveals,
however since multiple numbers may be revealed in a single block, they are very
unlikely to succeed.
All the revealed numbers in a cycle are combined in a hash list and the
seed is derived from the root using the scrypt key derivation function. The
key derivation should be tuned so that deriving the seed takes on the order of
a fraction of a percent of the average validation time for a block on a typical
desktop PC.
Figure 1: Four cycles of the proof-of-stake mechanism
11
3.2.4 F ollow-the-coin procedure
In order to randomly select a stakeholder, we use a follow the coin procedure.
Principle The idea is known in bitcoin as follow-the-satoshi. The procedures
works “as-if” every satoshi ever minted had a unique serial number. Satoshis
are implicitly ordered by creation time, a random satoshi is drawn and tracked
through the blockchain. Of course, individual cents are not tracked directly.
Instead, rules are applied to describe what happens when inputs are combined
and spent over multiple output.
In the end, the algorithm keeps track of a set of intervals associated with
each key. Each intervals represents a “range” of satoshis. Unfortunately, over
time, the database becomes more and more fragmented, increasing bloat on the
client side.
Coin Rolls We optimize the previous algorithm by constructing large “coin
rolls” made up of 10 000 tez. There are thus about one million rolls in existence.
A database maps every roll to its current owner.
Each address holds a certain set of specific rolls as well as some loose change.
When we desire to spend a fraction of a full roll, the roll is broken and its serial
number is sent in a LIFO queue of rolls, a sort of “limbo” . Every transaction
is processed in a way that minimizes the number of broken rolls. Whenever an
address holds enough coins to form a roll, a serial number is pulled from the
queue and the roll is formed again.
The LIFO priority ensures that an attacker working on a secret fork cannot
change the coins he holds by shuffling change between accounts.
A slight drawback of this approach is that stake is rounded down to the
nearest integer number of rolls. However, this provides a massive improvement
in efficiency over the follow-the-satoshi approach.
While the rolls are numbered, this approach does not preclude the use of
fungibility preserving protocols like Zerocash. Such protocols can use the same
“limbo” queue technique.
Motivation This procedure is functionally different from merely drawing a
random address weighted by balance.
Indeed, in a secretive fork, a miner could attempt to control the generation
of the random seed and to assign itself signing and minting rights by creating
the appropriate addresses ahead of time. This is much harder to achieve if rolls
are randomly selected, as the secretive fork cannot fake ownership of certain
rolls and must thus try to preimage the hash function applied to the seed to
assign itself signing and minting rights.
Indeed, in a cycle of length N = 2048, someone holding a fraction f of the
rolls will receive on average f N mining rights, and the effective fraction received,
12
f0 will have a standard deviation of
√
1
N
√
1 f
f :
If an attacker can perform a brute-force search through W different seeds,
then his expected advantage is at most 3
(√
2 log(W )
N
√
1 f
f
)
f N
blocks. For instance, an attacker controlling f = 10 % of the rolls should
expect to mine about 205 blocks per cycle. In a secret fork where he attempts
to control the seed, assuming he computed over a trillion hashes, he could assign
itself about 302 blocks, or about 14:7% of the blocks. Note that:
- The hash from which the seed is derived is an expensive key derivation
function, rendering brute-force search impractical.
- To make linear gains in blocks mined, the attacked needs to expend a
quadratically exponential effort.
3.2.5 Mining blocks
The random seed is used to repeatedly select a roll. The first roll selected
allows its stakeholder to mine a block after one minute, the second one after
two minutes — and so on.
When a stakeholder observes the seed and realizes he can mint a high priority
block in the next cycle, he can make a security deposit.
To avoid a potentially problematic situation were no stakeholder made a
safety deposit to mine a particular block, after a 16 minutes delay, the block
may be mined without a deposit.
Bonds are implicitely returned to their buyers immediately in any chain
where they do not mine the block.
3.2.6 Signing blocks
As it is, we almost have a working proof of stake system. We could define a
chain’s weight to be the number of blocks. However, this would open the door
to a form of selfish mining.
We thus introduce a signing scheme. While a block is being minted, the
random seed is used to randomly assign 16 signing rights to 16 rolls.
The stakeholders who received signing rights observe the blocks being minted
and then submit signatures of that blocks. Those signatures are then included
3this is a standard bound on the expectation of the maximum of W normally distributed
variable
13
in the next block, by miners attempting to secure their parent’s inclusion in the
blockchain.
The signing reward received by signers is inversely proportional to the time
interval between the block and its predecessor.
Signer thus have a strong incentive to sign what they genuinely believe to
be the best block produced at one point. They also have a strong incentive to
agree on which block they will sign as signing rewards are only paid if the block
ends up included in the blockchain.
If the highest priority block isn’t mined (perhaps because the miner isn’t on
line), there could be an incentive for signers to wait for a while, just in case the
miner is late. However, other signers may then decide to sign the best priority
block, and a new block could include those signatures, leaving out the holdouts.
Thus, miners are unlikely to follow this strategy.
Conversely, we could imagine an equilibrium where signers panic and start
signing the first block they see, for fear that other signers will do so and that a
new block will be built immediately. This is however a very contrived situation
which benefits no one. There is no incentive for signers to think this equilibrium
is likely, let alone to modify the code of their program to act this way. A
malicious stakeholder attempting to disrupt the operations would only hurt
itself by attempting to follow this strategy, as others would be unlikely to follow
suit.
3.2.7 W eight of the chain
The weight is the number of signatures.
3.2.8 Denunciations
In order to avoid the double minting of a block or the double signing of a block,
a miner may include in his block a denunciation.
This denunciation takes the form of two signatures. Each minting signature
or block signature signs the height of the block, making the proof of malfeasance
quite concise.
While we could allow anyone to denounce malfeasance, there is really no
point to allow anyone else beyond the block miner. Indeed, a miner can simply
copy any proof of malfeasance and pass it off as its own discovery. 4
Once a party has been found guilty of double minting or double signing, the
safety bond is forfeited.
3.3 Smart contracts
3.3.1 Contract type
In lieu of unspent outputs, Tezos uses stateful accounts. When those accounts
specify executable code, they are known more generally as contracts. Since an
4A zero-knowledge proof would allow anyone to benefit from denouncing malfeasances, but
it’s not particularly clear this carries much benefit.
14
account is a type of contract (one with no executable code), we refer to both as
”contracts” in full generality.
Each contract has a “manager”, which in the case of an account is simply
the owner. If the contract is flagged as spendable, the manager may spend the
funds associated with the contract. In addition, each contract may specify the
hash of a public key used to sign or mine blocks in the proof-of-stake protocol.
The private key may or may not be controlled by the manager.
Formally, a contract is represented as:
type contract = {
counter: int; (* counter to prevent repeat attacks *)
manager: id; (* hash of the contract's manager public key *)
balance: Int64.t; (* balance held *)
signer: id option; (* id of the signer *)
code: opcode list; (* contract code as a list of opcodes *)
storage: data list; (* storage of the contract *)
spendable: bool; (* may the money be spent by the manager? *)
delegatable: bool; (* may the manager change the signing key? *)
}
The handle of a contract is the hash of its initial content. Attempting to
create a contract whose hash would collide with an existing contract is an invalid
operation and cannot be included in a valid block.
Note that data is represented as the union type.
type data =
| STRING of string
| INT of int
where INT is a signed 64-bit integer and string is an array of up to 1024
bytes. The storage capacity is limited to 16 384 bytes, counting the integers as
eight bytes and the strings as their length.
3.3.2 Origination
The origination operation may be used to create a new contract, it specifies
the code of the contract and the initial content of the contract’s storage. If the
handle is already the handle of an existing contract, the origination is rejected
(there is no reason for this to ever happen, unless by mistake or malice).
A contract needs a minimum balance of 1 to remain active. If the balance
falls below this number, the contract is destroyed.
3.3.3 T ransactions
A transaction is a message sent from one contract to another contract, this
messages is represented as:
type transaction = {
amount: amount; (* amount being sent *)
parameters: data list; (* parameters passed to the script *)
(* counter (invoice id) to avoid repeat attacks *)
counter: int;
destination: contract hash;
}
15
Such a transaction can be sent from a contract if signed using the manager’s
key or can be sent programmatically by code executing in the contract. When
the transaction is received, the amount is added to the destination contract’s
balance and the destination contract’s code is executed. This code can make
use of the parameters passed to it, it can read and write the contract’s storage,
change the signature key and post transactions to other contracts.
The role of the counter is to prevent replay attacks. A transaction is only
valid if the contract’s counter is equal to the transaction’s counter. Once a
transaction is applied, the counter increases by one, preventing the transaction
from being reused.
The transaction also includes the block hash of a recent block that the client
considers valid. If an attacker ever succeeds in forcing a long reorganization
with a fork, he will be unable to include such transactions, making the fork
obviously fake. This is a last line of defense, TAPOS is a great system to
prevent long reorganizations but not a very good system to prevent short term
double spending.
The pair (account_handle, counter) is roughly the equivalent of an unspent
output in Bitcoin.
3.3.4 Storage fees
Since storage imposes a cost on the network, a minimum fee of ꜩ 1 is assessed
for each byte increase in the storage. For instance, if after the execution of a
transaction, an integer has been added to the storage and ten characters have
been appended to an existing string in the storage, then ꜩ 18 will be withdrawn
from the contract’s balance and destroyed.
3.3.5 Code
The language is stack based, with high level data types and primitives and strict
static type checking. Its design is insipired by Forth, Scheme, ML and Cat. A
full specification of the instruction set is available in[ 5]. This specification gives
the complete instruction set, type system and semantics of the language. It is
meant as a precise reference manual, not an easy introduction.
3.3.6 F ees
So far, this system is similar to the way Ethereum handles transaction. However,
we differ in the way we handle fees. Ethereum allows arbitrarily long programs
to execute by requiring a fee that increases linearly with the program’s execut-
ing time. Unfortunately, while this does provide an incentive for one miner to
verify the transaction, it does not provide such an incentive to other miners,
who must also verify this transaction. In practice, most of the interesting pro-
grams that can be used for smart contracts are very short. Thus, we simplify
the construction by imposing a hard cap on the number of steps we allow the
programs to run for.
16
If the hard cap proves too tight for some programs, they can break the execu-
tion in multiple steps and use multiple transactions to execute fully. Since Tezos
is amendable, this cap can be changed in the future, or advanced primitives can
be introduced as new opcodes.
If the account permits, the signature key may be changed by issuing a signed
message requesting the change.
4 Conclusion
We feel we’ve built an appealing seed protocol. However, Tezos’s true potential
lies in putting the stakeholders in charge of deciding on a protocol that they
feel best serves them.
References
[1] Vitalik Buterin. Slasher: A punitive proof-of-stake al-
gorithm. https://blog.ethereum.org/2014/01/15/
slasher-a-punitive-proof-of-stake-algorithm/ , 2014.
[2] Ariel Gabizon Iddo Bentov and Alex Mizrahi. Cryptocurrencies without
proof of work. http://www.cs.technion.ac.il/~idddo/CoA.pdf, 2014.
[3] Peter Suber. Nomic: A game of self-amendment. http://legacy.earlham.
edu/~peters/writing/nomic.htm, 1982.
[4] Jérôme Vouillon. Lwt: a cooperative thread library. 2008.
[5] Tezos project. Formal specification of the tezos smart contract language.
https://tezos.com/pages/tech.html, 2014.
17프로젝트로 돌아가기