Preliminary

World ID is an open and permissionless identity protocol developed to help establish Proof of Personhood (PoP) on a global scale.

World ID functions as a digital “passport” that lives locally on its holder’s phone and can be used to privately prove that they are a real and unique person. This privacy is possible thanks to the use of zero-knowledge proofs (ZKP) that prevent third parties from knowing a person’s World ID public key or tracking them across applications. ZKPs also protect the use of World ID from being tied to the iris code of the person or any data used in its creation.

Worldcoin (World ID) core contracts are currently deployed on Ethereum, where the Merkle Tree for all the identities are maintained. These connect with other chains like Polygon and Optimism by duplicating the state on each chain.

Worldcoin architecture overview

Worldcoin smart contracts design

Drawbacks of the current design

While Worldcoin’s current architecture works well in a silo on a single chain, it does not scale well to deploy on multiple chains concurrently:

  1. Duplicated State
    Currently, each chain that needs to integrate with World ID needs to copy over the entire merkle tree from Ethereum and maintain a duplicated state
  2. Economic Security of Relayer
    The Relayer is a key piece in the architecture whose task is to duplicate the state updates on Ethereum to other chains. Although the relayer being a criticial component, it is not backed by any economic securities for scenarios where the relayer could turn malicious.

While Worldcoin has been trying to address these issues by launching their own L2 (WorldChain) and with Wormhole integration, we believe integration with Skate Chain solves these issues in a much efficient and scalable way. Our integration can focus on enabling PoP for TON ecosystem

Worldcoin integration with Skate

World coin proposed design with Skate

By adopting Skate, Worldcoin can gain the following advantages:

  1. Unified State Management
    With Skate Chain , the World Identity Manager is deployed as a Kernel Contract which manages a singleton state. The state is accessible via all the integrated contracts

  2. Economic Security via EigenLayer
    Skate Chain works as an AVS on EigenLayer, backed by billions of dollars of economic security, which is susceptible to slashing should any component of the chain misbehave.

  3. Scalability to EVM and non-EVM chains
    With Skate, the state management is operable across all major L1s and L2, for both EVM and non-EVM. This enables Worldcoin to become universally deployable by just deploying periphery contracts that serve as an interface to interact with the Kernel.

Worldcoin PoP as a Stateless App

The following outline implementation specifications of Worldcoin PoP as a stateless app

Kernel

Sample User Intent

IntentSample.json
{
    "user": "0xUserAddress",
    "intentData": {
        "appAddress": "0xKernelContractAddress",
        "intentCalldata": "0x6a6278420000000000000000000000000000000000000000000000000000000000000042",
        "originChain": 1
    },
    "proofData": [
        "0xRootValue",
        "0xNullifierHash",
        [
            "0xProof0", "0xProof1", "0xProof2", "0xProof3", "0xProof4", "0xProof5", "0xProof6", "0xProof7"
        ]
    ],
    "signature": "0xUserSignature"
}

Sample Task Structure

TaskSample.json
{
    "appAddress": "0xPeripheryContractAddress",
    "taskCalldata": "0x4c15a3aa0000000000000000000000000xUserAddress",
    "user": "0xUserAddress",
    "chainId": 1
}

Worldcoin Kernel Implementations

WorldcoinApp.sol
/// import Skate directives... SkateApp, ImessageBox
import "@worldcoin/world-id-contracts/WorldID.sol";
import "@worldcoin/world-id-contracts/interfaces/IWorldID.sol";

contract WorldcoinApp is SkateApp {
    IWorldID internal worldId;
    uint256 internal externalNullifierHash;
    uint256 internal groupId = 1;

    mapping(uint256 => bool) internal nullifierHashes;

    constructor(IWorldID _worldId, string memory _appId, string memory _action) {
        worldId = _worldId;
        externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToField(), _action).hashToField();
    }

    /// This function initiate an intent to sync state proof on all periphery chains
    /// @expected Push corresponding tasks into messageBox for execution
    function processIntent(IMessageBox.Intent calldata intent)
        external
        override
    {
        (bool success, bytes memory data) = address(this).call(intent.intentData.intentCalldata);
        require(success, "IntentProcessingReverted");

        IMessageBox.Task[] memory tasks = abi.decode(data, (IMessageBox.Task[]));
        _messageBox.submitTasks(tasks, intent);

        uint256 root;
        uint256 nullifierHash;
        uint256[8] memory proof;

        (root, nullifierHash, proof) = abi.decode(intent.proofData, (uint256, uint256, uint256[8]));

        if (nullifierHashes[nullifierHash]) revert InvalidNullifier();

        worldId.verifyProof(
            root,
            groupId,
            abi.encodePacked(intent.user).hashToField(),
            nullifierHash,
            externalNullifierHash,
            proof
        );

        nullifierHashes[nullifierHash] = true;

        IMessageBox.Task memory task = IMessageBox.Task({
            appAddress: chainIdToPeripheryContract(intent.intentData.originChain),
            taskCalldata: abi.encodeWithSignature("updateMapping(address)", intent.user),
            user: intent.user,
            chainId: intent.intentData.originChain
        });

        _messageBox.submitTask(task);
    }
}

Periphery

Worldcoin Periphery contracts

WorldcoinPeriphery.sol
/// import Skate directives... SkateAppPeriphery
contract WorldcoinPeriphery is SkateAppPeriphery {
    function executeTask(IMessageBox.Task calldata task) external onlyGateway {
        (bool success,) = address(this).call(task.taskCalldata);
        require(success, "TaskExecutionFailed");
    }

    function updateMapping(address user) external {
        // Logic to update mapping
    }

    function isVerified(address user) internal view returns (bool) {
        // Logic to check if user is verified
    }
}

Conclusion

This integration proposal presents a unique opportunity for Worldcoin to overcome existing scalability issues and enhance its multi-chain capabilities, user experience, and system security, leveraging Skate Chain’s innovative design and technology. Please refer to Skate Architecture to have a thorough understanding of Skate Chain’s internal architecture