IBM-Blockchain-Archive / car-lease-demo

A demonstration using IBM Blockchain to show how the lifecycle of vehicles can be recorded on a blockchain
Other
170 stars 304 forks source link

How to use "args" as JSON instead of array of strings (i.e. [] string ) #120

Open mna2016 opened 7 years ago

mna2016 commented 7 years ago

Hi All, I am trying to modify the chaincode vehicles.go in order to have "args" parameter of an incoming invoke statement as a JSON instead of array of string. I want the request to look like below:

{ 
    "jsonrpc": "2.0", 
    "method": "invoke", 
    "params": 
        {   "type": 1, 
            "chaincodeID": 
            { "name": "fe4ffc3aff02c2dda7a61f18d934c84474edecd4fe1ade6c5181f541afd936bff01bc6b3066f349b5caed6aa0f1a74e31d47ee82929d3157194f441afa171ff2" }, 
            "ctorMsg": 
                        { 
                            "function": "update_xxx", 
                            "args": {"make":"HONDA", "vin":"MOD123", "color":"RED", "owner":"DVLA"} 
                        }, 
    "secureContext": "WebAppAdmin" 
        }, 
"id":1234 
}

1) How to update the vehicles.go in order to achieve this? 2) Is there any other place where I need to make change in order to accept this new invoke API call structure?