Reputation: 85
Can i check whether fabric (hyperledger-blockchain), are we allow to change the letter 'a' and 'b' to something else like john, english: A, math:B, science: c, combine humanities:D, IT:A. Because right now, i'm trying to use (academic) blockchain to prevent forgery of certificate for my school project. If it is possible, may i know how it can be done? Is there any tutorial/ website that i can reference to? Currently, i'm using this website as a reference(http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/) for init, invoke and query. I tried changing their example of letter 'a' and 'b' to suit my need. For instance, i had tried to init the args of John, English:A, Math:B and etc. It looks like the following below.
{
"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
}
It seems ok as it returns
{
"jsonrpc": "2.0",
"result": {
"status": "OK",
"message": "mycc"
},
"id": 1
}
But the moment i have tried and query English, Math, Science or combined humanities, it doesn't work. The following is my example for query.
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"type": 1,
"chaincodeID":{
"name":"mycc"
},
"ctorMsg": {
"function":"query",
"args":["English"]
}
},
"id": 5
}
The response given was this.
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"type": 1,
"chaincodeID":{
"name":"mycc"
},
"ctorMsg": {
"function":"query",
"args":["English"]
}
},
"id": 5
}
May i know what can i do for such transactions to be carried out? (Init, invoke and query to be carried out successfully)
Upvotes: 1
Views: 398
Reputation: 18743
For this purpose, You need to learn to write your own chaincode,
https://github.com/IBM-Blockchain/learn-chaincode
and try running Asset management example,
https://github.com/hyperledger/fabric/tree/master/examples/chaincode/go/asset_management/app
You can also try other examples available here,
https://github.com/hyperledger/fabric/tree/master/examples/chaincode/go
However, Asset management example is perfect start for your scenario.
Upvotes: 1