EOSIO / eosjs

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

newaccount error for DAWN3 #33

Closed zshchou closed 6 years ago

zshchou commented 6 years ago

code:

let testNewAccount = async () => {
  let adminPrivate = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3";
  config.keyProvider = [adminPrivate];
  let eos = Eos.Localnet(config);
  const pubkey = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV';

  try {
    let res = await eos.newaccount({
      creator: 'inita',
      name: 'initzsh',
      owner: pubkey,
      active: pubkey,
      recovery: 'inita',
      deposit: '1.0000 EOS'
    });
    console.log("res", res);
    return res;
  } catch (err) {
    console.log("err", err);
    return err;
  }
};

result:

{
  "transaction_id": "3b99204c9c817b1312419f7eb2c2503a918610403acb9d07346c016e02a02f2b",
  "broadcast": false,
  "transaction": {
    "compression": "none",
    "data": {
      "expiration": "2018-03-24T06:51:24",
      "region": 0,
      "ref_block_num": 21814,
      "ref_block_prefix": 1849637573,
      "packed_bandwidth_words": 23,
      "context_free_cpu_bandwidth": 0,
      "context_free_actions": [],
      "actions": [
        {
          "account": "eosio",
          "name": "newaccount",
          "authorization": [
            {
              "actor": "inita",
              "permission": "active"
            }
          ],
          "data": "000000000093dd74000000a0e19fdd740100000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000100000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000100000001000000000093dd7400000000a8ed3232010000"
        }
      ]
    },
    "signatures": [
      "EOSK4Sn3XmoTFDED3sgghhinwDVV6NtF42zP6LECDPCPufgctfJW9znWAnPh3tz4ibPS8r9e1fo68jcJmxuv73pQ6uoT8zkGr"
    ]
  }
}

query

eos git:(master) cleos get account initzsh
{
  "account_name": "initzsh",
  "permissions": []
}
chris-allnutt commented 6 years ago

@zshchou do you get an error if you attempt to create the account again? This may be an issue with RPC. I had a similar issue recently.

Also try setting recovery and creator as eosio. If you're running master there is only a single producer eosio right now.

zshchou commented 6 years ago

i use eosio, still error!

execure result

{
  "transaction_id": "e36668602da228c05eec0eb1190ea957182630e24501564b415fe521a80a6c8c",
  "broadcast": false,
  "transaction": {
    "compression": "none",
    "data": {
      "expiration": "2018-03-26T15:57:36",
      "region": 0,
      "ref_block_num": 743,
      "ref_block_prefix": 2782249341,
      "packed_bandwidth_words": 23,
      "context_free_cpu_bandwidth": 0,
      "context_free_actions": [],
      "actions": [
        {
          "account": "eosio",
          "name": "newaccount",
          "authorization": [
            {
              "actor": "eosio",
              "permission": "active"
            }
          ],
          "data": "0000000000ea30550000c80819aea69701000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf01000001000000010002c0ded2bc1f1305fb0faac5e6c03ee3a1924234985427b6167ca569d13df435cf0100000100000000010000000000ea305500000000a8ed32320100"
        }
      ]
    },
    "signatures": [
      "EOSKm3Szimh5f5v5EmYt2u5cJMPVhjyVRapCVUPyXVkEQXkH3KsGhppEZ2ABH7DsH4pQ3WL7TftbfaZXWAkymoTxYGhAssbg5"
    ]
  }
}

query result

➜  build git:(master) cleos get account mynewacct
{
  "account_name": "mynewacct",
  "permissions": []
}
zshchou commented 6 years ago

I am running master there is only a single producer eosio right now.

chris-allnutt commented 6 years ago

I see broadcast is set to false in your transaction "broadcast": false,

set broadcast to true in your config and see if that fixes it.

chris-allnutt commented 6 years ago

Documentation here: https://github.com/EOSIO/eosjs/blob/c9b873966442b0752cd4d1f0cede3b5784baf3cd/README.md#configuration

zshchou commented 6 years ago

it's ok, beacause yesterday if set broadcast:true, it not execute!

chris-allnutt commented 6 years ago

If broadcast is set to false it won't actually send the transaction, it just shows you what it would have sent. Set broadcast to true and we can work thru the error from there.

zshchou commented 6 years ago

so, thanks, can you solve the asset error? please visit my issue for asset error.

jcalfee commented 6 years ago

I added a comment in the asset error ticket: #34

Sounds like this can be closed.