0

Please help! I'm currently encountering the ff. error

Uncaught Error: Non-base58 character at Object.decode (eosjs-jssig.js:26) at Object.checkDecode (eosjs-jssig.js:15) at y (eosjs-jssig.js:15) at Function.g.fromString (eosjs-jssig.js:15) at new e (eosjs-jssig.js:15) at displaybal:25

Here is a snapshot of my code

const defaultPrivateKey = "5JtUScZK2XEp3g9gh7F8bwtPTRAkASmNrrftmx4AxDKD5K4zDnr"; // bob
const addPrivateKey =     "EOS8i1CXTY4Sz39XaQWX2RpccsCZ1nWM3w9zRhjCFChdci2Y65ck4";
const rpc = new eosjs_jsonrpc.JsonRpc('http:///65.52.186.97:8888');
const signatureProvider = new eosjs_jssig.JsSignatureProvider([addPrivateKey]);
const api = new eosjs_api.Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });

(async () => {
try {
const result = await api.transact({
    actions: [{
        account: 'eosio',
        name: 'newaccount',
        authorization: [{
        actor: 'eosio',
        permission: 'active',
        }],
        data: {
        creator: 'eosio',
        name: 'testnewaccount',
        owner: {
            threshold: 1,
            keys: [{
            key: 'EOS8i1CXTY4Sz39XaQWX2RpccsCZ1nWM3w9zRhjCFChdci2Y65ck4',
            weight: 1
            }],
            accounts: [],
            waits: []
        },
        active: {
            threshold: 1,
            keys: [{
            key: 'EOS8i1CXTY4Sz39XaQWX2RpccsCZ1nWM3w9zRhjCFChdci2Y65ck4',
            weight: 1
            }],
            accounts: [],
            waits: []
        },
        },
    }]
    }, {
    blocksBehind: 3,
    expireSeconds: 30,
    });
  console.log(result);
} catch (e) {
  returnmsg = '\nCaught exception: ' + e;
  if (e instanceof eosjs_jsonrpc.RpcError)
  returnmsg += '\n\n' + JSON.stringify(e.json, null, 2);
  console.log(returnmsg);
}
  })();

My tools are

Angular CLI: 7.3.8 Node: 10.15.3 Angular: 7.2.12 Windows 10 chrome Version 73.0.3683.86 (Official Build) (64-bit)

1

You addPrivateKey is pointing to a public key instead of a private one. JSSignatureProvider expect a private key

| improve this answer | |

Your Answer

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

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