Is there a way to create an account via eos js
For example I would to avoid having to go to http://monitor.jungletestnet.io/#account to create an account on the testnet, is that possible?
EOS.IO Stack Exchange is a question and answer site for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO. It only takes a minute to sign up.
Sign up to join this communityIs there a way to create an account via eos js
For example I would to avoid having to go to http://monitor.jungletestnet.io/#account to create an account on the testnet, is that possible?
Yes, it is possible. You can view the related EOS-JS documentation at the following link: https://github.com/EOSIO/eosjs/blob/e53c0e0bf791c22818ee3c9ea3592bcf1c0877ec/docs/2.-Transaction-Examples.md#create-new-account-multiple-actions
const result = await api.transact({
actions: [{
account: 'eosio',
name: 'newaccount',
authorization: [{
actor: 'useraaaaaaaa',
permission: 'active',
}],
data: {
creator: 'useraaaaaaaa',
name: 'mynewaccount',
owner: {
threshold: 1,
keys: [{
key: 'PUB_R1_6FPFZqw5ahYrR9jD96yDbbDNTdKtNqRbze6oTDLntrsANgQKZu',
weight: 1
}],
accounts: [],
waits: []
},
active: {
threshold: 1,
keys: [{
key: 'PUB_R1_6FPFZqw5ahYrR9jD96yDbbDNTdKtNqRbze6oTDLntrsANgQKZu',
weight: 1
}],
accounts: [],
waits: []
},
},
},
{
account: 'eosio',
name: 'buyrambytes',
authorization: [{
actor: 'useraaaaaaaa',
permission: 'active',
}],
data: {
payer: 'useraaaaaaaa',
receiver: 'mynewaccount',
bytes: 8192,
},
},
{
account: 'eosio',
name: 'delegatebw',
authorization: [{
actor: 'useraaaaaaaa',
permission: 'active',
}],
data: {
from: 'useraaaaaaaa',
receiver: 'mynewaccount',
stake_net_quantity: '1.0000 SYS',
stake_cpu_quantity: '1.0000 SYS',
transfer: false,
}
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
});