I have created a MultiNode Setup using the Bios Boot sequence https://developers.eos.io/welcome/latest/tutorials/bios-boot-sequence. And created the accounts as 'eosio' & 'accountnum11'. I am trying create accounts using the 'eosjs' package as follows.
const { Api,JsonRpc,RpcError } = require('eosjs');
const { JsSignatureProvider} = require('eosjs/dist/eosjs-jssig');
const fetch = require('node-fetch'); // node only;
const { TextEncoder,TextDecoder} = require('util');
const defaultPrivateKey = config.PRIVATE_KEY;
const signatureProvider = new JsSignatureProvider([defaultPrivateKey]);
const api = new Api({
rpc,
signatureProvider,
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder()
})
try {
const result = await api.transact({
expiration: new Date(new Date().getTime() + 30 * 60000),
ref_block_num: 65981473,
ref_block_prefix: 4183230361,
actions: [{
account: 'eosio',
name: 'newaccount',
authorization: [{
actor: 'eosio',
permission: 'active',
}],
data: {
creator: 'eosio',
name: 'test',
owner:{
threshold: 1,
keys: [{
key: myPublic.toString(),
weight: 1
}],
accounts: [],
waits: []
},
active: {
threshold: 1,
key: [{
keys:myPublic.toString(),
weight: 1
}],
accounts: [],
waits: []
},
},
},
{
account: 'eosio',
name: 'buyrambytes',
authorization: [{
actor: 'eosio',
permission: 'active',
}],
data: {
payer: 'eosio',
receiver: 'test',
bytes: 8192
},
},
{
account: 'eosio',
name: 'delegatebw',
authorization: [{
actor: 'eosio',
permission: 'active',
}],
data: {
from: 'eosio',
receiver: 'test',
stake_net_quantity: '0.5000 SYS',
stake_cpu_quantity: '0.5000 SYS',
transfer: false,
}
}]
})
The above operation returns the following error.
Error: missing authority.keys (type=key_weight[])
at Object.serializeStruct [as serialize] (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-serialize.js:597:27)
at Object.serializeStruct [as serialize] (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-serialize.js:590:28)
at Object.exports.serializeActionData (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-serialize.js:1069:12)
at Object.exports.serializeAction (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-serialize.js:1078:23)
at Api.<anonymous> (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-api.js:311:71)
at step (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-api.js:49:23)
at Object.next (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-api.js:30:53)
at fulfilled (/home/crissi/Documents/EOSS/EOS-APPLICATION/node_modules/eosjs/dist/eosjs-api.js:21:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
Any workarounds for the error??