Fabric在調用鏈碼時候報錯:
Error: chaincode argument error: json: cannot unmarshal number into Go struct field .Args of type string
或
Error: chaincode argument error: json: cannot unmarshal bool into Go struct field .Args of type string
數據在結構體中有字符串、布爾、浮點和整型,如下所示:
調用的指令是
主要看傳參處,按照結構體中數據類型進行傳參,整型、布爾和浮點型數據都沒有雙引號,但是調用時報錯
解決方法是在調用時在所有參數處都加上雙引號,此做法並不會改變數據類型,可以在調用後根據key
查詢得以驗證
成功解決:chaincode argument error: json: cannot unmarshal xxx into Go struct field .Args of type string
的問題
歡迎小夥伴討論,如有錯誤請在評論區評論或發私聊消息,謝謝你。