Position: Home page » Ethereum » Introduction to Ethereum private chain and smart contract deploy

Introduction to Ethereum private chain and smart contract deploy

Publish: 2021-05-27 23:48:11
1.

what is Ethereum:

Ethereum is an innovation based on the application of technologies and concepts in bitcoin to computers. Ethereum itself imitates a lot of bitcoin technology to maintain the computer platform. blockchain technology is one of them
Ethereum platform can safely run any program users want

advantages of Ethereum over other competitive currencies before Ethereum appeared, some digital currencies imitated bitcoin. However, these projects have their own shortcomings, they can only support one or several specific applications at the same time< However, the reason why Ethereum can surpass the limitations of these projects in the past is because of the core idea of Ethereum

what Ethereum wants to implement is a blockchain protocol with built-in programming language. Since it supports programming language, in theory, any blockchain application can be defined with this language, and then run on Ethereum's blockchain protocol as an application

The design of Ethereum is very flexible and adaptable

Ethereum target sets the advantages of blockchain technology, in order to add the advantages of blockchain, such as decentralization, openness and security, to almost all computing fields

blockchain applications of Ethereum

Ethereum has many blockchain applications, such as digital applications of gold and stocks, financial derivatives applications, DNS and digital authentication, etc

Ethereum has achieved more than 100 blockchain applications by many start-ups

Ethereum has also been closely watched by some financial institutions, banking consortia (such as R3), as well as large companies like Samsung, Deloitte, RWE and IBM. As a result, a number of blockchain applications such as simplified and automated financial transactions, merchant loyalty index tracking, and gift cards designed to achieve decentralization of electronic transactions have emerged

the relationship between Ethereum and blockchain:

Ethereum is a programmable blockchain

Ethereum does not give users a series of preset operations (such as bitcoin transaction), but allows users to create complex operations according to their own wishes

in this way, Ethereum can be used as a platform for various types of decentralized blockchain applications, including but not limited to cryptocurrency

like other blockchains, Ethereum also has a peer-to-peer network protocol. Ethereum blockchain database is maintained and updated by many nodes connected to the network. Each network node runs the Ethereum simulator and executes the same instructions. Therefore, people sometimes call Ethereum "world computer"

2. Smart contract & quot The term "smart contract" can be traced back to at least 1995 and was proposed by the prolific interdisciplinary legal scholar Nick Szabo. He mentioned the concept of smart contract in several articles published on his website. His definition is as follows:
& 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.
3. Go full stack + blockchain course:
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.
4. Do you want to learn blockchain development technology or just want to know what blockchain is? If it is the former, you can look at the code of other blockchain projects and learn about it first. If it is the latter, we can pay attention to some good blockchain we media. Blockchain is an emerging instry. There is no ready-made training course. It depends on self exploration and understanding.
5. < UL >
  • the first stage: the basic theory of blockchain technology is suitable for students who have various needs for blockchain technology. It is the most comprehensive and up-to-date curriculum system at present. With the rapid appreciation of bitcoin, blockchain technology has become more and more sought after and studied by people from all walks of life, Or from the perspective of technology research and development, this set of courses are very suitable for you to download and learn. Schele: Lesson 1 ICO & amp; EOS understands the risks of ICO and ICO projects, How to judge whether an ICO is reliable lesson 2 the past and present of bitcoin blockchain understand the origin and related background knowledge of bitcoin and blockchain lesson 3 cryptography master the necessary knowledge of blockchain related cryptography lesson 4 bitcoin transaction in-depth discussion of what happened behind bitcoin transaction lesson 5 block generation and link in-depth discussion of how blockchain is generated Lesson 6 bifurcation principle of blockchain and how to operate the coins in hand before and after the bifurcation Lesson 7 how does the wallet know how much money I have and how to hold the coins in hand more safely Lesson 8 mining understanding the history and principle of mining, Experience mining in bitcoin regression test environment Lesson 9 blockchain security, understand the security problems of blockchain, how to "steal" other people's money Lesson 10 smart contract learn the principle of blockchain 2.0 smart contract, understand how the smart contract is written and run

  • 2

    stage 2: introction to blockchain technology research and development, Blockchain technology is a very popular new technology at present, which is highly praised by large IT companies and experts all over the world. Not long ago, the blockchain technology platform enterprise Ethereum Alliance (EEA) announced its formal establishment, and nearly 30 giants including JPMorgan Chase, Microsoft and Intel joined in. Extremely optimistic about the future of Ethereum. At present, the term blockchain is very popular, but few people really understand blockchain technology. If you no longer want to be a onlooker, you are welcome to learn this course. After learning this course, you can master the following contents: deeply master the blockchain technology, understand what mining is, learn how to build your own blockchain network, how to publish your own applications on your own blockchain network or enterprise Ethernet network, and how to write smart contracts, Blockchain technology applications. This course is based on practical teaching, mainly teaching front-line practical skills, to ensure that students can quickly learn to apply! Timetable: 1. Introction to blockchain 1.1 introction to blockchain technology 1.2 blockchain platform, Ethereum, an open source blockchain technology platform 1.3 Ethereum working principle, Ethereum virtual machine, account 1.4 what can Ethereum do, Blockchain technology application appreciation 1.5 Ethereum white paper 2. Client installation and operation 2.1 client installation 2.2 Ethereum account creation and management 2.3 multi signature account 2.4 Ethereum 3. Ethereum network 3.1 Ethernet network type 3.2 building local private network, User defined Genesis block 3.3 mining on local private network 4. Introction to smart contract programming 4.1 Ethereum multiple private nodes networking 4.2 multiple nodes, Introction to writing, deploying and using smart contracts 4.3 introction to development language solidy 4.4 introction to building development environment 4.5 basic variable types 5.solidy complex variable types 5.1 enumeration 5.2 structure 5.3 mapping 5.4 delete 5.5 common attributes and methods of block and transaction 6.solidy method 6.1 anonymous method 6.2 modifier 7.solidy inheritance and event 8.solidid Y programming practice 8.1 smart contract -- "vote" 9.solidy programming practice 9.1 smart contract -- "create your own token" 9.2 smart contract -- "public auction" 10.decentralized application DAPP project practice 10.1 Ethereum Web3 interface 10.2 building Ethereum online wallet 10.3 building the development framework of truss on Windows

  • 3

    Level 3 In addition to video tutorials, we have also collected a number of classic e-books for students to learn and understand the knowledge of blockchain technology. These e-books are expensive, and published relatively new, reading format is very rich, not just PDF kind, suitable for mobile phone installation of common reading software. Lesson schele: 1. How blockchain will redefine the world; 2. Blockchain Society: decoding global application and investment cases of blockchain; 3. Blockchain Revolution: how bitcoin underlying technology changes currency, technology and technology Business and the world 4. Blockchain: from digital currency to credit society 5. Blockchain: technology driven finance 6. Blockchain: Reshaping economy and the world 7. Illustrated blockchain 8. The age of artificial intelligence, A book reads block chain finance "(Internet plus era enterprise management real battle Series) 9." block chain technology guide "10." block chain: define the new pattern of future finance and economy "11." business block chain: open a new era of encryption economy "12." Accenture ":" block chain + "13." bitcoin "

  • 6. Ethereum is a distributed computing platform. It generates an cryptocurrency called ether. Programmers can write "smart contracts" on the Ethereum blockchain, and these Ethereum smart contracts will be executed automatically according to the code

    what is Ethereum
    Ethereum is often compared with bitcoin, but the situation is different. Bitcoin is a kind of cryptocurrency and distributed payment network, which allows bitcoin to be transferred between users

    related: what is bitcoin? How does it work

    Ethereum has a bigger goal. As Ethereum says, "Ethereum is a distributed platform running smart contracts.". These smart contracts run on "Ethereum virtual machine", a distributed computing network composed of all devices running Ethernet nodes

    "distributed platform" means that anyone can set up and run an Ethereum node just as anyone can run a bitcoin node. Anyone who wants to run "smart contracts" on nodes must pay the operators of these nodes in ether, which is a cryptocurrency related to Ethereum. Therefore, the person running the Ethernet node provides computing power and gets paid in the Ethernet, which is similar to the way that the person running the bitcoin node provides hash power and pays in bitcoin

    in other words, although bitcoin is only a blockchain and payment network, Ethereum is a distributed computing network, and its blockchain can be used for many other things. Details are provided in the Ethereum white paper

    what is ether
    Ethernet is a digital token (or cryptocurrency) related to Ethereum blockchain. In other words, Ethereum is the token and Ethereum is the platform. But now people often use these terms alternately. For example, coinbase allows you to buy Ethereum, which stands for Ethereum

    this is technically "altcoin", which actually means a non bitcoin cryptocurrency. Like bitcoin, ether is supported by distributed blockchain - in this case, Ethereum blockchain

    developers who want to create applications or Ethereum smart contracts on Ethereum blockchain need Ethernet token to pay for nodes to host it, while users of Ethereum based applications may need Ethernet to pay for services in these applications. People can also sell services outside the Ethereum network and accept Ethernet payments, or they can sell Ethernet tokens in cash - just like bitcoin
    7. General banks can exchange, but limited to Monday to Friday, I suggest you can go to Bank of China and Bank of communications, especially Bank of China, this business is very perfect, you can also use RMB to exchange US dollars in the future.
    8. In solidness, a contract consists of a set of code (contract function) and data (contract state). The contract is located at a special address on the Ethereum blockchain. uint storedData; This line of code declares a state variable, named storeddata, of type uint (256 bits unsigned integer). You can think of it as a storage unit in a database. Just like managing a database, you can query and modify it by calling functions. In Ethereum, usually only the owner of the contract can do so. In this example, the functions set and get are used to modify and query the values of variables, respectively

    like many other languages, when accessing state variables, it is not necessary to add a prefix such as this

    this contract can't do a lot (limited by Ethereum's infrastructure), it just allows anyone to store a number. And anyone in the world can access this number. There is no reliable way to protect the number you publish. Anyone can call the set method to set a different number to cover your published number. But your numbers will remain in the history of blockchain. Later we'll learn how to add an access limit so that only you can change the number

    token example

    the next contract will implement a cryptocurrency in the simplest form. Taking money in the air is no longer a magic trick. Of course, only the person who creates the contract can do it (it's also very easy to use other currency issuance modes, just to realize the differences in details). And anyone can send money to others, without registering a user name and password, as long as there is a pair of Ethereum public and private keys

    note
    this is not a good example for online solidness environments. If you use the online solidity environment to try this example. The address of from cannot be changed when the function is called. So you can only play the role of a coiner, you can cast money and send it to others, but you can't play the role of others. This online solidity environment will be improved in the future.
    9.

    Transaction

    the behavior of blockchain transaction follows different rule sets

    < UL >
  • e to the distributed and unlicensed nature of public blockchain, anyone can sign the transaction and broadcast it to the network

  • according to different blockchains, traders will be charged a certain transaction fee, which depends on the needs of users rather than the value of assets in the transaction

  • blockchain transactions do not require any central authority verification. It only needs to use the digital signature algorithm (DSA) corresponding to its blockchain to sign it with the private key

  • once a transaction is signed, broadcast to the network and mined into a successful block in the network, the transaction cannot be recovered

  • Ethereum transaction structure

  • Ethereum transaction data structure: transaction 0.1 eth

    {
    & 39; nonce':&# 39; 0x00', // Decimal: 0
    & 39; gasLimit': &# 39; 0x5208', // Decimal system: 21000
    & 39; gasPrice': &# 39; 0x3b9aca00', // Decimal system: 10000000000
    & 39; to': &# 39;&# 39; ,// Sending address
    & 39; value': &# 39; 0x16345785d8a0000',// 100000000000000000 ,10^17
    ' data': &# 39; 0x', // Decimal representation of null data; chainId': 1 / / blockchain network ID
    }

    these data have nothing to do with the transaction content, but have something to do with the execution mode of the transaction. This is because when you send a transaction in Ethereum, you must define some other parameters to tell miners how to handle your transaction. Transaction data structure has two attribute designs & quot; gas": & quot; gasPrice",& quot; gasLimit"

  • " gasPrice": The unit is Gwei, which is 1 / 1000 eth, indicating the transaction cost

  • & quot; gasLimit": The maximum gas charge allowed for the transaction

  • these two values are usually filled in automatically by the wallet provider

    in addition, you need to specify which Ethereum network to execute the transaction (chainid): 1 represents the Ethereum main network

    ring development, tests are usually carried out locally and on the test network, and transactions are carried out through the test eth issued by the test network to avoid economic losses. After the test, enter the main network transaction

    in addition, if you need to submit some other data, you can use & quot; data" And & quot; nonce" Attach as part of a transaction

    a nonce (number used only once) is the value used by Ethereum to track transactions, which helps to avoid double spending and replay attacks in the network

  • Ethereum transaction signature

    Ethereum transaction involves ECDSA algorithm. Taking JavaScript code as an example, the popular ethers.js is used to call ECDSA algorithm for transaction signature

  • const ethers = require(' ethers')
  • const signer = new ethers.Wallet(' Wallet address

  • signer.signTransaction({

  • ' nonce':&# 39; 0x00', // Decimal: 0

  • & 39; gasLimit': &# 39; 0x5208', // Decimal: 21000

  • & 39; gasPrice': &# 39; 0x3b9aca00', // Decimal 10000000000

  • & 39; to': &# 39;&# 39; ,// Sending address

  • & 39; value': &# 39; 0x16345785d8a0000',// 100000000000000000 ,10^17

  • ' data': &# 39; 0x', // Decimal representation of null data

  • & 39; chainId': 1 / / blockchain network ID

  • })

  • . Then (console. Log)
  • you can use the online application composer to deliver signed transactions to Ethereum. This is known as "offline signature.". Offline signatures are particularly useful for applications such as status channels, which are smart contracts that track the balance between two accounts and transfer funds after a signed transaction is submitted. Offline signature is also a common practice in dexes

    you can also use online wallet to create signature verification and broadcast through Ethereum account

    with Portis, you can sign a transaction to interact with the gas station network (GSN)

    < / UL >

    the Xueshuo innovation blockchain Technology Workstation of Lianqiao ecation online is the only approved "blockchain Technology Specialty" pilot workstation of "smart learning workshop 2020 Xueshuo innovation workstation" launched by the school planning, construction and development center of the Ministry of ecation of China. Based on providing diversified growth paths for students, the professional station promotes the reform of the training mode of the combination of professional degree research, proction, learning and research, and constructs the applied and compound talent training system

    Hot content
    Inn digger Publish: 2021-05-29 20:04:36 Views: 341
    Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
    Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
    Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
    Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
    Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
    Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
    Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
    Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
    Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750