Connect to DID Space on Blocklet Setup
Overview#
If you want the application to determine during installation that all data will be stored on a specific DID Space (usually Owner) when starting up, then this tutorial will meet your needs.
By using this method of connecting to DID Spaces, the most typical application is NFT Maker. It connects to DID Spaces in the installation and startup process, obtaining the endpoint of the Owner's DID Space, and then all NFTs generated on the NFT Maker will be stored on this DID Space.
Prerequisite#
- You already have your own DID Space for debugging. If you don't have one yet, you can refer to for more information.
- Your application is configured with
blocklet.yml#capabilities.didSpace
set torequiredOnSetup
.
Operation process#
Owner shows DID Space NFT#
When your application is installed, during the first startup process, you will be asked to connect to DID Spaces. Please choose the DID Space you want to use.
After successful connection, click continue to complete the installation.
The application reads the user's DID Space endpoint.#
At this point, your application can read the endpoint of DID Space through environment variables while running. Its value is like: BLOCKLET_APP_SPACE_ENDPOINT
.
console.log(process.env.BLOCKLET_APP_SPACE_ENDPOINT);
// 输出形如: https://space.team.arcblock.io/app/api/space/zNKhe8jwgNZX2z7ZUfwNddNECxSe3wyg7VtS/app/zNKfEK9actwBeLhfVvc9U1p1CqVWxtivVxo6/object/