0

I am trying to create an unsigned transaction and broadcast it. I've used the following lines of code, and called transferSignPushTransaction with valid parameters...

async function transferSignPushTransaction(from, to, quantity, memo = ''){
  const tr = await eos.transfer(from, to, quantity, memo, { broadcast: false, sign: false });
  const signedTr = await signTr(tr, from, to, quantity, memo);
  await eos.pushTransaction(signedTr.transaction);
}

async function signTr(tr, from, to, quantity, memo = '') {
  let par = ecc.sha256(Buffer.from(tr.transaction.transaction.actions[0].data.toString, 'hex'));
  const sig = await getSignature(par);
  tr.transaction.signatures.push(sig);
  return tr;
}

async function getSignature(tr) {
  const sig = await ecc.signHash(tr,'5K25WUiTzhRTkdRgj4tfeeQbiW6FUPWN3LDhn8YqJsdUcjiwSgc');
  return sig;
}

This creates the following error msg:

(node:4968) UnhandledPromiseRejectionWarning: Error: {"code":500,"message":"Internal Service Error","error":{"code":3090003,"name":"unsatisfied_authorization","what":"Provided keys, permissions, and delays do not satisfy declared authorizations","details":[{"message":"transaction declares authority '{\"actor\":\"alice\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], and provided keys [\"EOS6fY5AByVfbZhu7AYNj4PWg7PTVJjhp9Qj12KYWVTytH7z8fAG5\"]","file":"authorization_manager.cpp","line_number":411,"method":"check_authorization"}]}}

I think I have passed in a wrong parameter to the ecc.signHash function. Is there anyone who can give me an example of what kind of parameter I should pass into ecc.sign or ecc.signHash function? And how to obtain those?

Thanks!!

  • Did you provide the permission to the account who pushing this transaction. Better you check first by the account with which you deployed your contract. – Nirdesh Kumar Choudhary Nov 30 '18 at 9:18
  • Yup! I provided the right permission to the account. I am probably passing a wrong parameter to ecc.signHash – jinjineos Dec 2 '18 at 7:21
  • Is the key that you are signing with the one assigned to the account that is authorizing the transfer? – John Haager Dec 5 '18 at 1:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.