Search…
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 for the Goldfinch protocol, and we would love to see other protocols leverage the work we've done, but we cannot guarantee support or maintenance at this time. Use at your own risk. If you have questions or feedback, please contact us! [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:
1
# This is using OpenZeppelin's ERC1155 preset contracts:
2
# https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155
3
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
4
​
5
contract MyContract {
6
address UID_CONTRACT = "0xba0439088dc1e75f58e0a7c107627942c15cbb41";
7
uint256 public constant ID_VERSION_0 = 0;
8
​
9
function hasUID(address userAddress) returns (bool) {
10
uint256 balance = IERC1155(UID_CONTRACT).balanceOf(userAddress, ID_VERSION_0);
11
return balance > 0
12
}
13
}
14
​
Copied!
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
1
var Web3 = require('web3');
2
const web3 = new Web3(Web3.givenProvider);
3
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"}]
4
const uidAddress = "0xba0439088dc1e75F58e0A7C107627942C15cbb41"
5
const UID = new web3.eth.Contract(minimalAbi, uidAddress)
6
​
7
async function hasUID(userAddress) {
8
const VERSION_0 = 0
9
const balance = parseInt(await UID.methods.balanceOf(userAddress, VERSION_0).call())
10
return balance > 0
11
}
12
​
Copied!

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.
Please note: UID is only open to non-U.S. individuals right now.

How It Works

UID is very simple. It works by having a trusted signer (Goldfinch in this case) verify that a given address has passed KYC, and once verified, gives that user 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. 1.
    User completes KYC flow (on app.goldfinch.finance/verify, via our partner Persona).
  2. 2.
    Submit completed KYC to the Trusted Signer, which returns a signed message to the user.
  3. 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 modified 25d ago