James Bachini

How Wrapped Tokens Like wETH & wBTC Work

Wrapped Tokens

In this article we will look at how different wrapped tokens work and where the underlying collateral is stored.

  1. What Are Wrapped Tokens?
  2. Wrapped Ethereum wETH
  3. Wrapped Bitcoin wBTC

What Are Wrapped Tokens?

Wrapped tokens are generally ERC20 tokens that represents another underlying asset, typically a cryptocurrency or real world asset. The purpose of wrapping a token is to enable its use within the DeFi ecosystem and provide additional utility and interoperability.

There are two types of wrapped tokens which we will look at today. Custodial and non-custodial tokens. With a custodial token a centralized trusted entity will hold the underlying asset and mint the token as a digital representation. This custodian is responsible for maintaining a corresponding reserve of the underlying asset.

Non-custodial tokens store the underlying asset within a smart contract. The wrapper contract can add additional functionality such as autocompounding staking returns or meet standards which the original asset does not comply with.

In the following examples we will look at wETH (non-custodial) and wBTC (custodial).


Wrapped Ethereum wETH

WETH is one of my favourite smart contracts because of it’s elegant simplicity. It is in essence an ERC20 token with a deposit and withdraw function added.

You send ETH with the deposit transaction to mint new wETH tokens and can redeem wETH > ETH with the withdraw function.

Let’s take a quick look to appreciate the Solidity for these now

function deposit() public payable {
    balanceOf[msg.sender] += msg.value;
    Deposit(msg.sender, msg.value);
}
function withdraw(uint wad) public {
    require(balanceOf[msg.sender] >= wad);
    balanceOf[msg.sender] -= wad;
    msg.sender.transfer(wad);
    Withdrawal(msg.sender, wad);
}

Full source code available at: https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code

This contract was written in solidity version 0.4.18 and holds $6B TVL currently. It’s widely used widely across DeFi, by protocols such as Uniswap, to move ETH in the same way we move ERC20 tokens.


Wrapped Bitcoin wBTC

wBTC is an ERC20 token that wraps Bitcoin. Because Bitcoin is on a separate blockchain it has to be held by a trusted party on the Bitcoin network and minted as a token on Ethereum.

The custodian for wBTC is BitGo and they provide a proof of assets portal here: https://wbtc.network/dashboard/audit

Wrapped Bitcoin wBTC

The smart contract is permissioned with a multisig as the minting authority. It lives on the Ethereum blockchain here: https://etherscan.io/token/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599#code

Currently the contract TVL stands at just over $4B USD.


These are just a few examples of wrapped tokens. One I didn’t cover was wrapped stETH which adjusts the yield distribution mechanism on Lido Finance’s staked Ethereum token.

For developers wrapped tokens provide a way to standardise and bring different assets in to decentralized finance. For investors it creates modern digital assets that are (hopefully in the case of custodial tokens) backed by underlying collateral.

I hope this primer in to wrapped tokens has been of interest and provided some clarity in to how the different types are created and used.



Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.