Skip to content

Instantly share code, notes, and snippets.

@ezirmusitua
Created January 17, 2019 16:01
Show Gist options
  • Save ezirmusitua/1a034cbb5104874e8c44dce1aaa75331 to your computer and use it in GitHub Desktop.
Save ezirmusitua/1a034cbb5104874e8c44dce1aaa75331 to your computer and use it in GitHub Desktop.
[Create EOS account] create EOS account with eosjs #javascript #node #blockchain #eos
const config = {
chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',
keyProvider: ['MY PRIVATE KEY'],
httpEndpoint: 'https://api.eosnewyork.io:443',
verbose: false, // API activity
broadcast: true,
sign: true,
expireInSeconds: 60
}
// Create a client
const eos = Eos(config)
// Make a transaction to create a new account
eos.transaction(tr => {
tr.newaccount({
creator: 'myaccount',
name: 'coworker's account',
owner: pubkey,
active: pubkey
})
tr.buyrambytes({
payer: 'myaccount',
receiver: 'coworker's account',
bytes: 8192
})
tr.delegatebw({
from: 'myaccount',
receiver: 'coworker's account',
stake_net_quantity: '0.1000 EOS',
stake_cpu_quantity: '0.1000 EOS',
transfer: 0
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment