Delay Blockchain Account Creation

Control when a user's blockchain account is created.

Overview

When a new user authenticates for the first time, blockchain accounts are automatically created. It is possible to modify this behavior and trigger the wallet creation process when desired. An example is to engage blockchain account creation after a user's successfully completes a pay wall.

Creating accounts on some blockchains costs a fee or resources. You can avoid paying these fees upon the creation of a new user and instead wait until the user does something of value (e.g. buy an NFT) before having the blockchain accounts created.

Delay Blockchain Account Creation using OreId-js

To not automatically create blockchain accounts on first login, pass-in the ‘delayWalletSetup’ option on auth.

oreId.popup.auth({ provider: 'google', delayWalletSetup: true })

The user may log in as many times as they wish - they will not be prompted to set up their wallet (e.g. enter their password to create their wallet)

To disable delayed wallet setup for a user, call disableDelayedWalletSetup() on the user object. Example:

await oreId.auth.user.disableDelayedWalletSetup()

The next time the user authenticates, they will be prompted to set up their wallet.

Hint: If this setting is in force for a user, you’ll see a property in their user data called delayWalletSetup:

{
    accountName: "ore…",
    name: "Christy Wilson",
    chainAccounts: [{…}],
    delayWalletSetup: true,

}

Also, user.chainAccounts.permissions may have an accountType of ‘pending’.These blockchain account will be created in the future when the wallet is set up - however, only some future accounts may appear here.

The following OreId-js functions also now support the delayWalletSetup option:

auth.newAccountWithIdToken({ ..., delayWalletSetup: true })
custodialNewAccount({ ..., delayWalletSetup: true })

Using the API

The following API endpoints now supports a property to enable delayedWalletSetup when a user’s account is created:

Create a new custodial user on the ORE ID Service

POST https://service.oreid.io/api/custodial/new-user

Returns the 12 character ORE ID account name of the custodial account created.

Headers

NameTypeDescription

api-key*

String

The api-key for your application on ORE ID.

service-key

String

The service account key for ORE ID Enterprise.

Content-Type*

String

application/json

Request Body

NameTypeDescription

access_token

String

Access Token returned from successful login with Oauth provider.

access_token_provider

String

Login provider that produced the above access_token

account_type*

String

"native" or "pending"

user_password*

String

Password to encrypt the private keys.

name*

String

User's full name.

user_name*

String

User's display name.

email*

String

User's email address.

picture*

String

URL of the user's profile picture.

phone*

String

User's phone number in the following format: +12223334444

email_verified*

Boolean

The status of the email address being verified by the Oauth provider.

is_test_user*

Boolean

delay_wallet_setup*

Boolean

Enables/disables to the blockchain wallet creation when the account logs in to ORE ID.

{
  "processId": "8c4aba8cd1b7",
  "accountName": "ore1s21pymgr"
}

Create a new ORE ID Account

POST https://service.oreid.io/api/account/new-user-wth-token

Returns an OAuth accessToken which may be included in the header of future requests to other api endpoints. The access token is scoped to a single user

Headers

NameTypeDescription

api-key*

String

The api-key for your application on ORE ID.

service-key

String

The service account key for ORE ID Enterprise.

Request Body

NameTypeDescription

id_token*

String

Issued by an Oauth provider. The Oauth provider domain (iss) must be registered in your ORE ID app registration.

delay_wallet_setup

Boolean

Enables/disables to the blockchain wallet creation when the account logs in to ORE ID.

{
  "account": "ore123456789",
  "accessToken": "ey..."
}

The endpoint to reset the delayed account creation flag is:

Update the delay_wallet_setup flag

POST https://service.oreid.io/api/account/update-delay-wallet-setup

If delay_wallet_setup value is True, the blockchain wallet will not be created.

Headers

NameTypeDescription

api-key*

String

The api-key for your application on ORE ID.

Content-Type*

String

application/json

Request Body

NameTypeDescription

account*

String

The ORE ID account that will be targeted.

delay_wallet_setup*

Boolean

True will keep the delay wallet setup flag in place. This will not allow ORE ID to create a blockchain wallet for the user. False will allow the account to setup a blockchain wallet upon the user's next login or transaction.

 {
  "processId": "47d910365bbf",
  "accessToken": "eyJhbGci...",
  "idToken": "eyJhbGci..."
}

Note: You can only change this value on an account that has not had a wallet setup yet.

Last updated