新手问答 问一下 eosjs 中创建账户出错

gk5 · 2018年09月19日 · 171 次阅读

creatoraccount = "eosio" //主账号
newaccount = "hello11111" //新账号
newaccount_pubkey = "EOS7bvcXsuLgkJzVYrg56tpMPKpQfsaaG363RaGn55xPZYZWWmrn6" //新账号的公钥

//构建transaction对象
eos.transaction(tr => {
//新建账号
tr.newaccount({
creator: creatoraccount,
name: newaccount,
owner: newaccount_pubkey,
active: newaccount_pubkey
})

//为新账号充值RAM
tr.buyrambytes({
payer: creatoraccount,
receiver: newaccount,
bytes: 8192
})

//为新账号抵押CPU和NET资源
tr.delegatebw({
from: creatoraccount,
receiver: newaccount,
stake_net_quantity: '100.0000 SYS',
stake_cpu_quantity: '100.0000 SYS',
transfer: 0
})
}).then(result => console.log(result))

我在部署了eosio.bios合约之后,可以创建账户,但是没有购买到ram,和抵押资源;
{ account_name: 'hello12345',
head_block_num: 1217789,
head_block_time: '2018-09-19T08:01:54.000',
privileged: false,
last_code_update: '1970-01-01T00:00:00.000',
created: '2018-09-19T07:51:47.000',
ram_quota: -1,
net_weight: -1,
cpu_weight: -1,
net_limit: { used: -1, available: -1, max: -1 },
cpu_limit: { used: -1, available: -1, max: -1 },
ram_usage: 2724,
permissions:
[ { perm_name: 'active', parent: 'owner', required_auth: [Object] },
{ perm_name: 'owner', parent: '', required_auth: [Object] } ],
total_resources: null,
self_delegated_bandwidth: null,
refund_request: null,
voter_info: null }
然后我部署了eosio.system合约之后,直接报错
(node:5164) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): {"code":500,"message":"Internal Service Error","error":{"code":3050003,"name":"eosio_assert_message_exception","what":"eosio_assert_message assertion failure","details":[]}}
(node:5164) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册