1

I am currently having troubles with some example code I found on github regarding the iota.c library (example code in README file). However I am not able to send a valid transaction using iota_client_send_transfer() function as it returns a CCLIENT_RES_ERROR and a http status 400. I just can't get my head around this issue.

I use the following definitions:

#define CONFIG_IRI_NODE_URI "nodes.thetangle.org"
#define CONFIG_IRI_NODE_PORT 443
#define TIP_SELECTION_DEPTH 3
#define MINIMUM_WEIGHT_MAGNITUDE 14
#define DEPTH 3
#define SECURITY_LEVEL 2

My example code looks like this:

m_service = iota_client_core_init(CONFIG_IRI_NODE_URI, CONFIG_IRI_NODE_PORT,ROOT_CA1_PEM);
retcode_t retcode = RC_OK;
char message[] = "Hello World";

bundle_transactions_t *bundle = nullptr;
bundle_transactions_new(&bundle);

transfer_array_t *transfers = transfer_array_new();
transfer_t tf = {};

flex_trits_from_trytes(tf.address, NUM_TRITS_ADDRESS,ADDRESS,NUM_TRYTES_ADDRESS, NUM_TRYTES_ADDRESS);
    
retcode = transfer_message_set_string(&tf,message);
transfer_array_add(transfers,&tf);
retcode = iota_client_send_transfer(
      m_service, NULL, SECURITY_LEVEL, DEPTH,
      MINIMUM_WEIGHT_MAGNITUDE, false, transfers, NULL, NULL, NULL, bundle);

This is the output of iota_client_send_transfer:

[parser_on_headers_complete:239] status=400, offset=0, nread=0

I've tried to change the definitions, but that didn't help. Also the tutorials on the official iota page seem to be out of date. Has anybody a clue of what the problem might be?

I would really appreciate your help! Thanks in advance.

edit: added iota.c to title

1 Answer 1

0

Those example are outdated, you can try these examples here:

https://github.com/iotaledger/iota.c/tree/master/cclient/api/examples

Your Answer

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

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