EVM

How to generate the proof with EVM?

const generate = async (schemaId: string, appid: string) => {
    try {
      // The appid of the project created in dev center
      const appid = "8fb9d43c-2f24-424e-a98d-7ba34a5532f5"
  
      // Create the connector instance
      const connector = new TransgateConnect(appid)
  
      // Check if the TransGate extension is installed
      // If it returns false, please prompt to install it from chrome web store
      const isAvailable = await connector.isTransgateAvailable()
  
      if (isAvailable) {
        // The schema id of the project
        const schemaId = "516a720e-29a4-4307-ae7b-5aec286e446e"
  
        // Launch the process of verification
        // This method can be invoked in a loop when dealing with multiple schemas
        const res = await connector.launch(schemaId)
        
        // If you want to send the result to the blockchain, please add the wallet address as the second parameter.
        // const res = await connector.launch(schemaId, address)
  
        // verifiy the res onchain/offchain based on the requirement     
        
      } else {
        console.log('Please install TransGate')
      }
    } catch (error) {
      console.log('transgate error', error)
    }
  }

The result includes two signatures: the allocator signature and the validator signature. Developers should verify both signatures based on the other returned fields.

Verify Allocator Signature

Encode the allocator message struct

Recover the allocator address

Check if the signed allocator address is registered. The current allocator address is fixed.

Verify Validator Signature

Encode the validator message

Recover the validator address

Verify if the signed validator address matches the address assigned by the allocator

Here, we've only given the reference code for off-chain verification. However, the result can also be verified on-chain.

Last updated