Ethereum White Paper original link

Ethereum

Ethereum: a blockchain with a built-in Turing-complete programming language, allowing anyone to write smart contracts and decentralized applications where they can create their own arbitrary rules for ownership, transaction formats and state transition functions.

Ethereum: A blockchain with a Turing-complete programming language built in. Anyone can write a smart contract; Or decentralized applications that “can create their own rules”; And the transaction format and state transition function.


The state transition function APPLY(S, TX) -> S’ in Ethereum can be defined as:

  1. Check that the transaction format is correct (for example, the correct amount), that the digital signature is valid, and that the random number matches the random number in the sender’s account. If the above conditions are not met, an error is returned.
  2. Calculate whether the transaction cost is equal toSTARTGAS * GASPRICEAnd digitally signed to confirm the sender’s address. Subtract the transaction fee from the sender’s account balance and increase the random number of the sender’s account. If the account balance is insufficient, an error is returned.
  3. Initialize theGAS = STARTGASAnd then remove some gas based on the gas required for each byte in the transaction.
  4. Transfer the amount of the transaction from the sender account to the recipient account. If the recipient account does not exist, a new one is created. If the recipient account is a contract, execute the code in the contract until execution is complete or all gas is consumed.
  5. If the amount transfer fails due to the sender’s insufficient balance, or if all gas is consumed before the contract code execution is complete, the status is reverted to before the transaction, but the transaction fee is not refunded and is added to the miner’s account.
  6. If the transaction is successful, the cost of the remaining gas is refunded to the sender and the cost of the gas consumed is paid to the miner.

For example, suppose the contract code is:

if! self.storage[calldataload(0)]: self.storage[calldataload(0)] = calldataload(32)Copy the code

Note

Typically, contract code is low-level EVM code. Serpent, used above, is a high language Serpent. Because it’s cleaner, and you can run it as EVM code.

Suppose the contract runs with empty storage, and a transaction is sent with an amount of 10, gas of 2000, gas price of 0.001 per ether, and 64 bytes of data (0 — 31 bytes for the number 2,32 — 63 bytes for the string CHARLIE). In this scenario, the process of state transformation function is as follows:

  1. Check whether the transaction is legal and the transaction format is correct
  2. Check if there is a transaction sent to2000 * 0.001 = 2The Ethernet balance of. If so, subtract 2 aether from the sender’s account
  3. Initialize gas to 2000; Assume that the length of the transaction is 170 bytes and the handling fee is 5 per byte. Subtract 850 from gas and you’re left with 1150
  4. Subtract 10 ether from the sender’s account balance and add 10 ether to the receiver’s account
  5. Run this code (the result of the code in this example is simple: check that the index in the store is2If there is no value in the store under the index, then it is assigned to a stringCHARLIE). If this code consumes 187 gas, then the remaining gas value is 1150-187 = 963
  6. return963 * 0.001 = 0.963The ether goes into the sender’s account and returns the status of the result.

If there is no contract on the receiving end of the transaction, the total transaction processing fee becomes simple: GASPRICE is multiplied by the length of the entire transaction in bytes to get the final transaction processing fee. And the data sent along with the transaction becomes irrelevant.


#5 Blockchain & Mining

The blockchain in Ethereum is roughly the same as bitcoin’s, but there are differences: Ethereum’s blockchain architecture is different from Bitcoin’s, and a copy of the list of transactions and the most recent status is kept in ethereum’s blockchain. In addition, the number of blocks in Ethereum and the difficulty of mining them are stored in the blockchain.

The basic block validation algorithms in Ethereum are as follows:

  1. Check that the last block referenced exists and is valid
  2. Check whether the timestamp of the current block is greater than the previous block and the difference is less than 15 minutes
  3. Check whether block numbers, difficulty, transaction roots, tertiary roots, and gas quotas (specific to some lower level Ethereum) are valid
  4. Check whether the POW is valid
  5. makeS[0]Is the final state of the previous block
  6. makeTXIs a list of n transactions contained in the block. for0... n-1All of theiAnd letS[i+1] = APPLY(S[i], TX[i]). If either application returns an error, or gas consumption exceeds the quota, an error is returned.
  7. makeS_FINALS[n]And then give the rewards to the miners.
  8. checkS_FINALWhether the root node in the Merkle Tree has the same state as the root node in the Merkle Tree as the last block in the current blockchain. If they are the same, then the block is valid.

Such an algorithm may seem inefficient, since each block needs to store information about all states. In Ethereum, however, the efficiency is comparable to that of the Bitcoin system, because all the state is stored in a tree structure, and each block only needs to change a small part of the tree. In general, the tree structure is roughly the same for two contiguous blocks. Thus, data can be stored only once, with multiple references achieved through Pointers (hash values of subtrees). In addition, since all the latest state information is stored in the last block of the blockchain, it is no longer necessary to keep the history of the entire blockchain — this strategy can save 5-20 times the storage space if applied to the Bitcoin system.


#6 Applications

Generally speaking, there are three types of Ethereum-based applications:

  1. Financial applications. It gives users a more powerful way to manage their money, and users can access some contracts with that money. Include sub-currencies, financial derivatives, hedging contracts, savings wallets, wills, and even some kinds of comprehensive employment contracts.
  2. Semi-financial applications. In these applications, the user’s money needs to be involved, but only a small part of the money is related, and more is not related to the money. For example, an application that forces a self-reward mechanism to solve computational problems. .
  3. Non-financial applications. For example, some go to central autonomous systems or online voting.

The paper also lists several distinctive applications: ** token systems, financial derivatives and stable value currencies, identity and credit systems, decentralised storage, decentralised autonomous organizations, etc. ** One of the more interesting is to go to the central autonomous organization, which will be elaborated below.

DAO

The concept of DAO (Decentralized Autonomous Organization) was first proposed in Oei Brafman’s book Starfish and Spiders published in 2007:

A spider is an example of a centralised tissue that would not survive if its head were cut off. Starfish are made up of a bunch of cells that are equal to each other (and have no center), and each tentacle they tear off can grow into a whole starfish.

The spider and starfish in this paper respectively map the centralized organization (most organizations in reality) and the decentralized organization. Blockchain-based technology allows this starfish to exist: a collection of smart contracts running on the Ethereum system that can perform organizational functions.

For today’s traditional companies or organizations, the hierarchical structure is usually top-down. For example, in joint-stock companies, the board of directors and the CEO are responsible for the overall operation and management of the company. The decisions of the average employee do not affect the entire company.

Decentralized autonomous organization, or decentralized autonomous company (DAC, Decentralized autonomous Company) the biggest difference between a traditional organization or company is that the company or organization is jointly owned and operated by all its members, instead of a single individual. A good example is Bitcoin, where the entire currency is maintained by all participating nodes without a centralized “central manager.” Any node in the network is equal, there is no superior or inferior power.

In such DAOs or DACs, the “rules” are usually written in code in smart contracts. These “rules” determine what the company or organization can do: whether it sells things, provides services, and so on. Also, the “rules” can be modified: as long as more than a certain number of people have voted and agreed, so the founder can modify the original written intelligent contracts (can understand adult people are members of the board of directors, everyone can participate in the decide the future of the company, at the same time, everyone needs to assume the risk of decision making).

Most importantly, the Ethereum system, or blockchain, does not define the function or domain of the organization or company, it only provides an economic incentive platform for the organization or company to build on. That is to say, just like a joint-stock company, blockchain just provides a platform to gain incentives and returns like the stock market, and the industry of the company depends on the participating shareholders (each node in the DAO/DACs).

Tom Ding explains in 2020: A Call for DApps and DAOs that this type of company is perfect for doing small, simple, repetitive tasks.

Each job on the network can be easily divided so that it can be verified programmatically or artificially, a process that is very difficult to manipulate.

This is because the company’s functions are determined by the contents of its smart contracts, which can be fully automated, with “people” taking responsibility for things that machines cannot: for example, revising the company’s goals or parts of its functions. Just like a fully automated unmanned store, the customer only needs to initiate a transaction in Ethereum to purchase a certain product, and the rest work is handed over to the smart contract to perform, and all the “human” needs to do is to modify the content of the product, etc. (in fact, it is similar to some e-commerce platforms such as Taobao and JINGdong).


Reading on the lotEthereum – White PaperSome notes on

  • Notes on ethereum White Paper (1) — Introduction to Bitcoin
  • Notes on the Ethereum White Paper (2) — Introduction to Ethereum. on
  • Notes on the Ethereum White Paper (3) — Introduction to Ethereum. Under the