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...
The following snippet shows how to send a signed transaction to the Bitcoin network:
- Motoko
- Rust
motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinApi.mo
loading...
rust/basic_bitcoin/src/basic_bitcoin/src/bitcoin_api.rs
loading...