2017-08-02 51 views

回答

3

您可以通过使用Hyperledger Fabric chaincode实现任何业务逻辑,这本质上是一个简单的程序。 Chaincode通过对应用程序提交的事务进行操作来管理分类帐状态,并确保跨网络对等方保持一致。

Hyperledger Fabric目前支持用Go编写的链式代码,而未来将添加对nodeJS和Java的支持。定义如下Chaincode接口:

// Chaincode interface must be implemented by all chaincodes. The fabric runs 
// the transactions by calling these functions as specified. 
type Chaincode interface { 
    // Init is called during Instantiate transaction after the chaincode container 
    // has been established for the first time, allowing the chaincode to 
    // initialize its internal data 
    Init(stub ChaincodeStubInterface) pb.Response 

    // Invoke is called to update or query the ledger in a proposal transaction. 
    // Updated state variables are not committed to the ledger until the 
    // transaction is committed. 
    Invoke(stub ChaincodeStubInterface) pb.Response 
} 

所以,你可以实现你的cryptocurrency到chaincode。为了得到如何实现它的灵感,你可能想看看下面的演示应用balance-transfer


还有一个相当类似的问题最近也被问到mailing list

+0

非常感谢您的回复。 据我所知,我必须自己检查所有交易历史并批准当前交易吗? –

+0

@Kirill,是的,你必须自己实现业务逻辑。 –

+0

好的,但我怎么能得到交易的历史? –