Interacting with the L2PS
The l2ps
module exposes various methods to easily interact with on-chain Subnets.
As Subnets are always registered on the Demos Network, their data is publicly available. Due to the strong encryption, anyway, only their members are able to decrypt and view the content of that data.
This mechanism is crucial to ensure data integrity while not compromising privacy and security.
For this reason, once a Subnet instance is created, it will be able to interact with the on-chain data pertaining to that specific Subnet.
All the following methods are to be called from the L2PS
class instance you created in the previous step (for example: await instance.getParticipatingNodes()
).
getParticipatingNodes
This method retrieves the members, also called nodes, of the Subnet instance updated to the last block.
Arguments: None
Returns: Promise<Map<string, string>>
getTx
This method retrieves an encrypted transaction from the on-chain Subnet, decrypts it and returns the plain Transaction.
Arguments:eHash: string // the hash of the encrypted transaction
Returns: Promise<Transaction>
registerTx
This method accepts a standard Demos Transaction, encrypts it using the L2PS Public Key and send it to the on-chain Subnet instance.
Arguments: tx: Transaction // A standard Demos Transaction
Returns: Promise<string> // The eHash of the encrypted Transaction
Last updated