Blockchain Hyperledger结构通用输入和获取
我有一个界面,代表我想用区块链做什么Blockchain Hyperledger结构通用输入和获取,blockchain,hyperledger-fabric,Blockchain,Hyperledger Fabric,我有一个界面,代表我想用区块链做什么 public interface IBlockChain { /** * Put data on the blockchain * * @param key the key being used to put the data on the blockchain * @param data the data being put on the blockchain */ public boo
public interface IBlockChain {
/**
* Put data on the blockchain
*
* @param key the key being used to put the data on the blockchain
* @param data the data being put on the blockchain
*/
public boolean put(String key, Map<String, Object> data);
/**
* Get data from the blockchain
*
* @param key the key being queried
* @return
*/
public List<Record> get(String key);
/**
* Get all data from the blockchain
* @return
*/
public List<Record> all();
}
我有一个多链的工作实现。但我现在想开始实施其他区块链技术。
在Hyperledger Fabric v1.0中,我将如何进行此操作?我可以直接将原始数据推送到它吗?还是我总是需要调用链码片段来为我创建对象?您需要编写一个链码来放置和获取数据。相应的链码功能包括:
PutState(key string, value []byte) error
GetState(key string) ([]byte, error)
Hyperledger Fabric v1.0有一个链码教程:
https://hyperledger-fabric.readthedocs.io/en/latest/chaincode4ade.html
然后,您的客户可以调用链码并提交交易。有一个Hyperledger Fabric Node.js SDK可以帮助您更好地理解。您必须调用您在区块链中实例化的智能合约链码。在您的情况下,您将拥有Hyperledger结构区块链。然后,有一个SDK可以帮助调用它。我不知道我是否理解你的问题。你能提供更多的信息吗?