Satoshi Spark

What is Wrapped Bitcoin (WBTC)?

Wrapped Bitcoin (WBTC) is an ERC-20 token that represents Bitcoin (BTC) on the Ethereum blockchain. By "wrapping" Bitcoin into an ERC-20 token, WBTC enables Bitcoin holders to participate in the Ethereum ecosystem, such as decentralized finance (DeFi) protocols, without selling their Bitcoin. Each WBTC token is backed 1:1 by real Bitcoin held in custody by a third party, ensuring that WBTC can be redeemed for BTC at any time. 


WBTC provides liquidity to the Ethereum network, allowing Bitcoin holders to lend, borrow, and trade with their BTC assets across various platforms and protocols within the Ethereum ecosystem. Below is a simple example of what the WBTC smart contract might look like in Solidity:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract WrappedBitcoin is ERC20 {
    address public admin;
    mapping(address => uint256) public balances;


    constructor() ERC20("Wrapped Bitcoin", "WBTC") {
        admin = msg.sender;
    }


    function mint(address to, uint256 amount) external {
        require(msg.sender == admin, "Only admin can mint");
        _mint(to, amount);
    }


    function burn(address from, uint256 amount) external {
        require(msg.sender == admin, "Only admin can burn");
        _burn(from, amount);
    }
}


```
This contract uses OpenZeppelin’s ERC-20 library to implement the WBTC token on Ethereum. The `mint` function allows an administrator (typically a custodian) to create new WBTC tokens when Bitcoin is deposited into custody, while the `burn` function removes WBTC tokens when they are redeemed for BTC. This design ensures that WBTC is always backed by real Bitcoin, maintaining its 1:1 peg.

Posted on November 11, 2024

Back to Home