Skip to main content

Bitcoin API

A set of methods for obtaining public keys, signing messages, and transactions specific to the Bitcoin network and protocols based on it (Litecoin, Dogecoin, etc.).

Networks

The list of supported networks determines the BIP32 constraints, displayed data formats, and types of supported addresses.

NetworkSymbolIDDescription
BitcoinBTC1The Bitcoin mainnet is the primary and original blockchain network of Bitcoin where all major transactions and activities take place, as opposed to test or alternative networks.
Testnet BitcointBTC2The Bitcoin testnet is a separate blockchain network designed for testing and experimentation, allowing developers and users to trial new features or conduct experiments without using real bitcoins on the mainnet.
LitecoinLTC3The Litecoin mainnet refers to the primary and operational blockchain network of Litecoin, a peer-to-peer cryptocurrency. On the Litecoin mainnet, real transactions and activities occur, distinguishing it from testnets or alternative networks.
Testnet LitecointLTC4The Litecoin testnet is a distinct blockchain network specifically created for testing purposes. It enables developers and users to experiment with new features, test applications, and conduct trials without using real Litecoin on the mainnet.
DogecoinDOGE5The Dogecoin mainnet refers to the primary and original blockchain network of Dogecoin. It is the decentralized ledger where actual Dogecoin transactions and activities occur.

Bitcoin BTC

Address TypeDescriptionBIP32 MainnetBIP32 Testnet
P2PKHLegacym/44'/0'/0'm/44'/1'/0'
P2WPKHSegwitm/84'/0'/0'm/84'/1'/0'
P2SH_P2WPKHNested Segwitm/49'/0'/0'm/49'/1'/0'
P2TRTaprootm/86'/0'/0'm/86'/1'/0'

Litecoin LTC

Address TypeDescriptionBIP32 MainnetBIP32 Testnet
P2PKHLegacym/44'/2'/0'm/44'/1'/0'
P2WPKHSegwitm/84'/2'/0'm/84'/1'/0'
P2SH_P2WPKHNested Segwitm/49'/2'/0'm/49'/1'/0'

Dogecoin DOGE

Address TypeDescriptionBIP32 Mainnet
P2PKHLegacym/44'/3'/0'

Methods

MethodApp IDMethod IDDescription
GET_PUBLIC_KEY21Request to obtain an HD public key via the BIP32 path
SIGN_MESSAGE22Request to sign a message (Bitcoin Signed Messages)
SIGN_TRANSACTION23Request to sign a transaction

GET_PUBLIC_KEY

Returns an HD node corresponding to the specified BIP32 path.

Request

bitcoin.proto
message GetPublicKey {
uint32 network = 1;
Bip32Path path = 2;
}
  • network: Network identifier, see NETWORKS
  • path: BIP32 path of the key to obtain the HD node.

Response

bitcoin.proto
message GetPublicKeyResult {
uint32 depth = 1;
uint32 index = 2;
bytes publicKey = 3;
bytes chainCode = 4;
uint32 fingerprint = 5;
}

SIGN_MESSAGE

Generates a signature for the message msg using the magic hash (Bitcoin Signed Messages).

Request

bitcoin.proto
message SignMessage {
uint32 network = 1;
Bip32Path path = 2;
bytes msg = 3;
}
  • network: Network identifier, see NETWORKS
  • path: BIP32 path of the key for signing the message
  • msg: Message to be signed.

Response

bitcoin.proto
message ECDSASignResult {
uint32 v = 1;
bytes r = 2;
bytes s = 3;
}
  • v, r, s:: component of the ECDSA signature.

SIGN_TRANSACTION

Signs the inputs of a UTXO transaction in the PSBT (Partially Signed Bitcoin Transaction) format.

Request

bitcoin.proto
message SignTransaction {
uint32 network = 1;
bytes psbt = 2;
map<uint32, Bip32Path> paths = 3;
map<uint32, Bip32Path> changePaths = 4;
bool finalize = 5;
}
  • network: Network identifier, see NETWORKS.
  • psbt: Serialized transaction in PSBT format.
  • paths: Transaction input indices and their corresponding BIP32 paths for signing.
  • changePaths: Transaction output indices and their corresponding BIP32 paths, representing change addresses for accurate display of the sending amount.
  • finalize: Flag indicating whether transaction finalization is required. If set to true, the result will be a fully formed transaction in blockchain format; otherwise, it will be a PSBT.

Response

bitcoin.proto
message SignTransactionResult {
bytes tx = 1;
}
  • tx: PSBT or Bitcoin Transaction.