WBIP005 — BTC Methods

WBIP005 — Default Bitcoin Methods

draft rpc

This WBIP proposes some default Bicoin for future JSON RPC parameter WBIPs. This WBIP defines the BTC related RPC methods that wallets MAY implement.

This WBIP mainly exists for backwards compatibility. Refer to the prior documentation for more legacy details.

getInfo (opens in a new tab)

Parameters: None
Returns: {
  version: number | string,
  methods?: string[],
  supports?: string[]
}

getAddresses (opens in a new tab)

Parameters: {
  count: number
  types: string[],
  purposes: string[],
}
Returns: {
  address: string,
  type?: string,
  purpose?: string,
  publicKey?: string
}[]

Purpose: 'change' | 'ordinals' | etc
Type: 'p2pkh' | 'p2sh' | 'p2wpkh-p2sh' | 'p2wpkh' | 'p2tr'

Web-applications SHOULD NOT have/need derivation control (as many extensions used to implement), rather the type/purpose control should be enough to cover all use-cases.

makeInvoice (opens in a new tab)

Parameters: {
  amount: string | number,
  memo?: string,
  label?: string,
  message?: string
}
Returns: {
  paymentRequest: string
}

signMessage (opens in a new tab)

Parameters: {
  message: string,
  address?: {}
}
Returns: {
  signature: string,
  messageHash?: string,
  address?: string
}

verifyMessage (opens in a new tab)

verifyMessage is not included since technically a wallet / private-key isn’t needed for this. Wallets MAY still decide to implement this or a similar method.

sendPayment (opens in a new tab)

Parameters: {
  paymentRequest: string
}
Returns: {
  txid: string
}

sendTransfer (opens in a new tab)

Parameters: {
  recipients: {
    address: string,
    amount: number
  }[]
}
Returns: {
  txid: string
}

Fields are required, unless they are marked with a ?. Exact type/usage definitions are assumed to be self-evident. This document follows a pseudo-definition similar to TypeScript.