PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, May 14, 2022

[FIXED] How can I rectify from Error: flag needs an argument: 'c' in -c?

 May 14, 2022     blockchain, chaincode, hyperledger-fabric, ubuntu     No comments   

Issue

I used the following command to initialise the chaincode after committing it to the hyperledger fabric test network.

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C testchannel -n property --peerAddresses localhost:7051 --tlsRootCertFiles $CORE_PEER_TLS_ROOTCERT_FILE_ORG1 --peerAddresses localhost:9051 --tlsRootCertFiles $CORE_PEER_TLS_ROOTCERT_FILE_ORG2 --isInit -c `{"Args":[]}`

Then I encountered with the following error,

{Args:[]}: command not found
Error: flag needs an argument: 'c' in -c

Error Screenshot

How can I rectify this error. Thanks in advance!


Solution

I'm not sure about this as I don't generally use the --isInit flag, but I believe that if it is used, you need to have an Init function in your contract to match the expectation of this flag i.e. it should have a method signature to suit what use of the flag expects to find.

I tend not to use the flag and instead, call a home grown Init function, as shown below.

-c '{"function":"initLedger","Args":[]}'

Have a look at this link if you haven't already.



Answered By - Jerome O'Mahony
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing