0

I try to do several actions in one transaction on Wax blockchain in Node.JS. All accounts share same active key. Sometimes it works and everything is fine, but mostly I get an error: "assertion failure with message: Signing value already used".

Is there anything I can do for this to work?

Code:

//my clipboard contains actions data: [{account:'account', name: 'name', authorization: [{  actor: 'actor'  , permission: 'active' }], data: { player: 'player' }},{account:'account', name: 'name', authorization: [{  actor: 'actor'  , permission: 'active' }], data: { player: 'player' }},{account:'account', name: 'name', authorization: [{  actor: 'actor'  , permission: 'active' }], data: { player: 'player' }}]

var ncp = require('node-clipboardy');
var podaci = ncp.readSync();

const actionData = eval(`(${podaci})`);

const { Api, JsonRpc, RpcError } = require('eosjs');
const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig');
const fetch = require('node-fetch');
const { TextEncoder, TextDecoder } = require('util');

const defaultPrivateKey = "xxxprivate-keyxxxzxxxxxxxx";
const privateKeys = [defaultPrivateKey];
const signatureProvider = new JsSignatureProvider(privateKeys);

const rpc = new JsonRpc( "http://wax.greymass.com" , { fetch });
const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });

(async () => {
  try {
    const result = await api.transact({
        ...actionData
      
    } , {
        blocksBehind: 3,
        expireSeconds: 30,
    });

  }  catch (error) {

      console.log(error.toString())
      ncp.writeSync(error.toString()); //error to clipboard
      
  }

})();

0

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.

Browse other questions tagged or ask your own question.