5

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.

pvrforpranavvr
  • 2,708
  • 2
  • 24
  • 34

2 Answers2

7

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 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.


Artem Barger
  • 40,769
  • 9
  • 59
  • 81
  • Thanks a lot for response. As I understand I must to check all transaction history and approve current transaction by myself? – Kirill Bulgakov Aug 02 '17 at 11:52
  • @Kirill, yes you have to implement business logic yourself. – Artem Barger Aug 02 '17 at 11:54
  • Why do you need transactions history? You can simply manage balances within you chaincode by validating whenever account has enough funding, unspent transaction is not the only possible way. Other than that you can query for history of changes for particular key GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error). Also there are API's to retrieve transactions and blocks (https://github.com/hyperledger/fabric/blob/release/core/scc/qscc/query.go). – Artem Barger Aug 02 '17 at 12:04
  • if you need more details and would like to discuss in depth the details, I'd guess that you need to check the RocketChat - chat.hyperledger.org. – Artem Barger Aug 02 '17 at 12:07
  • I need a transaction history because I want to implement cryptocurrency instead token system with balances and transfer method. – Kirill Bulgakov Aug 02 '17 at 12:15
  • Were you able to find a reasonable solution to your question? I myself have been trying to do the same thing and am finding that fabric is actually a terrible solution for cryptocurrencies. Ironic, Any luck? – Garrett Cox Apr 28 '18 at 22:12
0

There is a Token feature in the alpha release of 2.0, you can check it out: https://hyperledger-fabric.readthedocs.io/en/latest/whatsnew.html#fabtoken

Also check here for

Can we create non-fungible tokens with Hyperledger?

The platform-neutral Token Taxonomy Initiative overseen by the Enterprise Ethereum Alliance (EEA) has announced the publication of the Token Taxonomy Framework (TTF) V 1.0, which enables businesses and developers to universally understand and define what a token is in non-technical terms, regardless of how it is implemented.

asing177
  • 934
  • 2
  • 13
  • 34