I'm troubled with a problem about how I can use command line cleos push action to push a vector to an already existing action, such as:

void vectortest(const std::vector &vec) ;

Anyone who can help me? Thanks

  • did you try cleos push action <contract> <action> '["arg1", ["vec_elem1", "vec_elem2"]]' -p <account> assuming the second param is the vector
    – confused00
    Sep 19, 2018 at 12:35
  • @confused00 thanks for your comment.I'd try to use your fomat,but failed,and the error message is string_type convert to json failed.
    – fen chen
    Sep 19, 2018 at 14:52
  • I think you need to define the type of vector. Sep 21, 2018 at 7:42

1 Answer 1


suppose your action looks like this: first define type of your vector let say you need a vector of double

void vectortest(const std::vector<double> &vec) ;

than you should be able to call like this:

cleos push action your_account vectortest '{"vec":[1.2,2.5,4.6]}' -p your_account

your_account is the account with which you set your contract.

  • 1
    This does not work for me. I get this response: 2018-10-07T04:25:26.099 thread-0 http_plugin.cpp:476 handle_exception ] Exception Details: 3050000 action_validate_exception: Action validate exception Unknown action pgram in contract blackjack {"action":"pgram","contract":"blackjack"} thread-0 chain_plugin.cpp:1564 abi_json_to_bin code: blackjack, action: pgram, args: {"player_cards":[3,4,5,6]} {"code":"blackjack","action":"pgram","args":{"player_cards":[3,4,5,6]}} thread-0 chain_plugin.cpp:1575 abi_json_to_bin
    – Max
    Oct 7, 2018 at 4:26
  • Did you imported the vector library ,if you does Can you please share the code Oct 7, 2018 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.