# BitcoinPod Overview

The remap is enabled by `BitcoinPod.sol`, a smart contract managed by the user along with the Operator of Eigenlayer/BitDSM. It is a direct mapping of a Bitcoin Address on Ethereum, representated as a smart contract. This does not mint an ERC-20 but instead stores the value as `bitcoinBalance` inside the contract.

```solidity
contract BitcoinPod is IBitcoinPod, OwnableUpgradeable {
    address public operator;
    bytes public operatorBtcPubKey;
    bytes public bitcoinAddress;
    uint256 public bitcoinBalance;
    bool public locked;
    address public immutable manager;
    bytes public signedBitcoinWithdrawTransaction;
```

A BitcoinPod contract is:

1. Non-transferable: Change of ownership of the BOD is not permitted.
2. Non-fungible: Only full value delegation is permissible.
3. Unique: A dedicated bitcoinpod contract deployed for each bitcoin address. Multiple bitcoin addresses cannot be mapped to a single bitcoinpod contract.&#x20;
4. Stateful or stateless: Bitcoin address mapped to a bitcoinpod contract can either hold the funds or act as a pass through address.&#x20;

As a client, you need to choose an operator to create a bitcoin address before you can deploy the BOD. The bitcoin address is created off-chain and later verified on chain to ensure the operator is part of the signing script.&#x20;

The address verification happens before BitcoinPod contract is deployed to ensure only eligible bitcoin addresses are mapped.

```solidity
function createPod(address operator, string memory btcAddress, bytes calldata scipt)                   
        external 
        whenNotPaused 
        nonReentrant
        returns (address)
    {
        require(_userToPod[msg.sender] == address(0), "User already has a pod");
        require(IBitDSMRegistry(_bitDSMRegistry).isOperatorBtcKeyRegistered(operator), "Invalid operator");
        
        bytes memory operatorBtcPubKey = IBitDSMRegistry(_bitDSMRegistry).getOperatorBtcPublicKey(operator);
       // console.logBytes(operatorBtcPubKey);
        // verify the btc address
        // try catch block to handle the error
        try IBitDSMServiceManager(_bitDSMServiceManager).verifyBTCAddress(btcAddress, scipt, operatorBtcPubKey) returns (bool isBtcAddress) {
            console.log("isBtcAddress", isBtcAddress);
        } catch (bytes memory reason) {
            console.log("Error verifying BTC address");
            console.logBytes(reason);
        }
       // console.log("isBtcAddress", isBtcAddress);
       // emit BTCAddressVerified(operator, btcAddress);
        // create the pod
        BitcoinPod newPod = new BitcoinPod(address(this));
        newPod.initialize(msg.sender, operator, operatorBtcPubKey, btcAddress);
        // increment the total pods
        _totalPods++;
        // set the user to pod mapping
        _setUserPod(msg.sender, address(newPod));
        
        emit PodCreated(msg.sender, address(newPod), operator);
        // return the pod address
        return address(newPod);
```
