Hyperledger Fabric构架简述之一

悄悄告诉你

这个链接卧虎藏龙:
HiBlock区块链技术布道 GitHub

Fabric和Composer的关系:

Hyperledger的Composer和Fabric到底是什么关系?

总之

无论是想专注于Composer开发的,还是自己搭建Fabric网络的,都绕不开Fabric构架这一关。
(发现绕过方法的人,请于下方留言未来铲S官。)

下方图片全部来自官方网站

Fabric网络概要

Basic Network
tx: transaction 交易,操作。
比如去超市买狗粮的时候,从自己的电子钱包转帐到咖啡店这个请求,可以看作是一个tx。
比如你收到快递,你通过快递公司的应用,点击了“查收”,这个操作可以看作一个tx。 
每次一你准备更新账本的操作,都可以视为tx。

智能合约

Smart Contract

Fabric是做联盟链的。跟共链不同,任何你想对账本的操作,读取,写入,都需要通过 智能合约 才可以发生的。

Hyperledger Fabric smart contracts are written in chaincode and are invoked by an application external to the blockchain when that application needs to interact with the ledger.

所以,在Fabric里,智能合约 = chaincode

chaincode很重要,也很关键了。不懂chaincode就么有办法玩Fabric网络,但chaincode是用Go写的,你需要先回去学习Go语言,怕怕了吧。o(∩∩)o...哈哈,这个部分经过Composer的封装后,可以用JS来写了。比起完全自己写chaincode,用composer的话,可以简化不少流程呢。所以,未来的铲S官写完这篇博文后,就去学JS。

In most cases, chaincode interacts ONLY with the database component of the ledger, the world state (querying it, for example), and NOT the transaction log.

Chaincode can be implemented in several programming languages. The currently supported chaincode language is Go with support for Java and other languages coming in future releases.

Blockchain Ledger 账本

细心的童靴应该注意到了 the world state 这个词。这个就是账本的意思么?跟账本是什么关系呢?

Ledger

原来,一个账本里面包含了两部分: the world stateBlockchain

The world state represents the current values of all ledger states.

简单粗暴的说,就是区块链里面记录的信息,最终的状态,是由 the world state 来储存的。主要用于上面chaincode的快速查询使用。不用反推所有区块链里面的交易真假。百无聊赖的时候,就可以从 Blockchain 来计算一下,得到新的 the world state。目前存储 the world state可以用: an embedded LevelDB 或者 an external CouchDB

而账本里面的区块链是: 任何操作的记录

The blockchain is a transaction log, structured as interlinked blocks, where each block contains a sequence of transactions, each of which represents a query or update to the world state.

未来铲S官要急着去学JS了,下周再见哦。希望这篇博文对我们的共同学习,进步都有一点点帮助。

相关链接

Ledger

你可能感兴趣的:(Hyperledger Fabric构架简述之一)