Skip to content

Instantly share code, notes, and snippets.

@bensig
Last active June 30, 2021 19:00
Show Gist options
  • Save bensig/afe79b5d2483c9250b1224c9e54f59e0 to your computer and use it in GitHub Desktop.
Save bensig/afe79b5d2483c9250b1224c9e54f59e0 to your computer and use it in GitHub Desktop.
Creating Accounts on Proton

Creating a Proton Account

Creating an account on Proton requires 3 actions that must be bundled together:

  1. Create account with new public key account: 'eosio', name: 'newaccount'
  2. Buy RAM for new account - minimum 3k - suggested 12k account: 'eosio', name: 'buyrambytes'
  3. Resource New Account in Proton users table account: 'eosio.proton', name: 'newaccres'

Variables

  • newAccountName - name of new account: 12 chars (a-z, 1-5)
  • creator - account creator name
  • newAccountOwnerKey - new EOSIO public key for account
  • ramPerAccount - minimum 3k, recommended 12k

Cleos

Example account creation with cleos

pcleos.sh system newaccount --buy-ram-kbytes <ramPerAccount> <creator> <newAccountName> <newAccountOwnerKey> --stake-net "0.0000 XPR" --stake-cpu "0.0000 XPR";
pcleos.sh push action eosio.proton newaccres '["<newAccountName>"]' -p <creator>

EOSJS

Example account creation with eosjs

const ramPerAccount = “12000”;

const actions = [
        {
          account: 'eosio',
          name: 'newaccount',
          data: {
            creator: creator,
            name: newAccountName,
            owner: {
              threshold: 1,
              keys: [{
                key: newAccountOwnerKey,
                weight: 1
              }],
              accounts: [],
              waits: []
            },
            active: {
              threshold: 1,
              keys: [{
                key: newAccountOwnerKey,
                weight: 1
              }],
              accounts: [],
              waits: []
            }
          }
        },
        {
          account: 'eosio',
          name: 'buyrambytes',
          data: {
            payer: creator,
            receiver: newAccountName,
            bytes: ramPerAccount
          }
        },
        {
          account: 'eosio.proton',
          name: 'newaccres',
          data: {
            account: newAccountName
          }
        }
      ]

Example Transactions

Check the action details here:

https://proton.bloks.io/transaction/bd889d2d65e6dd225bccd5558c96f24ca1df41a539f6da64c50e6e6e7ffd744b?tab=traces

https://proton.bloks.io/transaction/78e62a7a798fcc7d0d3e983f021cdff9bbe29458c9060241b2e2e5236590bfe4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment