1

I am new with blockchain services. I have created wallet using command line.

curl -X POST   http://127.0.0.1:8888/v1/wallet/create -d '"WalletTest"

It's created successfully.

But, I'm trying to create wallet using EOSIO RPC APIs in C++. I have used curl library for http call. But, Whenever I call, I am getting following error

2019-07-02T09:50:16.709 thread-0   http_plugin.cpp:474           handle_exception     ] Exception Details: 4 parse_error_exception: Parse Error

Unexpected char '100' in "data" {"c":100,"s":"data"} thread-0 json.cpp:437 variant_from_stream

{"str":"data=mywallet"}
thread-0  json.cpp:460 from_string

My C++ Code:

CURL *hnd1 = curl_easy_init();

curl_easy_setopt(hnd1, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd1, CURLOPT_URL, "http://127.0.0.1:8888/v1/wallet/create");
curl_easy_setopt(hnd1, CURLOPT_POSTFIELDS, "data=MyWallet");

struct curl_slist *headers1 = NULL;

curl_easy_setopt(hnd1, CURLOPT_HTTPHEADER, headers1);
curl_easy_setopt(hnd1, CURLOPT_WRITEFUNCTION, writefunc);
curl_easy_setopt(hnd1, CURLOPT_WRITEDATA, &s);
curl_easy_perform(hnd1);
printf("%s\n", s.ptr);
if(s.ptr != NULL)
free(s.ptr);

What am I miss here? Please someone help. Thank you.

0

I have solved that issue. We just need to pass wallet name as string.

curl_easy_setopt(hnd1, CURLOPT_POSTFIELDS, "MyWallet");

It's works for me. May be help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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