本文介绍了基于Hyperledger的加密货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hyperledger Fabric是否支持创建众所周知的比特币/以太坊这样的加密货币的可能性?我不是说可以通过链码实现的令牌.

Does Hyperledger Fabric support possibility to create a cryptocurrency like well know Bitcoin/Ethereum?I don't mean tokens which I can implement by chaincode.

推荐答案

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

You can implement any business logic by using Hyperledger Fabric chaincode, which essentially a simple program. Chaincode manages ledger state by operation on transactions submitted by application and ensure to have it consistent across network peers.

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

Hyperledger Fabric currently supports chaincodes written in Go, while in a future will be added support for nodeJS and Java. Chaincode interface defined as following:

// 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
}

因此您可以将加密货币实现为链码.为了启发您如何实现它,您可能需要看一下余额转移.

So you can implement your cryptocurrency into chaincode. To get an inspiration on how you can implement it, you might want to take a look on following demo application of balance-transfer.

这篇关于基于Hyperledger的加密货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 19:13