Is it possible to create an account in mainnet using RPC calls?

First, I built EOSIO nodeos in my own remote server, and I successfully created my coworker's account using cleos.

$ cleos system newaccount <MY ACCOUNT> <COWORKER's ACCOUNT> <owner-publickey><active-publickey> --stake-net "0.1 EOS" --stake-cpu "0.1 EOS" --buy-ram-kbytes 4

Now, I went on to create an account using RPC call for my web service.

However, there is not system api available from developers.eos.io/eosio-nodeos/reference.

I went on to search a bit deeper.

As I felt a bit frustrated, I decided to test this eosjs library to make a new account using one of the Block Producer's public API endpoints, and it worked!

The source code is like this.

// Configure BP httpEndpoint and chainId
const config = {
  chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', 
  keyProvider: ['MY PRIVATE KEY'],  
  httpEndpoint: 'https://api.eosnewyork.io:443',
  verbose: false, // API activity
  broadcast: true,
  sign: true,
  expireInSeconds: 60

// Create a client
const eos = Eos(config)

// Make a transaction to create a new account
eos.transaction(tr => {
    creator: 'myaccount',
    name: 'coworker's account',
    owner: pubkey,
    active: pubkey

    payer: 'myaccount',
    receiver: 'coworker's account',
    bytes: 8192

    from: 'myaccount',
    receiver: 'coworker's account',
    stake_net_quantity: '0.1000 EOS',
    stake_cpu_quantity: '0.1000 EOS',
    transfer: 0

I wonder how could this be possible? I believe eosjs library uses https APIs, right? Is there something I am missing?

Thanks in advance.

  • What exactly is the question here? Are you asking how to use eosjs?
    – tmm
    Commented Jul 12, 2018 at 8:56
  • @TeeAttack42 I am asking making a new account using eosjs works well. But, how? because there is no HTTP api that is available to request to make a new account.
    – JayB Kim
    Commented Jul 12, 2018 at 9:00
  • when you use cleos, you can do this, cleos --print-request --print-response system newaccount, and you will find all the requests send to the node, the command will send many requests.
    – Jimmy Guo
    Commented Jul 12, 2018 at 10:00

1 Answer 1


Yes it is possible. The eosjs library uses the HTTP-RPC Endpoints you mentioned aswell.

The RPC calls to look at are the push_transaction(s) calls.

For standard actions like buyrambytes, newaccount and delegatebw the eosjs library has implemented some "shortcuts". The library will build a transaction containing the action and build the required JSON structure with signatures and block infos which will be pushed to the chain ( or endpoint you defined).

The required data will be the JSON-Body of the HTTP request and will look something like this.

 expiration: 1,
 ref_block_num: 1,
 ref_block_prefix: 1,
 max_net_usage_words: 1,
 max_cpu_usage_ms: 1,
 delay_sec: 1,
 context_free_actions: [ '' ],
 actions: [ "create account" ],
 signatures: [ keys ],
 context_free_data: [ '' ],
 transaction_extensions: '' },
  • I really appreciate for taking the time to explain in detail.
    – JayB Kim
    Commented Jul 12, 2018 at 9:28
  • @JayBKim No problem. If this answer does satisfy your question please mark it as accepted so others will find it aswell.
    – tmm
    Commented Jul 12, 2018 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.