You need to sign the transaction you can do it by
eosConfig = {keyProvider: ['YOUE_PRIVATE_KEY']} let eos = Eos(eosConfig) eos.transaction(tr => { tr.newaccount({ creator: 'eosio', name: 'account1', owner: pubkey, active: pubkey }) \.then( (resp) =>{ console.log("EOS resp ", resp);});
eosConfig = {keyProvider: ['YOUR_CREATOR_PRIVATE_KEY']}
let eos = Eos(eosConfig)
eos.transaction(tr => {
tr.newaccount({
creator: 'eosio',
name: 'account1',
owner: pubkey,
active: pubkey
}) \.then( (resp) =>{
console.log("EOS resp ", resp);});
As you are on localnet then you need only one parameter to pass in eosConfig which is keyProvider.