Segmentfault technology weekly Vol.41 – in depth learning blockchain

Time:2020-11-20

Segmentfault technology weekly Vol.41 - in depth learning blockchain

Start with bitcoin

A story tells you how bitcoin works

The positioning of this article will be more popular, and try to explain the basic principles of bitcoin by analogy. This article will not touch on the details of algorithms and protocols. I intend to write another article on bitcoin principle from the perspective of programmers, where we will explain some key data structures, algorithms and protocols from the perspective of technicians.

In this article, I will give a virtual village called “bitcun”. The whole article will gradually tell you the motivation of bitcoin, what problems it has solved, and the goals and design schemes of some key components.

Introduction to bitcoin

  • What is the principle of bitcoin?
  • Why can this unmanned system work successfully?
  • What’s the process of bitcoin trading?
  • What is its relationship with blockchain?

Next, I will try to answer these questions, hoping to help you understand bitcoin. Aside from the technical details, it’s easy to explain.

The essence of cryptocurrency

Last year, bitcoin soared, and other currencies have sprung up like mushrooms, with more than 1000 kinds.

Many people are asking, is the era of cryptocurrency really coming? In the future, will human beings no longer use US dollar and RMB, but use cryptocurrency instead? So many varieties, which currency should I use? Do you want to invest now?

Bitcoin white paper: a peer to peer e-cash system

This paper proposes an e-cash system which is completely implemented by point-to-point technology. It enables online payment to be initiated by one party and paid to the other party directly without any financial institutions.

Blockchain

Illustrated blockchain: 14 diagrams to understand what is “blockchain technology”?

What is blockchain technology? What can be used in the future?

How do I learn blockchain

My goal of learning blockchain is very clear. From a large perspective, there are two goals:

  • 1. In order to enter into the blockchain development in the future, do technical reserves;
  • 2. In order to guide me how to invest in virtual currency.

So, in order to achieve these two goals, what needs to be learned?

The first goal is to learn the relevant technologies of blockchain, which include the technologies involved in blockchain and the technical principles of blockchain;

The second goal is to learn the related knowledge of virtual currency, including the need to solve the problems of which virtual currency is available, where to buy it, how to buy it, and how to understand the future prospect of virtual currency.

After combing, it becomes a problem to be solved.

Introduction to blockchain

Next, I’ll try to write a best understanding of the blockchain tutorial. After all, it is not very difficult. The core concept is very simple and can be explained clearly in a few words. I hope that after reading this article, you can not only understand blockchain, but also understand what mining is and why mining is becoming more and more difficult.

Use Python to build your own blockchain step by step

I like to learn in practice, especially to understand the whole working mechanism based on one code. If you and I like this way of learning, you will know how blockchain technology works when you finish this tutorial.

  • Step 1: create a blockchain
  • Step 2: blockchain as API interface
  • Step 3: running blockchain
  • Step 4: consistency (consensus)

Understanding blockchain architecture design from concept to bottom Technology (with knowledge map)

As an implementation of architecture design, blockchain is quite different from basic language or platform. Blockchain is the technology behind cryptocurrency. It is one of the popular technologies that are comparable with vr virtual reality. It is not a new technology in itself. Like Ajax, it can be said that it is a kind of technical architecture. Therefore, we talk about the technical implementation of blockchain from the perspective of architecture design.

No matter what programming language you are good at, you can refer to this design to implement a blockchain product. At the same time, sort out the related knowledge map and system to help everyone to study systematically.

Ethereum

introduction

Introduction to Ethereum

Ethereum is a new and open blockchain platform, which allows anyone to build and use decentralized applications running through blockchain technology in the platform. Like bitcoin, Ethereum is not controlled by anyone, nor owned by anyone – it is an open source project created by many people around the world. Different from bitcoin protocol, Ethereum is very flexible and adaptable. It is very easy to create new applications on the Ethereum platform. With the release of homestead, anyone can safely use the applications on the platform.

Introduction to Ethereum development

I suggest that you read this article completely, understand it from a higher level, and then select the ones you are interested in and study them one by one. It may take a few days.

In the end, you will find that blockchain is built on the simple basic technology, which is not magical at all. Although it has been stir fried by various ICOS recently. Everyone is standing on the shoulders of giants. If you are a programmer, you can understand these projects and technologies more deeply. So don’t lose an opportunity to improve yourself because of other dross.

Build a blockchain development environment based on Ethereum from 0

This paper builds the development environment of Ethereum from 0, just like learning other languages at that time. This is our first hellowork program. After the completion of the construction, we tested the account creation, mining and transfer.

Practice one

Practice: how to write, deploy and interact with Ethereum smart contract on private blockchain

In this paper, the author gives the complete code, detailed steps and user interface of the smart contract written, deployed and interacted with Ethereum on the private blockchain. The author hopes that with his article, you can write and deploy a smart contract on the private Ethereum blockchain.

Practice 2

Ethereum (1): steps of building Ethereum private chain on CentOS

  1. This article refers to Ethereum related information, through personal practice installation, to avoid many detours
  2. When installing, make sure that the minimum running memory of the server is 2G, otherwise the installation may not succeed!
  3. This will introduce how to build Ethereum private chain on CentOS.

Ethereum (2): account management operation, mining and transfer in Ethereum private chain environment under CentOS

Now the basic operation of Ethereum is introduced.

  1. Account viewing
  2. mining
  3. transfer accounts

3. Build and execute in Ethereum

Last time, we built a private chain and simple account management operation, transfer and mining. This time, we demonstrated the compilation, compilation, creation and execution of smart contract through a very simple smart contract. The steps are as follows:

  1. Write and compile a simple smart contract through online IDE and solidness language
  2. Create a smart contract in the private chain environment we created earlier (in fact, the smart contract is the so-called “code on the chain”)
  3. Execute or call the contract through the method in the smart contract

Practice 3

How to start learning Ethereum and blockchain

In this paper, we have some simple methods of learning about Ethereum.

Blockchain development (1) building a private chain environment based on Ethereum

Through the methods described in this paper and the script in the project, we can quickly build our own private chain for blockchain development test. This paper is based on the Ethereum technology, which is divided into two parts: one is the method under Ubuntu, the other is the method under Windows OS.

Blockchain development (2) deploy and run the first Ethereum smart contract

There are a lot of articles about deploying smart contracts on the network, but they all have a common feature, which is to deploy by command line. First, build Solc compiling environment, then deploy geth or eth node, and then generate wallet, ABI and contract address step by step for deployment. It is difficult for beginners to understand and easy to fail. This paper mainly introduces how to deploy in the graphical world Next click to deploy and call the smart contract.

Blockchain development (3) write and debug the first Ethereum smart contract

Currently, Ethereum supports the writing of smart contracts in three languages:

  • Solidity: similar to JavaScript, this is the official recommended language of Ethereum and the most popular smart contract language. Please refer to the solidity document for specific usage.
  • Serpent: Python style.
  • LLL: similar to LISP style, it has been terminated.

You can choose different high-level languages according to different habits. At present, solidness is the most popular one. All the smart contracts in this paper are written in solid language.

Hyperledger

Commercial application of blockchain: hyperledger

Hyperledger is one of many projects under the Linux foundation. It is a blockchain project proposed by IBM, Intel, financial companies, GP Morgan and other joint institutions in 2015. Super ledger also includes four framework projects: sawtooth, iroha, fabric and burrow. One of the most well-known is fabric. At present, there are about 140 members, of which 1 / 4 are from China. At present, Wanda, Huawei and IBM are mainly responsible for China’s technical team, which is responsible for providing Chinese members and China’s demand, as well as promoting code.

Hyperledger smart contract development

This tutorial will guide you through writing smart contracts for hyperledger.

  • deploy
  • How to write chain code
  • Realize your first chain code
  • Interact with your first chain code

IBM blockchain 101: a quick start guide for developers

This developerWorks quick start guide is suitable for application developers who are not familiar with blockchain technology and want to quickly start building and experimenting with blockchain networks. The simple instructions will show how to set up an IBM blockchain network based on the open source hyperledger fabric, how to deploy chain code (business rules), and how to write client applications to simplify business processes and digital interactions.

Hyperledger fabric v1.0 – quick start for developers

This document demonstrates using hyperledger fabric v1.0 to deploy a developer environment and run a simple example. Documentation includes creating and joining channels (ledgers), client authentication, and deploying and invoking smart contracts. The CLI will be used to create and join channels (ledgers), and the nodejs SDK will be used for client authentication and smart contract functions for using ledgers.

Docker compose will be used to create a federation chain with three peer nodes, a separate orderer, and a certification authority (CA). In order to speed up the deployment process, encryption elements based on standard PKI implementation are pre generated and packaged into fabpre.tar.gz 。 Certification authority (CA) is responsible for issuing, revoking and maintaining encryption elements representing an enterprise, which are provided to the client (node SDK) for authentication.

The fabric network will be generated automatically by executing docker compose, and the API for creating channel and joining channel will be called automatically; at the same time, developers can also generate their own fabric network and channel (account book) by manual steps or directly use developer mode for application development.

Fabric v1.0.5 installation notes

Introduction to solidity

Introduction to solidity

Solidity is a smart contract high-level language that runs on Ethereum virtual machine (EVM). Its syntax is close to JavaScript, and it is an object-oriented language. But as a truly decentralized contract running on the network, it has many differences.

Chinese document of solidity Chapter 1: introduction to smart contract

Let’s start with a very basic example. Don’t worry you don’t know anything about it yet. We’ll learn more details step by step.

In solidity, a contract consists of a set of code (the function of the contract) and data (the state of the contract). The contract is located at a special address on the Ethereum blockchain.

Chinese documentation of solidity Chapter 2: installation of solidity

If you just want to try a small contract that uses solidity, you don’t need to install anything, just visit browser based solidity.

If you want to use it offline, you can save the page locally or clone one.

Chinese documents of solidity Chapter 3: Examples

  • Example 1: voting
  • Example 2: blind shooting
  • Example 3: secure remote shopping

Solid Chinese document — source file layout and contract structure

This section provides all the information you need to know about solidity.

More resources

Introduction to blockchain theory

Recommendation of papers and documents related to blockchain Technology

Gitbook e-book blockchain technology guide

Hyperledger fabric website

Tencent trusted blockchain solution white paper

Hyperledger’s next generation consensus architecture proposal

End of this issue
:)


Welcome to the segmentfault workshop service number:)

Segmentfault technology weekly Vol.41 - in depth learning blockchain