Skip to content

buildFromProperties

buildFromProperties(creatorUri, chainSpaceDesc?): Promise<IChainSpace>

Creates a new ChainSpace object in the CORD blockchain.

Parameters

creatorUri: did:cord:3${string}

The decentralized identifier (DID) URI of the entity creating the ChainSpace.

chainSpaceDesc?: string

(Optional) A custom description to represent the ChainSpace. If not provided, a default description is generated, incorporating a unique UUID.

Returns

Promise<IChainSpace>

A promise that resolves to an IChainSpace object, encompassing the ChainSpace’s identifier, description, hash digest, creator’s DID, and authorization URI.

Remarks

This function is designed to create a distinct ChainSpace on the CORD blockchain. A ChainSpace is a conceptual area within the blockchain, designated for managing specific data or assets under defined rules and permissions. The function generates a unique identifier and an authorization identifier for the new ChainSpace, based on the creator’s DID URI and an optional custom description.

Example

const creatorUri = 'did:cord:creator';
const customDesc = 'MyCustomChainSpace';
buildFromProperties(creatorUri, customDesc).then(chainSpace => {
console.log('Created ChainSpace URI:', chainSpace.uri);
}).catch(error => {
console.error('Error creating ChainSpace:', error);
});

Source

chain-space/src/ChainSpace.ts:72