Design Goals
NFT holders on Ethereum or other EVM chains, can use the same NFT as identity in Harmony. Harmony provides API/SDK for dApp developers to use cross-chain NFT identity in metaverse/games.
A long term solution is a trustless cross-chain identity protocol supporting multiple chains, most likely working with LitProtocol. For EthDenver showcase, we will focus on a semi-trusted version of the universal identity to bring high profile NFT, such as BAYC/MAYC, to Harmony protocol as identity.
Scope of Work
- Relayer: a relayer node periodically relays NFT holding state from Ethereum to Harmony. It has to monitor the ERC721 contract events to relay the states on-time.
- Whitelisted Asset Map: a whitelisted NFT list with mapping contracts between Ethereum and Harmony.
- Verification Smart Contract: identical/mapping smart contract on Harmony to support whitelisted assets on Ethereum, so that dApp can use it to verify the ownership of NFTs. The ownership state should be mapped to the same state in Ethereum. We use BAYC contract as the example one for the demo.
- Demo App: demo app such as DFK to embrace the NFT on Ethereum and showcase the picture in the dApp.
Smart Contract
Smart contract on Harmony to store the ERC721 mapping data. And allow the deployer to update the mapping data. It shall also provide a public interface for other dApp to query the ownership of the NFT.
The Smart contract implements an adapter pattern for ERC721. It defines a subset of the ERC721 interfaces. It allows other dApp call the Smart Contract as a normal ERC721 contract while supporting trusted relayer process/app update the state of the Smart contract. With the approach, it minimizes the cost of dApp integrating with the Smart contract. From the dApp perspective, the Smart Contract is just an ERC721 contract. The logic of syncing from Ethereum is transparent to dApp. The Smart Contract should be read-only to dApp. The dApp can only read data from the Smart Contract. The dApp cannot “write” to the Smart contract. All “write” operations like “burn” would fail with error messages like “Not support operation”.
Relayer
The relayer will connect to Ethereum and periodically update the smart contract on Harmony with the NFT ownership map. The relayer shall only update whitelisted smart contracts. The relayer may also monitor the event on Ethereum such as the BAYC ERC721 smart contract and update accordingly when there is any update.
The relayer node operator shall only be run by Harmony. We shall also look into a trustless way to update the smart contract by users directly.
Use Case
Users may use their BAYC pfp in DFK’s avatar.
A published website like https://bridge.harmony.one to list the whitelisted NFT from Ethereum to Harmony.
Demo
DFK needs to add support to query users’ accounts to verify the ownership of BAYC NFT via a mapped ERC721 smart contract.
If a user’s account holds a BAYC, their avatar may be automatically changed to their BAYC pfp.
It can be added to the beta website of DFK.