For Developers

This page provides technical guidance on how UID works, and how to integrate it with your protocol or dApp.

UID should be considered alpha software. It is used by the Goldfinch network, and we would love to see other protocols utilize the tool, but Warbler Labs cannot guarantee support or maintenance at this time. Use UID at your own risk. If you have questions or feedback, please contact us at [email protected]. We'd love to hear from you!

Integrating UID in your smart contracts

To integrate UID into your smart contracts, simply check the balance of your user's address to see if they possess the UID token. In Solidity, it would look like this:

# This is using OpenZeppelin's ERC1155 preset contracts:
# https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

contract MyContract {
    address UID_CONTRACT = "0xba0439088dc1e75f58e0a7c107627942c15cbb41";
    uint256 public constant ID_VERSION_0 = 0;

    function hasUID(address userAddress) returns (bool) {
        uint256 balance = IERC1155(UID_CONTRACT).balanceOf(userAddress, ID_VERSION_0);
        return balance > 0
    }
}

Note: UID currently only operates on Ethereum mainnet. The contract itself can be found here

Integrating UID in your dApp

For your front-ends, you can similarly integrate UID with the following

var Web3 = require('web3');
const web3 = new Web3(Web3.givenProvider);
const minimalAbi = [{"inputs": [{"internalType": "address", "name": "account", "type": "address"}, {"internalType": "uint256", "name": "id", "type": "uint256"}], "name": "balanceOf", "outputs": [{"internalType": "uint256","name": "","type": "uint256"}], "stateMutability": "view", "type": "function"}]
const uidAddress = "0xba0439088dc1e75F58e0A7C107627942C15cbb41"
const UID = new web3.eth.Contract(minimalAbi, uidAddress)

async function hasUID(userAddress) {
  const VERSION_0 = 0
  const balance = parseInt(await UID.methods.balanceOf(userAddress, VERSION_0).call())
  return balance > 0
}

Getting new users verified

If your users don't already have a UID, you can send them to our front-ends to be verified at app.goldfinch.finance/verify.

How It Works

UID functions by having a trusted signer (currently Warbler Labs, the core development team for Goldfinch and creator of UID) verify that a given address has passed KYC via the third-party integration (currently Persona). Once verified, the user receives a signed message which they can present to the UID contract in order to mint their UID.

So the user flow looks like this...

  1. User completes KYC flow (on app.goldfinch.finance/verify, via our partner Persona).

  2. Submit completed KYC to the Trusted Signer, which returns a signed message to the user.

  3. User mints their UID by presenting the signed message to the UID contract.

Security and Privacy

All personal data is processed and handled through Persona. Persona has industry leading security and privacy practices. No personal information is stored on-chain.

Need to get in touch?

Have questions about integrating? Do you have a certain use case, or feature you'd like to see? The community would love to hear from you. Reach out at [email protected]

Last updated