Single Chain integration
There are two aspects to consider when integrating the VIP3 SBT:
Do I need the VIP3 SBT data on-chain or off-chain?
Do I just need to check if the address holds one or know the detailed traits of the VIP3 SBT
The on-chain method is typically employed when a decentralized application (dApp) directly engages with a contract, with all the operational logic contained within the dApp's contract. The dApp contract can directly access the necessary data from the VIP3 SBT contract. However, using the on-chain approach can lead to an increase in the gas required for contract execution.
On the other hand, the off-chain method is commonly utilized when a dApp can interact both with a contract and a backend service. This backend service can obtain information from the VIP3 SBT by using services provided by an Ethereum API provider. Consequently, the Dapp can acquire all the necessary data from this backend service. Additionally, the contract can also utilize the information obtained by the backend service. Within the contract's logic, it can verify the signature of the information which is about VIP3 SBT provided by the backend service to ensure the accuracy of the data.
Check the table below to understand what integration suits your needs best:
Use data on-chain | Use data off-chain | |
---|---|---|
Verify Holder | VIP3 SBT smart contract | VIP3 SBT smart contract Ethereum API Provider(ex: Infura, QuickNode) |
Detail traits | VIP3 SBT Level traits can be get from the smart contract. Other details traits are not available on-chain | Ethereum API Provider(ex: Infura, QuickNode) VIP3 SBT metadata API (based on s3) |
Off-chain Integration
The easiest way of integrating the SBT traits is by using API provided by popular node providers, like Infura, and QuickNode. It returns a user's SBT URI which can directly access an easily digestible JSON format for the SBT detail.
Verifying a VIP3 SBT Holder
Take the alchemy Ethereum chain for example (python version):
Response:
Verify on other chains, you can replace the below urls and contract address
Chain | ChainId | Contract Address | URL Prefix |
---|---|---|---|
eth | 1 | 0xabe292b291a18699b09608de86888d77ad6baf23 | https://eth-mainnet.g.alchemy.com/nft/v2/{apiKey} |
eth_goerli | 5 | 0x570b5e80152D54a476b98635de26B523dDFbDBDC | https://eth-goerli.g.alchemy.com/v2/{apiKey} |
polygon | 137 | 0xabe292b291a18699b09608de86888d77ad6baf23 | https://polygon-mainnet.g.alchemy.com/v2/{apiKey} |
polygon-mumbai | 80001 | 0x570b5e80152D54a476b98635de26B523dDFbDBDC | https://polygon-mumbai.g.alchemy.com/v2/{apiKey} |
zksync_era | 324 | 0xf5bf718bEafc62503aa5b30E982ee2e050632Df1 | Up Coming |
zksync_era_testnet | 280 | 0x32Ab0E82D639532100c50889D4636499A2f53308 | Up Coming |
Get a VIP3 SBT Trait
The SBT metadata for Ethereum can be fetched at: https://vip3eth.s3.amazonaws.com/metadata/<SBT_ID>The API returns all available data about a user's SBT like: description, image, name, or attributes.
Since the trait value
is a string it is required to interpret the value according to the SBT Traits Demo
Get traits from other chains, you can use the below urls
Chain | ChainId | URL Prefix |
---|---|---|
eth | 1 | https://vip3eth.s3.amazonaws.com/metadata/<SBT_ID> |
eth_goerli | 5 | https://vip3goerli.s3.amazonaws.com/metadata/<SBT_ID> |
polygon | 137 | https://vip3polygon.s3.amazonaws.com/metadata/<SBT_ID> |
polygon-mumbai | 80001 | https://vip3polytest.s3.amazonaws.com/metadata/<SBT_ID> |
zksync_era | 324 | https://vip3zk.s3.amazonaws.com/metadata/<SBT_ID> |
zksync_era_testnet | 280 | https://vip3zktest.s3.amazonaws.com/metadata/<SBT_ID> |
On-chain Integration
The Ethereum VIP3 SBT contract can be found at: VIP3SBT , contract source can be found at : sourceYou can get the contract and source file for other chains in the below urls:
Chain | Contract |
---|---|
eth | https://etherscan.io/token/0xabe292b291a18699b09608de86888d77ad6baf23 |
eth_goerli | https://goerli.etherscan.io/address/0x570b5e80152D54a476b98635de26B523dDFbDBDC |
polygon | https://polygonscan.com/address/0xabe292b291a18699b09608de86888d77ad6baf23 |
polygon-mumbai | https://mumbai.polygonscan.com/address/0x570b5e80152D54a476b98635de26B523dDFbDBDC |
zksync_era | https://explorer.zksync.io/address/0xf5bf718bEafc62503aa5b30E982ee2e050632Df1#contract |
zksync_era_testnet | https://goerli.explorer.zksync.io/address/0x32Ab0E82D639532100c50889D4636499A2f53308#contract |
The VIP3 SBT Smart contract exposes a simple API to integrate with the SBT on-chain.
INFO
Since only owners are stored on-chain the contract can only return a result for SBT Id
Verifying a VIP3 SBT Holder
To check if a user has a VIP3 SBT the balanceOf method should be used.
Get a VIP3 SBT URI
To get the uri of a VIP3 SBT the tokenURI method should be used.
Get a VIP3 SBT Level
To get the uri of a VIP3 SBT the getLevel method should be used.
Last updated