1

When I try to put 2 authorities to updateauth I get this error Error: updateauth action should only have one declared authorization so how can I use another accounts CPU to change my keys not using bloks.io or another portal. I just want to use my accounts. On one I have resources, the other one doesn't!

Thanks in advance

2 Answers 2

1

You can refer to how bloks.io does. They use dummy action payforcpu and include it as the first action of free transaction. (Transaction can have multiple actions) You can make dummy action with any name, and include signature with the account which you want to make pay resources.

eosjs may check whether dummy action exists in contract ABI, so you need to deploy contract with dummy action, or write transaction by yourself and sign manually.

actions: [{
  account: "SOME_ACCOUNT",
  name: "payforcpu",
  authorization: [{
    actor: "ACCOUNT_YOU_WANT_TO_MAKE_PAY",
    permission: "active",
  }],
  data: {
    /* ... */
  },
}, {
  account: "eosio",
  name: "updateauth",
  authorization: [{
    /* ... */
  }],
  data: {
    /* ... */
  }
}]
1

If you are doing the transaction with cleos then you can just do this:

cleos push action CONTRACT ACTION DATA -p ACCOUNT1 -p ACCOUNT2

In this example, ACCOUNT1 will pay for the resources

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.