EOSEssentials / eos-java-rpc-wrapper

http://www.eos42.io
MIT License
161 stars 76 forks source link

Creating an account #8

Closed jaybxyz closed 6 years ago

jaybxyz commented 6 years ago

I am opening another issue for creating an account.

There is an API for creating a wallet, but it doesn't seem like there is an API for creating an account.

Am I right?

This really relates to the previous issue that I posted.

There needs to be some configuration when creating the rest client.

It is something like below when using eosjs

const config = {
    chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', 
    keyProvider: [ privKey ], // THIS PART
    httpEndpoint: 'https://api.eosnewyork.io:443',
    verbose: false,
    broadcast: true,
    sign: true,
    expireInSeconds: 60
}
spebern commented 6 years ago

This library is a direct wrapper for eosio's http api. The http api doesn't provide any direct calls to create an account:

https://developers.eos.io/eosio-nodeos/reference

However you can easily build that functionality around this library, because creating an account, as all other extended functionality eos provides, is really just a transaction.

  1. transform the action args into binary (abiToJsonBin)
  2. create the transaction
  3. sign the transaction (signTransaction)
  4. broadcast the transaction (pushTransaction)
jaybxyz commented 6 years ago

@spebern

Like you said, all other extended libraries including eosjs uses http api. I was hoping this library provides the same functionality as eosjs.

I may have to take a look how eosjs library uses http api to create, sign, broadcast the transaction.

Have you tried creating a new account in mainnet by any chance?

spebern commented 6 years ago

No I haven't used the mainnet yet I only used the api to create accounts in a local docker container.

I had a brief look at eosjs. It seems that it uses an external dependency for signing the transactions if a private key is provided in the config:

https://github.com/EOSIO/eosjs-ecc

jaybxyz commented 6 years ago

@spebern Great! using eosjs, I could be able to create a new account in mainnet and transfer EOS with success. However, I need java version of eosjs, so that I can work on the server-side.