I am using bitcoind-rpc in javascript but i couldn't use the function/api that require 2 or more arguments. For example, what is the proper format of the arguments needed for createRawTransactions?

let params1 = JSON.stringify([{"txid":txid, "vout":vout}]);
let params2 = JSON.stringify({[toAddress]:toAmount, [changeAddress]:changeAmount, "data":data});

await rpc.createRawTransaction(params1, params2, (err,raw) => {

I have run the script above but it gives me this error

  result: null,
  error: { code: -3, message: 'Expected type array, got string' },
  id: 91952

Then i tried without JSON.stringify, still give me the same error

let params1 = [{"txid":txid, "vout":vout}];
let params2 = {[toAddress]:toAmount, [changeAddress]:changeAmount, "data":data};

Your Answer

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

Browse other questions tagged or ask your own question.