Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Anonymous Accounts Steps

Amiya Behera edited this page Nov 18, 2023 · 3 revisions

Phala Smart contract generates a strong password, or just ui or fronted app generates a strong password.

{
 "address": "0x76e01859d6cf4a8637350bdb81e3cef71e29b7c2",
 "msg": "Password",
 "sig": "0x21fbf0696d5e0aa2ef41a2b4ffb623bcaf070461d61cf7251c74161f82fec3a4370854bc0a34b3ab487c1bc021cd318c734c51ae29374f2beb0e6f2dd49b4bf41c",
 "version": "2"
}

You need to sign with your kyc account using the password as message and verify that the account is yours inside phala contract.

https://www.phala.network/en/ (Trustless contract with data confidentiality)

0x76e01859d6cf4a8637350bdb81e3cef71e29b7c2 signed Password

import { stringToU8a, u8aToHex } from '@polkadot/util';
import { signatureVerify } from '@polkadot/util-crypto';

// create Alice based on the development seed
const alice = keyring.addFromUri('//Alice');

// create the message and sign it
const message = stringToU8a('this is our message');
const signature = alice.sign(message);

// verify the message using Alice's address, this is done inside phala network smart contract
const { isValid } = signatureVerify(message, signature, alice.address);

// output the result
console.log(`${u8aToHex(signature)} is ${isValid ? 'valid' : 'invalid'}`);

https://polkadot.js.org/docs/keyring/start/sign-verify/

Then sign using anonymous account using the same password and verify that the account is yours.

Than phala network smart contract links the two accounts. Communication between shivarthu blockchain and phala contract can be done with XCM or offchain workers.

Clone this wiki locally