Integrating nBTC on EVM

Nomic supports bridging Bitcoin to EVM-based chains.

Contract Addresses

Nomic's decentralized custody bridging contract can be found at the following contract addresses:

nBTC on EVM-based chains is issued as an ERC-20 token at the following contract addresses:

Additional network contract addresses will be listed on here in the future, as well as documentation for creating your own customizable deployments in any EVM environment.

Interchain Deposits

Interchain Deposits allow the generation of Bitcoin addresses which commit to a destination on an EVM-based chain, automatically forwarding any received funds as nBTC to a contract on that chain.

The EVM destination may be either:

  • an Ethereum address to receive the nBTC;

  • a contract call to be executed with the received nBTC.

Interchain Deposits require communication with Bitcoin relayers. The set of relayers used by your front-end should be selected with care.

See nomic-bitcoin-js for more information on generating and displaying Bitcoin deposit addresses.

Withdrawing to Bitcoin

Bitcoin may be withdrawn to a Bitcoin address directly via contract calls on EVM-based chains.

First, approve must be called on the token contract (see above table):

web3.eth.abi.encodeFunctionCall({
    name: 'approve',
    type: 'function',
    inputs: [
    {
        type: 'address',
        name: 'spender'
    },
    {
        type: 'uint256',
        name: 'amount'
    }
    ]
}, [tokenContractAddress, usatAmount]);

Next, initiate the withdrawal to a Bitcoin address with a call to the bridge contract:

import { buildDestination } from 'nomic-bitcoin'

let destination = buildDestination({
    bitcoinAddress: 'tb1...'
})

web3.eth.abi.encodeFunctionCall({
    name: 'sendToNomic',
    type: 'function',
    inputs: [
    {
        type: 'address',
        name: '_tokenContract'
    },
    {
        type: 'string',
        name: '_destination'
    },
    {
        type: 'uint256',
        name: '_amount'
    }
    ]
}, [tokenContractAddress, destination, usatAmount]);

Last updated