Single thread package Ethereum
although the pow mining mechanism is adopted, the block out mechanism of Ethereum is different from that of bitcoin. Due to the short block time of Ethereum, Ethereum is easy to form isolated blocks. Isolated blocks refer to the blocks that are not on the longest chain. Bitcoin's isolated blocks have no block rewards, but in Ethereum, isolated blocks can be referenced. The referenced isolated blocks are called "Uncle blocks", and their packaged data will also be recorded in the blockchain. Unlike bitcoin, Ethereum's TERT block has a reward, and each TERT block can get a reward of 4.375 Ethernet coins at most
Ethereum is a programmable and Turing complete blockchain development platform, which is equivalent to a decentralized global computer. In a programming system, there are usually some virtual machines to compile and execute. Java has JVM. In Ethereum, there is also Ethereum's virtual machine EVM, which can execute any complex algorithm code. Developers can use existing programming languages such as JavaScript or Python to create their own applications on Ethereum. Through Ethereum's virtual machine, you can easily issue digital assets, write smart contracts, set up and run decentralized applications, and set up decentralized autonomous organizations
eth is also known as the internal fuel of Ethereum. Unlike currency digital assets, Ethereum is not only used for transfer, but also for payment of smart contracts
in order to prevent the Ethereum blockchain from being full of junk contracts and junk applications, and to establish and run smart contracts on Ethereum, you must use eth to pay for smart contracts. For example, when you transfer your newly created digital assets on the Ethereum blockchain, you need to use eth to pay the handling fee instead of your newly created digital assets.
& quot; A smart contract is a set of promises defined in digital form, including the agreements on which the contract participants can execute these promises& quot;
let's explore the meaning of his definition in more detail
commitment
a set of commitments refers to the (often mutual) rights and obligations agreed by contract participants. These commitments define the nature and purpose of the contract. Take a sales contract as a typical example. The seller promises to deliver the goods and the buyer promises to pay a reasonable price
digital form
digital form means that contracts have to be written into computer-readable code. This is necessary, because as long as the participants reach an agreement, the rights and obligations of smart contract establishment are executed by a computer or computer network
to further explain:
(1) when will the parties to the smart contract reach an agreement? The answer depends on the specific smart contract implementation. Generally speaking, the contract is discovered when the parties are committed to the execution of the contract by installing the contract on the contract host platform< (2) contract execution
& quot; Execute & quot; And the real meaning of it also depends on implementation. Generally speaking, implementation means active implementation through technical means
(3) computer readable code
in addition, the contract needs specific & quot; Digital form & quot; Very much depends on the agreement that the parties agree to use
protocol
protocol is technical implementation, on this basis, the contract commitment is realized, or the contract commitment is recorded. Which agreement to choose depends on many factors, the most important of which is the nature of the assets being traded ring the performance of the contract
take the sales contract as an example. Suppose that the participants agree to pay in bitcoin. The chosen protocol will obviously be bitcoin protocol, on which the smart contract will be implemented. Therefore, the contract must use & quot; Digital form & quot; It's bitcoin scripting language. Bitcoin scripting language is a non Turing complete, imperative, stack based programming language, similar to forth.
Ethereum miner fee
1. In a public chain, anyone can read and write data. Reading data is free, but writing data to the public chain costs a certain amount of money, which helps to prevent junk content and protect its security through payment
Secondly, any node on the network (each connected device containing a of the account book is called a node) can participate in the mining method to protect the network. As mining requires computing power and electricity charges, miners need to be paid for their services, which is also the origin of miners' fees Third, the difference between Ethereum and bitcoin, Ethereum introces the concept of gas, the purpose of which is to limit the amount of work required to execute the transaction and pay for the execution. Gas is used to measure the resources (including computation, storage, bandwidth, etc.) consumed by your transaction (or contract code call)
extended data:
ten rights of miners:
1. The "ten rights" of coal mining enterprise workers in safe proction include: the shift leader does not go down the well, and the workers have the right not to go down the well; The workers have the right to leave the well early if the shift leader leaves the well early; Workers have the right not to work if potential safety hazards are not investigated; If the management personnel command against rules and regulations, the workers have the right not to carry out them
Without safety measures, workers have the right not to start work; Workers have the right not to go down the well if they don't organize safety study before class; If the "Trinity" (monitor, safety inspector and gas inspector) safety inspection is not carried out, workers have the right not to start work The workers have the right not to start the work if the detection and monitoring system is not installed in place and operates abnormally; Workers have the right not to go down the well if they are not equipped with fully qualified labor protection and protective equipment; The route to avoid disaster is not marked, and workers have the right not to go down the well. The coal mine shall not dect the wages and dismiss the workers for the above reasonseth0 to awk for processing
where - F & # 39;:|< br />+'
this is a separator defined by awk and then matched with "BCAST & quot;, Take the content of the fourth column
since your command is not universal, you can't output the result here, but you should intercept the broadcast address
let's talk about the problem of high concurrency. High concurrency is a problem in the computer field. In short, the problem of high concurrency is that the system cannot run multiple tasks at the same time smoothly
many tasks are running at the same time, and a large number of users rush in. The system can't bear so many tasks. There will be high concurrency problems, and your system will be stuck, just like the 12306 system is always stuck ring the Spring Festival, which may be caused by the high concurrency problems
the traditional Internet still has the problem of high concurrency, which naturally exists in the blockchain network. After all, the maturity of the blockchain is still far behind that of the traditional Internet. However, if there is no safe, reliable and efficient public chain, the development of the whole blockchain instry will be seriously restricted, and the application landing is empty talk
in this context, DAG technology has been proposed, DAG's full name is "directed acyclic graph", which is translated into "directed acyclic graph" in Chinese
What's the matter with DAG directed acyclic graph and what role it can play? Let's explain< Dag: a new data structure
DAG, Chinese name is "directed acyclic graph", literally, "directed & quot; That is to say, it has direction,
"no loop" means that it has no loop and cannot form a closed loop. Therefore, DAG is actually a new type of data structure. This data structure has direction and can not form a closed loop
in terms of traditional blocks, we always take "block" as the unit, and a block often contains multiple transaction information. In DAG, there is no concept of block. Instead, it takes "unit" as the unit. Each unit records the transaction of a single user. The unit is not a block, but a transaction. In this way, the time of packing blocks can be saved
in short, the biggest difference between blockchain and DAG directed acyclic graph is that blockchain is one block after another to store and verify the distributed ledger of transactions, while DAG regards each transaction as a block, and each transaction can be linked to multiple previous transactions for verification< Second, the working principle of DAG
in the traditional blockchain, take bitcoin as an example, it is a single chain structure. The blocks are arranged according to the time stamp sequence (as shown in Figure 1), and the data is recorded on a main chain. To use an inappropriate metaphor, this "single chain" structure is a chain arranged word by word
there is only one single chain in the blockchain, so it can not be executed concurrently when the block is packaged. The new block will be added to the original longest chain, and all nodes will follow the longest chain and continue to spread infinitely in the order of timestamp. For DAG, each newly added unit is not only added to one unit of the longest chain, but also to all previous units (as shown in Figure 2)
for example: suppose I publish a new transaction, and there are two effective transaction units in DAG structure, then my transaction unit will actively link to the previous two at the same time to verify and confirm until it is linked to Genesis unit, and the hash of the previous unit will be included in its own unit
in other words, if you want to make a transaction, you have to verify the previous transaction, specifically several transactions, according to different rules. This verification method enables DAG to write many transactions asynchronously and concurrently, and finally forms a topological tree structure, which greatly improves the scalability
according to DAG directed acyclic graph, every transaction is directly involved in the maintenance of the whole network. When the transaction is initiated, the whole network is broadcast directly, skipping the block packing stage. In this way, the time of block packing is saved, and the transaction processing efficiency of the blockchain is improved
with the increase of time, the blockchains of all transactions are interconnected to form a graph structure. If you want to change the data, it is not just the problem of several blocks, but the data change of the whole block diagram. Dag is more complex and difficult to change
to sum up, DAG, as a new type of decentralized data structure, belongs to a kind of generalized blockchain and has the attribute of decentralization. However, the differences between the two are as follows:
the composition unit of blockchain is block and the composition unit of DAG is TX
blockchain is single threaded, DAG is multi-threaded
all transactions of blockchain are recorded in the same block, and each transaction of DAG is recorded in each transaction separately
blockchain needs miners, DAG doesn't need miners< (3) representative of DAG: iota is undoubtedly the most famous representative project of DAG. It can be said that it is precisely because iota, the currency, broke into the fourth place in market value in the second half of 2017 that people really realized its underlying technology: DAG directed acyclic graph
iota puts forward the concept of "entanglement" on the basis of DAG directed acyclic graph. In iota, there is no concept of block, and the minimum unit of consensus is transaction. Each transaction will refer to the past two transaction records hash, so that the previous transaction will prove the legitimacy of the past two transactions and indirectly prove the legitimacy of all previous transactions. In this way, a small number of nodes such as miners in the traditional blockchain are no longer needed to verify transactions and package blocks, so as to improve efficiency and save transaction costs< Fourth, the current situation of DAG
although DAG directed acyclic graph can make up for some disadvantages of traditional blockchain in theory, it is not mature at present, and it has been applied to the field of digital currency for a short time
it did not take as long as 10 years to verify the security of the whole system as bitcoin did, nor did it achieve a wide range of application scenarios as Ethereum did. However, some voices now propose to adopt the data structure of "traditional blockchain + DAG", but there is no outstanding case, so I won't say more here
to sum up, in this section, we introce the derivative technology of blockchain: DAG directed acyclic graph, which is a new data structure, and can significantly improve the efficiency and power of blockchain transaction processing.
& gt; eth.estimateGas({ from:eth.accounts [1], to: eth.accounts[2], value:50000000000000 })
21001
> Eth. Gasprice
2000000000
as above, the account [1] = & gt; The transaction of account [2] needs 21001 gas, and the current gasprice is 2000000000. Let's verify that
unlock account 1, send this transaction, and start mining packaging