Ethereum reentry case
a brief history of etheric Classics (etc)
etheric classics began with an unfortunate event
in May 2016, the decentralized autonomous organization (DAO) held a token sale with the goal of establishing a blockchain based venture capital to fund future decentralized applications (dapps) in the Ethereum ecosystem
basically, Dao is a complex smart contract that operates in a decentralized way - computer code that automatically performs tasks between multiple parties when conditions are met
despite its ambitious goals and successful token sales, Dao's code has a major vulnerability that allows attackers to steal eth from decentralized organizations
the attacker took advantage of this vulnerability in June 2016, triggering the infamous Dao hacking event, and maliciously stole eth worth about US $50 million
there is no doubt that Dao hacking has shocked Ethereum community and made eth price drop from $20 to $13
after the Dao hacking, the Ethereum community has to choose from three options
< UL >do nothing and try to bear the consequences of the attack
start soft bifurcation to recover funds
deploy a hard fork to recover the lost eth
both soft and hard bifurcations are significant network upgrades. However, soft fork allows users who are not upgraded to communicate with upgraded users, while hard fork is not backward compatible with previous versions
as developers realize that deploying soft forks will expose the network to distributed denial of service (DDoS) attacks, Ethereum community decides to initiate hard forks to recover the funds lost in Dao hacking attacks
although this scheme is supported by most people, a small number of people in Ethereum community oppose it. They think that "code is the law" and blockchain network should be unchangeable
the failure of both sides to reach an agreement on the solution eventually led to the fragmentation of Ethereum blockchain
those who tried to recover the lost eth chose the hard fork and opened the Ethereum (ETH) blockchain as we know it today, while another group stayed on the original Ethereum classic (etc) chain
what problems does ethereal classic solve
Ethernet classic (etc) is a blockchain platform that allows developers to deploy smart contracts and dapps
although this function is the same as Ethereum (ETH), etc blockchain has two main differences
first of all, Ethereum classic community opposes tampering with distributed ledger and supports the view that "blockchain network cannot and should not be modified"
secondly, although there is no rigid upper limit on the total supply of eth, it is allowed to create 230 million etc at most by adopting the monetary policy of constant supply
as a bonus item, ethereal classic launched Atlantis hard bifurcation last year to increase the interaction with Ethereum and improve the privacy protection of transactions through ZK snarks
the trading platforms recommended by ethereal classic etc are: Fire coin, okex, AAX, etc strong>
a total of 22 weeks, divided into five stages,
the first stage is 4 weeks, go language foundation and network concurrency, learning the introctory go language,
the second stage is 4 weeks, go language practical web development, crawler development, cryptography, consensus algorithm, realizing lightweight public chain, learning the website and crawler that can develop golang, Achieve lightweight blockchain
stage 3, 4-week Ethereum source code analysis and smart contract DAPP development, master Ethereum core and smart contract development, as well as blockchain,
stage 4, 4-week super ledger, bitcoin EOS, source code analysis and smart contract practice, master super ledger development, cat bitcoin, bifurcated EOS after learning, As well as DAPP development of smart contract
phase 5, 6-week project practice, five enterprise level projects, and one year of blockchain project experience after learning
from the characteristics of the language itself, go is a very efficient language, which highly supports concurrency. Go language itself pays more attention to distributed system, and concurrency processing is relatively good, such as advertising and search, That kind of high concurrency server
go language advantages:
excellent performance, can be directly compiled into machine code, does not rely on other libraries, go is extremely fast. Its performance is similar to Java or C + +
concurrency is supported at the language level, which is the biggest feature of go. It is born to support concurrency, and go is the concurrency supported in gene, which can make full use of multi-core and make it easy to use concurrency
the built-in runtime supports garbage collection, which is one of the features of dynamic language. Although GC is not perfect at present, it is enough to cope with most of the situations we can encounter, especially GC after go1.1
it's easy to learn. The authors of go language all have the gene of C, so go naturally has the gene of C. There are 25 go keywords, but the expressive ability is very strong. It almost supports most of the features you've seen in other languages: inheritance, overloading, object, etc
rich standard libraries, go has built a large number of libraries, especially the network library, which is also my favorite part< As like as two peas, br / > built-in powerful tools, Go language is built with many tools chain, the best should be gofmt tools, automatic formatting code, make team review become so simple, code format is exactly the same, it is very difficult to think differently.
cross platform compilation and fast compilation. Compared with the sluggish compilation speed of Java and C + +, the fast compilation time of go is a major efficiency advantage
disadvantages of go language:
package management: package management of go language is absolutely not perfect. By default, it has no way to make a specific version of the dependency library, nor can it create replicable builds. In contrast, python, node and Ruby all have better package management systems. However, with the right tools, the package management of go language can also perform well
lack of development framework: go language does not have a major framework, such as Ruby's rails framework, Python's Django framework or PHP's laravel. This is a heated discussion in the go language community, because many people think that we should not start with using frameworks. This is true in many cases, but if you just want to build a simple crud API, it's much easier to use Django / djrf, rails laravel, or Phoenix
exception handling: go language can help developers deal with compilation errors by simply returning errors (or call stack) through functions and expected calling codes. Although this method is effective, it is easy to lose the scope of the error, so it is difficult to provide meaningful error information to users. Error package can solve this problem by allowing us to add context and stack trace to return error
another problem is that we may forget to handle errors. Static analysis tools such as errcheck and megacheck can avoid these errors. Although these solutions are very effective, they may not be the right way.
some countries have shown great interest in the blockchain technology of decentralized data management framework to store public data. For example, essentia is developing an e-government project with the Central Union of agricultural procers and forest owners in Finland, The project will apply blockchain technology to enable urban and rural residents in Finland to query various records, fully meet the needs of residents and employers, and improve the employment rate. In addition, the use of this technology can also improve the efficiency of government operation, so that residents can easily query ecation, public records, voting and other information
waste recycling
for example, an intelligent waste management system in China adopts the RFID technology of waltonchain company. Using this blockchain application of waltonchain, it can effectively monitor the waste level, so as to improve the management and operation efficiency and resource optimization
identity recognition
chug, a Swiss city known as "encryption Valley", has developed an identity authentication system with its partner uport by using blockchain technology, through which citizens can participate in online voting and proof of residence
border control
essentia has been in contact with the Dutch government, hoping to use its blockchain technology to establish a set of border inspection system for the Dutch government to check passengers between Amsterdam and London. At present, passengers of Eurostar high-speed rail between the two countries need to undergo border control checks at multiple locations. Essentia is working on a blockchain based solution that will securely store passenger data so that inspection records from the Netherlands can also be reviewed by UK Border agencies. Blockchain technology will ensure that the data has not been tampered with and is verifiable and accurate
health care
as we all know, medical records are very scattered and prone to errors. Inconsistent data processing process will make hospitals and clinics often forced to deal with some incorrect or incomplete patient records. For example, Medrec, a blockchain electronic medical record system developed by MIT, uses blockchain technology to promote data sharing. At the same time, it can also provide authentication and confidentiality services
enterprise management
as enterprise customers of Microsoft azure applications, they can make use of blockchain as a service (baas), which will enable enterprises to access smart contracts and blockchain applications in a secure hosting environment. According to media reports, Google is also developing a proprietary blockchain project to support its cloud based business. And alpha, Google's parent company, is developing a distributed accounting project that third parties will be able to use to store data related to Google's cloud services
medical data
medical centers that digitize patient records do not store data among multiple devices. They usually store data on centralized servers, which has become the main target of hackers. The wannacry attack on NHS hospital in the UK proves this. But in addition, even if the security risk is ignored, there is still the problem of fragmentation. At present, there are more than 50 different electronic medical record systems (EHR) operating in hospitals in different cities around the world, and there are usually dozens of different medical application systems in the same city. These independent systems can't perform interoperation, and the data of patients in each hospital can only be distributed in different data storage centers
in the case of patients' life and death, the lack of reliable medical data contrast and slow operation efficiency will be fatal. Essentia's application framework solves all these problems by using blockchain based system, which will store all clinical data of patients, and can access these data immediately regardless of geographical boundaries. In this system, the patient's medical record privacy can also be protected, and only the authorized medical personnel can access it in a specific period of time
Music Proction
one of the main advantages of blockchain technology is that it eliminates unnecessary middlemen or middlemen. The music instry is a typical example. In this instry, if artists are inefficient, they will get very low remuneration. At this time, a number of blockchain based projects have emerged to seek a fairer trading and business environment for music creators, such as artbit, a former gunshot rose drummer Matt Soren as director
carbon compensation
as a highly instrialized country, China's environmental change is huge. In March 2017, IBM and energy blockchain labs jointly launched the hyperledger fabric blockchain project to discover China's carbon assets, which not only creates a measurable and auditable system for tracking carbon emissions, but also provides a tradable market for companies seeking to offset energy consumption and stimulate green instrial practice
supply chain management
supply chain management is considered to be one of the better cases of applying blockchain, because it is very suitable for the express delivery of such goods from delivery to receipt or the whole process from manufacturer to store. IBM and Wal Mart have jointly launched a blockchain food safety alliance in China. The project is also jointly operated with Jingdong company, aiming to improve food delivery tracking and safety assurance, so as to make it easier to trace food safety issues
facts have proved that China is a mature experimental base for blockchain projects, and it is also the location of the world's first blockchain for agricultural procts (5.180, - 0.25, - 4.60%). Louis Dreyfus Co, a world-famous food trader, has established a blockchain technology project in cooperation with Dutch and French banks. Using this project technology, the transaction settlement is faster than traditional methods in the process of selling soybeans to China
diamond instry
De Beers Group, the world's most famous diamond company, has its own blockchain company and has started operation. Its purpose is to "establish a digital record for every diamond registered on the platform". Considering the origin of diamonds, the ethical standards of origin, and the risk of diamond quality, blockchain technology is a good choice, because every record of it is indelible, and it will ensure that the electronic data of each diamond is as permanent as itself
real estate transactions
currently, Ukraine is the first country to use blockchain technology to promote property transactions. Michael Arlington, the founder of techcrunch, a famous technology website and cryptocurrency player, remotely purchased and resold a real estate in Kiev through the smart contract of Ethereum blockchain. This transaction was completed by propy, a start-up company specializing in blockchain real estate transactions
fisheries
blockchain technology is now being used to support the development of sustainable fisheries. Illegal fishing is a common problem in this instry. The distributed ledger technology of blockchain provides a proof of the capture source, processing and sale mode. This "net to table" supply chain allows inspectors to determine whether the fish caught came from a human rights violation area or from a country affected by economic sanctions
art paintings
similar to diamond trading, the art instry relies on the provenance and authenticity of art works. Although the blockchain cannot identify whether a painting is an original or a fake, it can be used to prove the identity of the previous owner of the painting. In addition, blockchain technology is now also used as a means to obtain works of art. It can make tangible goods easily traded and exchanged anywhere in the world without physical transfer from a secure storage place
public facilities
in Freemantle, Australia, a project dedicated to distributed energy and water system management is using blockchain technology, and solar panels (3.340, - 0.06, - 1.76%) are being used in sunny areas to obtain electricity, which is then used to heat water and provide electricity, All these energy conversion and use information will be recorded in the blockchain data
in Chile, the National Energy Commission has started to use the blockchain technology as the verification of the country's energy use data, and some sensitive data will be stored in the blockchain. The application of this technology can be regarded as a means for the modernization and safe operation of power infrastructure in this South American country
LGBT rights
blockchain can help build a "pink economy" and help LGBT communities fight for their own rights without revealing people's identities. This is an extremely important issue, because crimes of discrimination against homosexual groups often occur, especially in countries notorious for human rights violations, Homosexuality is illegal, or at least not allowed
catastrophe bonds
catastrophe bonds may be the only hope for victims of earthquakes, tsunamis and other natural disasters. Blockchain allows fast and transparent reconciliation between the parties, and can ensure that the system can continue to operate normally even under unmanned operation. Now, blockchain has been successfully used in the settlement mechanism of catastrophe bonds
tourism
local institutions in Hawaii are studying how to use blockchain technology to improve the economy, such as opening bitcoin and other monetary payment means to facilitate tourists' transaction of local goods and services. In this way, the Hawaiian government hopes to attract tourists, especially those from Asia, to spend more money in the local area and improve the economic development of Hawaii
homeland security
in 2016, the US Department of Homeland Security (DHS) announced a project that will use blockchain technology as a means of secure storage and capture of data transmission. DHS uses Factom's blockchain technology to encrypt and store data captured by security cameras and other sensors. The application of this blockchain technology will greatly rece the risk of data leakage. At present, the project is still in progress
maritime transportation
it is self-evident that blockchain is used to record ship transportation data. At present, some local shipping projects have adopted distributed ledger technology. In the maritime logistics instry, blockchain technology can make the inevitable cumbersome management proceres in international trade more transparent and orderly. Maersk, one of the world's largest shippers, is a pioneer in the use of blockchain. Today, Yixing international shipping company Zim has also made follow-up use of blockchain technology.
EOS is a public chain system at the bottom of blockchain developed by block. One, which is specially designed to support decentralized application of Commerce, and its code is open source
bitcoin is called blockchain 1.0 because it opens up the world of digital cryptocurrency and takes a decisive step from 0 to 1
Ethereum is known as blockchain 2.0, because it provides Turing complete virtual machine that can run smart contracts, bringing unlimited possibilities
and EOS is called blockchain 3.0, why? Two words: performance
The positioning of EOS is the slogan of its home page:English: the most powerful infrastructure for decentralized applications
Chinese: the most powerful decentralized application infrastructure
EOS expects to be an enhanced version of Ethereum, a high-throughput intelligent contract platform
although Ethereum has complete functions, it is limited by its design choice. Due to the block output speed of 15 seconds, the transaction throughput is far from large-scale practical level, which is only about 30 ~ 40tps (transaction / s). EOS, on the other hand, has chosen a different technology route, with the goal of achieving a considerable million TPS, which is quite attractive considering visa's actual processing speed of 1700tps
consensus mechanism of EOS
the reason why the throughput of bitcoin and Ethereum is so low is that they are constrained by the application scenario they envision and the consensus mechanism they choose for the scenario - both of them assume that the environment in which the system runs is totally untrustworthy, so they both adopt the consensus mechanism of proof of work
consensus, as the name suggests, is to reach a unified understanding of something - for blockchain, something refers to the confirmation of the transaction - any node to submit a transaction needs everyone's approval
the pow mechanism currently adopted by bitcoin and Ethereum is the design of the legendary Nakamoto Tsung. Under this mechanism, in order to obtain the bookkeeping right and digital currency reward, miners need to constantly dig for the compliant hash value, and confirm and package the transaction data through the consensus of hash value. POW has no access threshold, and any node has equal rights to participate in bookkeeping. Of course, the probability of winning is related to computing power:
the price of ram is based on Bancor algorithm, that is, it is regulated by market supply and demand: if the supply of ram exceeds the demand, more EOS certificates are needed to buy ram, At this time, more EOS certificates can be obtained by selling ram
memory is a consuming resource, which cannot be redeemed and can only be bought and sold. Take the issue of currency on EOS as an example. At present, the issue of currency requires 20m of memory. An EOS can buy 20KB. According to the current storage price, issuing a currency will consume 1000 EOS. This is the source of EOS memory consumption
Course Overview
this course is for friends who are interested in the development of EOS decentralized application. The course covers the core concepts of EOS DAPP development, the development and deployment of smart contracts, and how the front page interacts with EOS blockchain. Finally, a complete DAPP development based on react and EOS is completed
Chapter 1: enter the world of EOS
to understand the core concepts of EOS, such as positioning and characteristics, consensus mechanism, payment computing model, etc
Chapter 2: Hi EOS
understand the overall framework of EOS node software and the functions of node server, wallet server and command-line tools, learn how to configure and start EOS node server and wallet server, and preliminarily understand the use of command-line tools
Chapter 3: wallet, key and account
understand the three core concepts related to personal identity in EOS: wallet, key and account, and learn how to use command-line tools to create wallet, key and account
Chapter 4: development and interaction of smart contracts
understand the concept and function of smart contracts, learn how to write and compile EOS smart contracts, and learn how to deploy and interact with contracts using command-line tools
understand the persistence mechanism of state in EOS smart contract, and learn to use multi index table to save contract state
Chapter 5: issue your own tokens
learn the principle and implementation mechanism of issuing tokens on EOS, and master how to use command-line tools to issue, transfer and view the balance of tokens through practical operation
Chapter 6: use code to interact with smart contract
understand the principle of interaction between application and EOS blockchain, and learn to use JSON RPC interface and eosjs encapsulation library to access EOS blockchain
Chapter 7: DAPP development of practical notes
comprehensively use EOS knowledge, use react to complete a decentralized application of EOS notes, and learn the complete process from requirement analysis to code implementation
The above course address is as follows: EOS tutorial1. Power consumption: 243w; Calculation force: 22.4m; Price: 1999 yuan; The number of eth g every 24 hours: 0.015; Revenue generated every 24 hours: 24.8 yuan; Expected payback time: 81.66 days
2. Power consumption of the whole machine: 159w; Calculation force: 24.3m; Price: 1599 yuan; Number of eth g every 24 hours: 0.017; Revenue generated every 24 hours: 27.9 yuan; Expected payback time: 57.31 days
3. Power consumption: 171w; Calculation force: 24.4m; Revenue generated every 24 hours: 27.87 yuan; Expected payback time: 71.73 days
4. Power consumption: 97W; Calculation force: 9.2; Price: 999 yuan; Number of eth g every 24 hours: 0.006; Revenue generated every 24 hours: 10.09 yuan; Expected payback time: 99.1 days
extended data
mining machine risk
1. The problem of electricity charge
in order to make the graphics card full load for a long time, the power consumption will be quite high, and the electricity charge will be higher and higher. Many professional mines at home and abroad are operated in areas with extremely low electricity charges, such as hydropower stations, while more users can only mine at home or in ordinary mines, so the electricity charges are not cheap. Even in a certain residential area in Yunnan, there was a case of crazy mining, which led to a large area trip of the residential area, and the transformer was burned
2. Hardware expenditure
mining is actually a competition of performance and equipment. Some mining machines are composed of more such graphics card arrays. With dozens or even hundreds of graphics cards, the cost of hardware and other costs is very high, and there is a considerable expenditure in mining
3, currency security
the withdrawal of bitcoin requires hundreds of keys, and most people will record this long string of numbers on the computer, but the frequent problems such as hard disk damage will make the key permanently lost, which also leads to the loss of bitcoin
