Open account

🌐 POST

/v1/open-account

In AIRE, each student or entity is assigned a unique wallet address. This wallet is automatically generated using the student data (ex: Microsoft account, Student number) or it can be manually created by the student/faculty. But a wallet doesn't really hold any funds/university tokens. Those university tokens are stored on a subsection of our network, isolated from other tokens from other universities.

The wallet is used to verify the identity of the student/entity to grant access to the university tokens. Since a wallet can be generated without any network call or internet connection, it is mandatory to assiociate the wallet with an account.

JWT Payload

To open an account, you'll need to pass the wallet secret key in the JWT payload.

Example:

{
account: "wol2RpVsl15tr3rtvlbj79Stmqrv76KuKYA+FIlSzLnIN9F0R7uSSaCfal888IX24fzKm035RKfLdZnqmyKhIw==" // Please do not reutilize this key
}

Generating a wallet

Generating a wallet is pretty simple. You can either generate one using the student data or use random data.

To make this process easier, we have a wallet generator that will generate a wallet for you. But you can use the following code to generate a wallet:

import nacl from 'tweetnacl';
const data = new TextEncoder().encode("<string containing student data>");
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
const seed = new Uint8Array(hashBuffer);
const { publicKey, secretKey } = nacl.sign.keyPair.fromSeed(seed);

Request body

Although you don't need to provide any data, you can still add the following options:

Parameters:

  • initial_balance: The initial balance of the wallet. Make sure to provide a string with the right number of decimals. For example, with 9 decimals, if you want to set the initial balance to 1$, you should provide initial_balance: "1000000000". Default is "0".

Response body

Parameters:

  • account: The wallet public address.
  • tokenAccountRef: The university token account reference.
  • available: The amount of tokens in the university token account. If account doesn't exist already, it will be created with the amount of 0 (or the amount provided).

Example:

{
"account": "EUZuWt4ECBzdQvTGZQYSHouWA5bLnGS3oZDQ1nLTGwwx",
"tokenAccountRef": "ELequCzH47JM6jPsvngpsmgPHsfKTY2MKaAvUvZdf1Js",
"available": {
"amount": "0",
"decimals": 9,
"uiAmountString": "0",
"currency": "usd",
"guarantor": "aire"
}
}