Skip to main content

Submitting transactions

Advanced
Bitcoin
Tutorial

To submit transactions to the Bitcoin network, the Bitcoin integration API exposes the bitcoin_send_transaction method.

To test canisters locally that use the following code snippets, you will need to enable local Bitcoin development. To do this, you can either start the local replica with dfx start --enable-bitcoin or you can include the following configuration in the project's dfx.json file:

motoko/basic_bitcoin/dfx.json
loading...

Learn more about dfx.json configuration options.

The following snippet shows how to send a signed transaction to the Bitcoin network:

motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinApi.mo
loading...

Resources