Skip to main content

Create accounts

Account types

Codefi Assets requires the following account types:

  • An admin account - provided by ConsenSys.
  • An issuer account - created by the admin. This account can issue new tokens.
  • At least one investor account - created by the issuer. These accounts can transfer and burn tokens.
important

Make sure you have values for the variables AUTH_URL, AUTH_AUDIENCE, AUTH_CLIENT_ID, AUTH_CLIENT_SECRET, AUTH_USERNAME, AUTH_PASSWORD, CODEFI_API. If not, please send an email to [email protected].

Get the admin ID

important

Make sure you have generated an access token.

Execute commands
ADMIN_ID=$(curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
--request GET \
$CODEFI_API/utils/identity?userType=ISSUER | jq -r '.user.id')
echo ADMIN_ID=$ADMIN_ID
Example output
ADMIN_ID=02fd5e9b-90af-43d7-b069-9472a3ead00c

Create issuer account

Make a POST call to {{CODEFI_API}}/essentials/user?userId={{admin}} with the following body:

{
"email": "{{issuerEmail}}",
"firstName": "firstName",
"lastName": "lastName",
"userType": "ISSUER"
}
note

Authenticate the call with the admin access token.

Execute commands
ISSUER_ID=$(curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
--request POST --data '{ "email": "[email protected]", "firstName": "Bob", "lastName": "Issuer", "userType": "ISSUER" }' \
$CODEFI_API/essentials/user?userId=$ADMIN_ID | jq -r '.user.id')
echo ISSUER_ID=$ISSUER_ID
Example output
ISSUER_ID=02fd5e9b-90af-43d7-b069-9472a3ead00c

Create the first investor account

Make a POST call to {{CODEFI_API}}/essentials/user?userId={{issuerId}} with the following body:

{
"email": "{{issuerEmail}}",
"firstName": "firstName",
"lastName": "lastName",
"userType": "INVESTOR"
}
note

Authenticate the call with the admin access token.

Execute commands

INVESTOR1_ID=$(curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
--request POST \
--data '{ "email": "[email protected]", "firstName": "Carol", "lastName": "Investor", "userType": "INVESTOR" }' \
$CODEFI_API/essentials/user?userId=$ISSUER_ID | jq -r '.user.id')
echo INVESTOR1_ID=$INVESTOR1_ID
Example output
INVESTOR1_ID=02fd5e9b-90af-43d7-b069-9472a3ead00c

Create the second investor account

Create a second investor account.

Execute commands
INVESTOR2_ID=$(curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
--request POST \
--data '{ "email": "[email protected]", "firstName": "Dan", "lastName": "Investor", "userType": "INVESTOR" }' \
$CODEFI_API/essentials/user?userId=$ISSUER_ID | jq -r '.user.id')
echo INVESTOR2_ID=$INVESTOR2_ID
Example output
INVESTOR2_ID=02fd5e9b-90af-43d7-b069-9472a3ead00c

Check generated IDs

Run the following command and check all users have IDs:

Execute commands
echo ADMIN: $ADMIN_ID \\nISSUER: $ISSUER_ID \\nINVESTOR1: $INVESTOR1_ID \\nINVESTOR2: $INVESTOR2_ID
Example output
ADMIN: 5269fc95-96d4-4400-9f74-223a4db60341
ISSUER: be2c78e2-5eb2-4314-801e-c6c8f2b0fe96
INVESTOR1: 80c5aef6-6e3d-48b9-b3e6-f09ef5f29fd8
INVESTOR2: d3b43788-b2f3-4230-b358-b5c686df5951