Skip to main content
Bitcoin methods handle transactions, addresses, and public keys for Bitcoin and Bitcoin-like cryptocurrencies.

signTransaction

Signs a Bitcoin transaction with inputs and outputs. User must confirm transaction details on device.
inputs
array
required
Array of transaction inputs.
outputs
array
required
Array of transaction outputs.
coin
string
required
Coin name (e.g., Bitcoin, Litecoin, btc, ltc).
refTxs
array
Referenced transactions (previous transactions for inputs).
account
object
Account information with addresses and transactions.
locktime
number
Transaction locktime.
timestamp
number
Transaction timestamp (Peercoin).
version
number
Transaction version.
expiry
number
Transaction expiry (Zcash).
overwintered
boolean
Overwintered flag (Zcash).
versionGroupId
number
Version group ID (Zcash).
branchId
number
Branch ID (Zcash).
push
boolean
Broadcast transaction to network after signing.
preauthorized
boolean
Use preauthorized flow (for coinjoin).
amountUnit
string
Display unit: BITCOIN, MILLIBITCOIN, MICROBITCOIN, SATOSHI.
unlockPath
object
Unlock path configuration.
serialize
boolean
default:"true"
Return serialized transaction.
coinjoinRequest
object
Coinjoin request parameters.
chunkify
boolean
Split large requests into chunks.
signatures
array
Array of signature strings (hex).
serializedTx
string
Serialized transaction in hex format.
witnesses
array
Witness data for SegWit transactions.
txid
string
Transaction ID (hash).
const result = await TrezorConnect.signTransaction({
    inputs: [
        {
            address_n: [84 | 0x80000000, 0 | 0x80000000, 0 | 0x80000000, 0, 0],
            prev_hash: '3ac...',
            prev_index: 0,
            amount: '100000',
            script_type: 'SPENDWITNESS',
        },
    ],
    outputs: [
        {
            address: 'bc1q...',
            amount: '90000',
            script_type: 'PAYTOADDRESS',
        },
        {
            address_n: [84 | 0x80000000, 0 | 0x80000000, 0 | 0x80000000, 1, 0],
            amount: '9000',
            script_type: 'PAYTOWITNESS',
        },
    ],
    coin: 'Bitcoin',
});

if (result.success) {
    console.log('Transaction ID:', result.payload.txid);
    console.log('Serialized:', result.payload.serializedTx);
}

signMessage

Signs a message using the private key derived from the given path.
path
string | number[]
required
BIP32 derivation path.
coin
string
Coin name or shortcut.
message
string
required
Message to sign (UTF-8 string or hex).
hex
boolean
Interpret message as hex string.
no_script_type
boolean
Don’t include script type in signature.
address
string
Address corresponding to the signing key.
signature
string
Message signature (base64).
const result = await TrezorConnect.signMessage({
    path: "m/84'/0'/0'/0/0",
    coin: 'btc',
    message: 'Hello Trezor',
});

if (result.success) {
    console.log('Signature:', result.payload.signature);
    console.log('Address:', result.payload.address);
}

verifyMessage

Verifies a message signature.
address
string
required
Address that signed the message.
signature
string
required
Message signature (base64).
message
string
required
Original message that was signed.
coin
string
required
Coin name or shortcut.
hex
boolean
Interpret message as hex string.
success
boolean
Whether signature is valid.
const result = await TrezorConnect.verifyMessage({
    address: 'bc1q...',
    signature: 'IFqU...',
    message: 'Hello Trezor',
    coin: 'btc',
});

composeTransaction

Composes a Bitcoin transaction from given outputs, automatically selecting inputs and calculating fees.
outputs
array
required
Desired transaction outputs.
coin
string
required
Coin name.
account
object
required
Account information with UTXOs and addresses.
feeLevels
array
Fee levels to compute (e.g., [{feePerUnit: '10'}]).
sequence
number
Default sequence number.
success
boolean
Whether composition succeeded.
payload
object
Composed transaction ready for signing, or error.
const result = await TrezorConnect.composeTransaction({
    outputs: [{ address: 'bc1q...', amount: '100000' }],
    coin: 'btc',
    account: accountInfo,
    feeLevels: [{ feePerUnit: '10' }],
});

authorizeCoinjoin

Authorizes coinjoin transactions for privacy-enhanced Bitcoin transactions.
path
string | number[]
required
Account derivation path.
coordinator
string
required
Coinjoin coordinator name.
maxRounds
number
required
Maximum number of coinjoin rounds.
maxCoordinatorFeeRate
number
required
Maximum coordinator fee rate.
maxFeePerKvbyte
number
required
Maximum mining fee per kvbyte.
coin
string
required
Coin name (only Bitcoin supported).
scriptType
string
Script type for coinjoin.
success
boolean
Whether authorization succeeded.
const result = await TrezorConnect.authorizeCoinjoin({
    path: "m/84'/0'/0'",
    coordinator: 'zkSNACKs',
    maxRounds: 10,
    maxCoordinatorFeeRate: 50000000,
    maxFeePerKvbyte: 3500,
    coin: 'Bitcoin',
});

cancelCoinjoinAuthorization

Cancels previously authorized coinjoin session.
success
boolean
Whether cancellation succeeded.
const result = await TrezorConnect.cancelCoinjoinAuthorization();

pushTransaction

Broadcasts a signed transaction to the blockchain network.
tx
string
required
Serialized transaction in hex format.
coin
string
required
Coin name or shortcut.
txid
string
Transaction ID after broadcasting.
const result = await TrezorConnect.pushTransaction({
    tx: '0100000...',
    coin: 'btc',
});

Build docs developers (and LLMs) love