Skip to content

Create an Account

Introduction

All transactions on the blockchain are tied to a user account, and all transactions require that user to have a balance of credit (or "gas") in their account. In order to perform any transaction against the STRATO blockchain we need a user account.

What is an Account?

An account is your address on the blockchain, which is represented by a hex string (Eg: 65409fafb3f4a51c900368aa806bf5cb8fc800ef). An account always corresponds to a public-private key pair and the address is a derivation of the public key.

Since these long hex strings can be unfriendly to deal with, STRATO manages the keys for the user using an OAuth integration. Each STRATO instance has an inbuilt key vault that maps a user's OAuth identity to a public-private key pair.

Steps to Create an Account

There are two ways to create an account on a STRATO node. You can do this using the Dashboard or you can do this programmtically, using the API.

Create an Account Using the UI

Each STRATO node is configured to use an OAuth provider at the time it is deployed. When you try to access the STRATO UI on the configured port (Eg: http://localhost:8080), you will be redirected to the OAuth identity provider to verify your identity. On a successful login, the STRATO node will automatically create an account for you.

Create an Account Using the API

In order to create an account using the API, you first need to obtain a valid JWT token from the OAuth identity provider using either the authorization-code-grant flow, or the client-credential flow. You can use this token to make calls to the STRATO API to create a user account. Eg:

curl -X POST \
   -H "Authorization: Bearer <token>"
  http://<strato_host_address>/strato/v2.3/key

The above call will generate a public-private key pair for the user if it does not exist (if it does, the existing key pair is used) and return the STRATO account address corresponding to this key pair.

Our SDK, contains a utility to ease the task of obtaining OAuth tokens that can be used while testing and developing (see Deployment: OAuth2 Protocol).

Faucet (Add Value) to an Account

To perform transactions, an account must have a positive token balance to pay the gas price for each transaction. You can use the following API call to faucet an account

curl -X POST \
  -H "Authorization: Bearer <token>"
  http://<strato_host_address>/bloc/v2.2/users/user/{address}/fill

The above call will add 2000 tokens to the specified address. Note that the tokens are used as a guard against possible DoS attacks(a user uploading a contract that has code that executes indefinitely), but do not serve any monetary function in most STRATO networks.