Verify Bitcoin Collateral With Chainlink Proof of Reserve

Smart contracts and oracles enable unparalleled transparency, helping usher in a new era of increased economic fairness by reinventing models of trust. As new financial instruments continue to emerge across the decentralized finance ecosystem, the crypto asset economy needs increasingly robust infrastructure for securing protocols and the data they rely upon and produce. After all, end-to-end transparency and a high degree of trust-minimization remain inconsequential in a composable ecosystem if not all applications are held to the same standard.

Chainlink Proof of Reserve (PoR) is an automated solution that helps protocols achieve a high standard of transparency and verifiability by providing real-time information about collateralization in a secure and decentralized manner. Specifically, it enables developers and users to verify that stablecoins, wrapped tokens, and other assets utilizing off-chain or cross-chain reserves are fully backed by collateral.

In this article, we’ll explore why decentralized verification is important and go over how to leverage Chainlink PoR to prove the collateralization of a wrapped bitcoin token, specifically, BitGo’s Wrapped Bitcoin (WBTC).

Proof of Reserve for Wrapped Tokens and Cross-Chain Assets

Wrapped tokens are on-chain assets pegged to the value of another asset. The mechanism ensuring that the peg is held between the wrapped token and the underlying asset varies between different wrapped token designs. Traditionally, it involves opaque manual processes where users are unable to independently verify asset reserves on-chain, or a single party can control the issuance or supply, subjecting the wrapped token to centralization risks and a single point of failure.

Chainlink Proof of Reserve allows wrapped token projects to enhance their security and transparency through automated, real-time verification that replaces manual processes that otherwise could take months or longer. By using Chainlink PoR, wrapped token products can add an extra layer of security to their minting mechanism to help control supply and prevent undercollateralization, helping ensure that the circulating supply reflects the off-chain or cross-chain supply in reserve. 

Wrapped token products can also use PoR as a circuit breaker that halts minting/burning functions if the reserves aren’t sufficient to collateralize the outstanding supply of wrapped tokens, helping mitigate against the minting of unbacked tokens and fractional reserve activity.

 A diagram showing how Chainlink helps prevent undercollateralized WBTC minting
How Chainlink Proof of Reserve helps prevent undercollateralized WBC minting.

Verify Wrapped Bitcoin Collateral With Chainlink Proof of Reserve

Initialize the Feeds

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract ProofOfReserve {
    IERC20 public WBTC;
    AggregatorV3Interface internal reservesWBTC;
    /**
     * Aggregator: WBTC reserve and WBTC supply
     * WBTC Address: 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
     * Reserves Address: 0xB622b7D6d9131cF6A1230EBa91E5da58dbea6F59
     */
    constructor() {
        WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
        reservesWBTC = 
AggregatorV3Interface(0xB622b7D6d9131cF6A1230EBa91E5da58dbea6F59);
   }
}

Retrieve Values

//Returns the latest Supply info
function getSupply() public view returns (uint256) {
    return WBTC.totalSupply();
}

//Returns the latest Reserves info
function getLatestReserves() public view returns (int) {
    (
        /* uint80 roundID */, 
        int answer,
        /* uint startedAt */,
        /* uint updatedAt */,
        /* uint80 answeredInRound */
    ) = reservesWBTC.latestRoundData();
    return answer;

}

Check Bitcoin Reserves Against Wrapped Token Supply

//Determines if supply has exceeded reserves
function isWBTCHealthOK() public view returns (bool) {
    return getLatestReserves() >= int(getSupply());
}

Conclusion

As Web3 developers continue to create increasingly sophisticated financial products, a reliable, transparent, and decentralized standard is required to enable reserves to be verified using an automated process leveraging the superior transparency of blockchains, smart contracts, and oracles

Chainlink Proof of Reserve offers a decentralized solution for maintaining end-to-end transparency and verifiability for DeFi protocols. The ability for anyone to verify that a wrapped asset is backed by the reserves it claims to be backed by and that the value held in those reserves is sufficient to collateralize the outstanding supply helps maintain a robust, sustainable, and secure Web3 economy built on solid foundations.

If you want to know more about Chainlink Proof of Reserve, visit the PoR product page. If you’re a developer and want to integrate Chainlink PoR into your smart contract application, check out the Chainlink developer documentation or reach out to an expert.

Need Integration Support?
Talk to an expert
Faucets
Get testnet tokens
Read the Docs
Technical documentation