EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

Create account error code 3040000. #231

Closed stone89son closed 6 years ago

stone89son commented 6 years ago

Can somebody help with a complete example of how to create a new account This is the code:

`Eos = require('eosjs')

// Default configuration (additional options below) const eos = Eos({ chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', httpEndpoint: 'https://mainnet.eoscannon.io', broadcast: true, debug: false, sign: true, expireInSeconds: 60, keyProvider: ['5K...........'], });

const account_name='bvighoncakot'; const creator = 'gy4domzsg4ge';

let testNewAccount = async () => {

const { PrivateKey, PublicKey } = Eos.modules.ecc;
const d = await PrivateKey.randomKey();
const private_key = d.toWif();
const public_key = d.toPublic().toString();

//console.log('Private Key: ',private_key);
//console.log('Public Key: ',public_key);
try {

  let res = await eos.newaccount({
  creator: creator,
  name: account_name,
  owner: public_key,
  active: public_key
  });
  console.log("[RES]", res);
  return res;
} catch (err) {
console.log("[ERR]", err);
return err;

} }; testNewAccount();`

This is the error I get: api < error undefined https://mainnet.eoscannon.io/v1/chain/push_transactio n {"compression":"none","transaction":{"expiration":"2018-06-30T10:49:38","ref_b lock_num":8129,"ref_block_prefix":493828416,"net_usage_words":0,"max_cpu_usage_m s":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name ":"newaccount","authorization":[{"actor":"gy4domzsg4ge","permission":"active"}], "data":"a01861f84b9a8867905d35685287dd3e01000000010003af819bdf8f96ee2ee4dc55c08c 1717c47a52dcae75f40bf7bddbda2cecf5f6bb0100000001000000010003af819bdf8f96ee2ee4dc 55c08c1717c47a52dcae75f40bf7bddbda2cecf5f6bb01000000"}],"transaction_extensions" :[]},"signatures":["SIG_K1_KcpbDecbSZXyy3FZwMB1r55sQMCUx5hF4GpHANrGw6gQtXHfHmPPR LwQL4thrBJ5uyRwmTBxfGnizDkXQSG2hQECm2S5J6"]} { Error: {"code":500,"message":"Internal Service Error","error":{"code":3040000, "name":"transaction_exception","what":"transaction exception","details":[]}} at D:\Coin test\eos account\node_modules\eosjs-api\lib\apigen.js:95:23 at at process._tickCallback (internal/process/next_tick.js:188:7) status: 500, statusText: 'Internal Server Error' } [push_transaction error] '{"code":500,"message":"Internal Service Error","error" :{"code":3040000,"name":"transaction_exception","what":"transaction exception"," details":[]}}', transaction '4260375bc11f40396f1d00000000010000000000ea305500409 e9a2264b89a01a01861f84b9a886700000000a8ed323266a01861f84b9a8867905d35685287dd3e0 1000000010003af819bdf8f96ee2ee4dc55c08c1717c47a52dcae75f40bf7bddbda2cecf5f6bb010 0000001000000010003af819bdf8f96ee2ee4dc55c08c1717c47a52dcae75f40bf7bddbda2cecf5f 6bb0100000000' {"code":500,"message":"Internal Service Error","error":{"code":3040000,"name":"t ransaction_exception","what":"transaction exception","details":[]}} [ERR] {"code":500,"message":"Internal Service Error","error":{"code":3040000,"na me":"transaction_exception","what":"transaction exception","details":[]}}

jcalfee commented 6 years ago

https://github.com/EOSIO/eosjs/blob/a4ef6db894855919f2f00f82dcb72ced054694cc/docker/docker-compose.yml#L12

stone89son commented 6 years ago

Thank you.

heshaofeng1991 commented 5 years ago

@stone89son i have the same question,how did you solve it?