Comment on page

Delay Blockchain Account Creation

Control when a user's blockchain account is created.


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
Create a new ORE ID Account
The endpoint to reset the delayed account creation flag is:
Update the delay_wallet_setup flag
Note: You can only change this value on an account that has not had a wallet setup yet.