Blockchain QuickStart (eight)--Ethereum

Source: Internet
Author: User

Tags: stateful problem root GUI prevents lib Ruby img Rip

Blockchain QuickStart (eight)--Ethereum, Ethereum Introduction

The initial goal of the Ethereum (Ethereum) project is to create a platform for running smart contracts (Platform for Smart contract), supporting Turing-complete applications that are automatically executed in accordance with the contract logic of the smart contract, ideally without downtime, censorship, Issues such as fraud and third-party intervention.
Ethereum platform currently supports Golang, C + +, Python and other languages implementation of the client. Due to the core implementation of the core based on the Bitcoin network to expand the idea, so many design features are very similar to the Bitcoin network.
Based on the Ethereum project, the Ethereum team currently operates an open blockchain platform-the Ethereum network. Smart contract developers can easily develop a solidity application (decentralized Application,dapp) running on the Ethereum network using the official tools and the Ethereum dedicated application development language. The Dapp application will run in the Ethereum virtual machine (Ethereum Vsan MACHINE,EVM). Users purchase fuel through the etheric currency (ether)
(gas) To maintain the operation of the deployed application.
Ethereum Project official website: www.ethereum.org
Ethereum Project Code hosting: Www.github.com/ethereum
The basement of the Ethereum blockchain is also a peer network platform, where smart contracts run in the ether of the network.
Virtual machines in the square. The network itself is publicly accessible, and anyone can access and participate in the maintenance of data in the network, providing the resources to run the Ethereum virtual machine.
The technical features of the Ethereum blockchain include:
A, support Turing complete intelligent contract, designed the programming language solidity and virtual machine EVM
B, the use of high memory requirements of the hash function, to avoid the emergence of strong mining machine, Ore pool * * *
C, tertiary block (Uncle block) excitation mechanism, reduce the advantages of the pool and reduce the interval of the block generation
D, using the account system and the world state, rather than utxo, easy to support more complex logic
E. Limit code execution instructions by gas to avoid cyclic execution * * *
F. Support the POW consensus algorithm and plan to support more efficient POS algorithms
In addition, the development team plans to address network scalability issues through Sharding (sharding).

Second, Ethereum core concept 1, Smart contract

The Smart Contract (Smart contract) is the most important concept in Ethereum, which is to conclude and run various contracts in a computer program. Ethereum supports the development of smart contracts through a fully Turing high-level language, including solidity, serpent, and Viper.
As an application running in an Ethereum virtual machine (Ethereum virual MACHINE,EVM), a smart contract can accept external transaction requests and events, further generate new transactions and events by triggering the execution of pre-written code logic, and further invoke other smart contracts.
The results of the smart contract execution may update the status of the ledger on the Ethereum network. Changes to the state of the ledger will not be forged or tampered with once it has been confirmed by consensus in the Ethereum network.

2. Account

Ethereum uses the account directly to record system status. Each account stores balance information, smart contract code, and internal data storage. Ethereum supports the transfer of data between different accounts to achieve more complex logic.
There are two types of Ethereum accounts: Contract accounts (contracts Accounts) and external accounts (externally owned ACCOUNTS,EOA).
Contract Account: The smart contract code that is stored for execution can only be invoked by an external account to activate.
External Account: The Aether owner account, corresponding to a public key. Accounts include nonce, balance,
Storageroot, Codehash and other fields are controlled by individuals.
When a contract account is called, the smart contract stored in it is automatically executed in the miner's virtual machine and consumes a certain amount of fuel. The fuel is purchased through the etheric currency in the external account.

3. Trading

Trading (Transaction), in Ethereum, refers to the message data from one account to another. The message data can be either etheric currency or contract execution parameters.
Ethereum uses trading as the smallest unit of execution. Each transaction includes the following fields:
To: Destination account address.
Value: You can specify the number of etheric coins to transfer.
Nonce: A transaction-related string used to prevent a transaction from being replayed.
Gasprice: The gas price to be consumed in executing the transaction.
Startgas: The maximum gas value of the transaction consumption.
Signature: Signature information.
When sending a transaction, the user is required to pay a certain amount of the transaction fee, through the way of the ether currency payment
and consumption. Currently, the Ethereum network can support trading speeds exceeding the Bitcoin network (up to dozens of strokes per second).

4. Etheric currency

The etheric currency (ether) is the currency of the Ethereum network.
The etheric currency is mainly used for the purchase of fuel, paid to miners, in order to maintain the Ethereum network operation of the smart contract costs. The smallest unit of the etheric currency is Wei, and an etheric currency equals 10^18 wei.
Ether coins can be mined to generate, and the Ethereum miners who successfully generate new blocks can receive 5 of the Ethereum rewards and the fuel costs involved in trading in chunks. Users can also purchase the etheric currency directly from the trading market.
At present, more than 10 million etheric coins can be generated by mining each year, and the market price of a single ethereum is currently more than $200.

5. Fuel

Fuel (gas), which controls the upper limit of the execution order of a trade. Each execution of a contract instruction consumes a fixed fuel. When a transaction has not finished executing and the fuel consumption is exhausted, the contract execution terminates and rolls back.
Gas can be exchanged with the etheric currency. The price of the etheric currency is volatile, but running a smart contract
The fuel costs can be fixed, by setting gas prices and other adjustments.

Third, Ethereum main design 1, intelligent contract

Ethereum uses Ethereum virtual machines (EVM) as the operating environment for smart contracts. An Ethereum virtual machine is an isolated, lightweight virtual machine environment in which smart contract code cannot access a local network, file system, or other process.
For the same smart contract, it is often necessary to run multiple parts simultaneously in several ethereum virtual machines to ensure consistency and high fault tolerance across the blockchain data, but also limit the capacity of the entire network.
Ethereum has designed a full-fledged, high-level programming language to write smart contracts, reducing the difficulty of developing smart contracts. Currently solidity is one of the most commonly used Ethereum contract authoring languages. After the smart contract is written, the compiler compiles the binary format (EVM bytecode) dedicated to the Ethereum virtual machine, which is uploaded by the client to the blockchain and executed in the miner's Ethereum virtual machine.

2. Trading Model

Ethereum uses the model of the account, the status can be saved in real-time to the account, without the Uxto model like Bitcoin to retrace the entire trading history.

3. Consensus

Ethereum currently uses a Variant algorithm Ethash protocol based on the proven POW consensus as a consensus mechanism.
In order to prevent the calculation of the ore pool of ASIC mine, it is different from the computation-intensive hash operation of the original POW, and the ethash needs to consume a lot of memory when executing, but it has little relation with computational efficiency. Therefore, it is difficult to create a chip specifically for Ethash, but the general machine may be more effective.
Although Ethash has been improved relative to the original POW, it still requires a lot of invalid operations, and the Ethereum network community has plans to adopt more efficient Proof-of-stake (POS) as a consensus mechanism in the future.

4, Reduce * * *

Transactions in the Ethereum network are more diversified and more susceptible to * * *.
The core design idea of Ethereum network in reducing the * * * is still to prevent the minority from doing evil through economic incentive mechanism:
A, all transactions are to provide transaction costs, to avoid ddos***
B, the number of programs run by gas to limit, the cost of more than the set limit will be canceled, to avoid malicious contracts.
Make sure that the person who tries to consume the computing resources of the virtual machines in the network has to pay an economic price (to pay a large amount of ethereum), and it is difficult to damage the network by constructing malicious loops or unstable contract code.

5, improve the scalability

Scalability is the biggest constraint on the Ethernet network undertaking more traffic.
The Ethereum project hopes to improve the scalability of the entire network through the fragmentation (sharding) mechanism in the future. A shard is a set of sub-networks of nodes that maintain and execute the same batch of smart contracts, and are a subset of the entire network.
Before the Shard function is supported, every node in the Ethereum network needs to handle all the smart contracts, resulting in a maximum processing power of the network constrained by the processing power of a single node. After fragmentation, the same piece of contract processing is synchronous, mutual agreement, the different shards can be asynchronous, can improve the overall scalability of the network.

Four, Ethereum related tools 1, client and development library

Ethereum client can be used to access the Ethereum network for account management, trading, mining, smart contracts and other aspects of operation.
The Ethereum community now offers a variety of languages to implement the client and Development library, supporting the standard JSON-RPC protocol. Users can choose according to their familiar development language.
Go-ethereum:go Language Implementation
Parity:rust Language Implementation
Cpp-ethereum:c++ Language Implementation
Ethereumjs-lib:javascript Language Implementation
Ethereum (J): Java language implementation
Ethereumh:haskell Language Implementation
Pyethapp:python Language Implementation
Ruby-ethereum:ruby Language Implementation
Go-ethereum's standalone client geth is one of the most commonly used Ethereum clients. The user can install Geth to access the Ethereum network and become a full node. Geth can also be used as a HTTP-RPC server, exposing JSON-RPC interfaces externally, for users to interact with the Ethereum network.
The use of Geth requires basic command-line basis, its function is relatively complete, the source is hosted in Github.com/ethereum/go-ethereum

2. Ethereum Wallet

For users who need basic operations such as account management, Ethereum transfer, Dapp usage, you can choose an intuitive and easy-to-use wallet client.
Mist is an official set of wallet clients with graphical interfaces, in addition to being available for trading, and also supports the direct authoring and deployment of smart contracts.
After the code compiled is published, it can be deployed to the blockchain. A consumer can execute a smart contract by sending a transaction that invokes the corresponding contract method.

3. Ethereum Development IDE

For developers, the Ethereum community has sprung up with many Ides that serve to write smart contracts and Dapp, such as:
Truffle: A feature-rich ethereum application development environment
Embark: A DAPP development framework that supports integration of Ethereum, IPFs, etc.
Remix: An IDE for writing solidity, built-in debugger and test environment

Blockchain QuickStart (eight)--Ethereum

Related Keywords:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: