Hyperledger (fabric-blockchain) 我能做些什么来进行这样的交易?

Hyperledger (fabric-blockchain) what can i do for such transaction to be carried out?

我可以检查 fabric (hyperledger-blockchain),我们是否允许将字母 'a' 和 'b' 更改为其他内容,例如 john,英语:A,math:B,科学:c,结合humanities:D,IT:A。因为现在,我正在尝试使用(学术)区块链来防止伪造我学校项目的证书。如果可能的话,我可以知道怎么做吗?有没有我可以参考的教程/网站? 目前,我正在使用这个网站作为初始化、调用和查询的参考(http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/)。我尝试更改他们的字母 'a' 和 'b' 示例以满足我的需要。例如,我曾尝试初始化 John 的参数 English:A、Math:B 等。它看起来如下所示。

{
  "jsonrpc": "2.0",
  "method": "deploy",
  "params": {
    "type": 1,
    "chaincodeID":{
        "name": "mycc"
    },
    "ctorMsg": {
        "function":"init",
        "args":["John", "0", "English", "A", "Math", "B", "Science", "C", "Combined Humanities", "D", "IT", "B"]
    }
  },
  "id": 1
}

看起来还不错 returns

{
  "jsonrpc": "2.0",
  "result": {
    "status": "OK",
    "message": "mycc"
  },
  "id": 1
}

但是当我尝试查询英语、数学、科学或综合人文学科时,它不起作用。以下是我查询的例子

{
  "jsonrpc": "2.0",
  "method": "query",
  "params": {
      "type": 1,
      "chaincodeID":{
          "name":"mycc"
      },
      "ctorMsg": {
         "function":"query",
         "args":["English"]
      }
  },
  "id": 5
}

给出的回复是这样的。

{
  "jsonrpc": "2.0",
  "method": "query",
  "params": {
      "type": 1,
      "chaincodeID":{
          "name":"mycc"
      },
      "ctorMsg": {
         "function":"query",
         "args":["English"]
      }
  },
  "id": 5
}

我可以知道要执行此类交易我能做些什么吗? (初始化、调用、查询执行成功)

为此,您需要学习编写自己的链代码,

https://github.com/IBM-Blockchain/learn-chaincode

并尝试 运行 资产管理示例,

https://github.com/hyperledger/fabric/tree/master/examples/chaincode/go/asset_management/app

您也可以尝试此处提供的其他示例,

https://github.com/hyperledger/fabric/tree/master/examples/chaincode/go

但是,资产管理示例是您方案的完美开始。