Node.js hyperledger结构中的商业票据中没有交易数据

Node.js hyperledger结构中的商业票据中没有交易数据,node.js,hyperledger-fabric,blockchain,hyperledger,smartcontracts,Node.js,Hyperledger Fabric,Blockchain,Hyperledger,Smartcontracts,我遵循商业票据教程学习一些链码的东西。文档中说数据库中会存储两个东西。第一个是纸张的当前状态,第二个是纸张生命周期的历史,即事务数据。但当我在运行issue、buy和reedem方法后通过couchdb时,我只看到了纸张的当前状态,而不是纸张的历史,即事务数据没有存储在数据库中 我在这里遗漏了什么,遗漏了什么,以至于我没有看到交易数据?请帮助我。请注意,在使用合同api时,调用的每个链码函数都会传递一个事务上下文“ctx”,您可以从中获取链码存根(GetStub()),该链码存根具有访问分类账(

我遵循商业票据教程学习一些链码的东西。文档中说数据库中会存储两个东西。第一个是纸张的当前状态,第二个是纸张生命周期的历史,即事务数据。但当我在运行issue、buy和reedem方法后通过couchdb时,我只看到了纸张的当前状态,而不是纸张的历史,即事务数据没有存储在数据库中


我在这里遗漏了什么,遗漏了什么,以至于我没有看到交易数据?请帮助我。

请注意,在使用合同api时,调用的每个链码函数都会传递一个事务上下文“ctx”,您可以从中获取链码存根(GetStub()),该链码存根具有访问分类账(例如GetState())和请求更新分类账(例如PutState())的函数

链接:

Go chaincode中的Fabric Contract API文档:

您也可以找到node.js文档的链接

因此,要获取资产的历史记录,必须使用“func(*ChaincodeStub)GetHistoryForKey”API

// GetHistoryForKey returns a history of key values across time.
// For each historic key update, the historic value and associated
// transaction id and timestamp are returned. The timestamp is the
// timestamp provided by the client in the proposal header.
// GetHistoryForKey requires peer configuration
// core.ledger.history.enableHistoryDatabase to be true.
// The query is NOT re-executed during validation phase, phantom reads are
// not detected. That is, other committed transactions may have updated
// the key concurrently, impacting the result set, and this would not be
// detected at validation/commit time. Applications susceptible to this
// should therefore not use GetHistoryForKey as part of transactions that
// update ledger, and should limit use to read-only chaincode operations.
GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error)