基于Hyperledger的加密货币

Kir*_*kov 5 hyperledger hyperledger-fabric

Hyperledger Fabric是否支持创建像比特币/以太币这样的加密货币的可能性?我不是指我可以用链码实现的令牌.

Art*_*ger 6

您可以使用Hyperledger Fabric链代码实现任何业务逻辑,这实际上是一个简单的程序.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
}
Run Code Online (Sandbox Code Playgroud)

因此,您可以将加密货币实施为链码.为了获得有关如何实现它的灵感,您可能需要查看以下平衡传输的演示应用程序.