Note: This article was first published on 2017-09-22.
Hyperledger source code Analysis of Fabric introduction
The Chaincode is the user chaincode,ucc, which is important for application developers, and it provides state processing logic based on the blockchain distributed ledger, which can be used to develop a variety of complex applications.
Hyperledger Fabric, Chaincode runs in the Docker container by d
current fabric there is limited development resources, so in 1.0 will not do, may be achieved in the future. COUCHDB Installation
Now let's talk about this couchdb.
COUCHDB is a database of key values for a full local restful API, which means we don't need any clients, we just need to operate the database via HTTP requests. Leveldb is a peer local database, then certainly and peer one-to-one relationship, then COUCHDB is a network database, should and peer what kind of relationship. In a produc
Hyperledger source code Analysis of Fabric
The sorting service plays a very central role in the Super Ledger Fabric network. All transactions need to be sorted globally before they are sent to committer for validation acceptance.
In the current architecture, the function of the sorting service is extracted, as a separate Fabric-orderer module to implement, the code is mainly in the Fabric/orderer directory.
The following Kafka as a consensus plug-in a
Hyperledger source code Analysis of Fabric
The Orderer node startup is implemented by the main () method under the Orderer package and further calls to the main () method in the Orderer/common/server package.
The core code is shown below.
Main is the entry point of Orderer Processfunc main () {
fullcmd: = Kingpin. Mustparse (app. Parse (OS. Args[1:])
//"version" command
if Fullcmd = = version. Fullcommand () {
fmt. Println (metada
Hyperledger Installation and testing (MAC PRO)
Environment preparation
Dccker
Golang
node. js
Python 2.7 (MacOS comes with)
Fabric Download and Installation
Reference Links:Hyperledger Fabric v1.1.0 MacOS Deploying a developer environment and creating the first Fabric network
Test
Note that the actual installation is using the 1.2 version, the corresponding test should also refer to:Building Your First Network
Some of the issues that
Hyperledger source code Analysis of Fabric
Deliver means that the client obtains data from the ordering service via the Grpc interface (for example, data from a specified block).
The Orderer node receives the request message, which is first given to the Deliver of the server structure in the Orderer.common.server package (SRV ab. Atomicbroadcast_deliverserver) Error method processing. This method further invokes the Handle of the deliverserver structu
Hyperledger source code Analysis of Fabric
Broadcast means that the client sends the request message (for example, after the endorsement transaction is completed) to the ordering service via the Grpc interface.
These request messages are given to the broadcast (SRV ab) of the server structure in the Orderer.common.server package. Atomicbroadcast_broadcastserver) Error method processing. This method will mainly call the Handle (SRV ab) of the HANDLERIM
The entities involved in Hyperledger Fabric 1.0 include the following:
FABRIC-CA: Mainly responsible for the maintenance of the certificate of the entity in the network;
Peer: mainly responsible for the implementation of intelligent contracts, record books;
Order: mainly responsible for the accounting content of the consensus.
1.0 architecture can be based on the actual needs of the network through the Certificate of Security Domain Division manag
Fabric-sdk-java build and compile (this article is based on 1.0.1 version)
1, install jdk1.8 and above version
2, download Fabric-sdk-java GitHub address: Https://github.com/hyperledger/fabric-sdk-java
3. Import into Eclipse tools
4, switch to the project directory under the Command Window mode of execution: MVN compile-dskiptests,
Refresh the project after the compilation succeeds.
Proto files in the project are generated into the Target/genera
Copyright Notice: Blog Article copyright owners all, without authorization, prohibit reprint, reprint please specify the source installation Environment installation JDK
Download URL: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download jdk-8u151-macosx-x64.dmg install to PC install maven
Download URL: https://maven.apache.org/download.cgi
Extract to/users/fujinliang/documents/environment
Open terminal , modify. BASHRC
VI ~/.BASHRC
Add the following code
The previous analysis program looked at the details of the analysis, so without the concept of framework, took two days to analyze the Hyperledger fabric architecture design, analysis of the program does not reference any information, such as error welcome correction, common progress.
The author has the following questions before the detailed analysis procedure:
1) How the CLI (command line) client sends a command to a peer node
2) How the peer node
This is a created
article in which the information may have evolved or changed.
1. Environmental architecture
The system uses the container to run, the construction process is simple, each component division of labor is clear:
Then the above figure analysis, after the consensus commit process to generate batch data, is how to send to Chaincode. We still analyze it with the Invoke command.
1 call Chaincode's executetransactions into the transaction process in consensus
first, fabric network structure (temporarily excluding CA)
As shown in the figure above, in the Fabric network, o indicates that ORDERER,P represents PEER,EP representative endorsing Peer (endorser), CC represents Chaincode, and client, Channel,
Transaction FlowThis document outlines the trading mechanisms that occur during the exchange of standard assets. The program includes two Clienta and B, they buy and sell radishes. They have a peer on the web, sending their deals through peer and
Vocabulary Induction 1. peer--node
name
role
meaning
function Description
Orderer
1.0 Consensus service roles in the architecture
Sort nodes
1. Sort all transactions destined for the network2. Organize
Configtxgen main Functions
1. Generate the creation block needed to start orderer, and support checking the chunk content
2, generate the configuration transaction needed to create the application channel, and support checking the transaction
Transferred from: http://blog.csdn.net/bluecloudmatrix/article/details/51859333
Fabric originated from IBM, the original intention in order to serve industrial production, IBM will open 44,000 lines of code, is a great contribution, so that we can
The 1.Chaincode interface must be implemented by all the code on the chain, and the fabric runs the transaction by invoking these specified functions
Call the INIT function to allow code on the chain to initialize internal data after the container
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.