HTTP Wallet Communications Substrate

  • Brayden Langley (brayden@projectbabbage.com)

  • Ty Everett (ty@projectbabbage.com)

Abstract

The Bitcoin Wallet HTTP Interface is a standard interface that enables applications to connect with Bitcoin wallets to facilitate certain functionality. The interface provides a unified way for applications to request the creation of a Bitcoin transaction, encryption, digital signature creation, and other features provided by the wallet. By standardizing the interface, applications can support multiple wallets and give the user greater control over their Bitcoin-related activities.

Motivation

The motivation for this standard interface is to provide a common way for applications to connect with Bitcoin wallets. Currently, many Bitcoin wallets provide their own APIs, which makes it difficult for applications to support multiple wallets. The Bitcoin Wallet HTTP Interface standardizes the way that applications can interact with wallets, enabling them to be more easily integrated into various applications. This interface is designed to be flexible enough to support a range of wallets and use cases, while also providing a secure and standardized method of communication.

Specification

We define a standard HTTP substrate by which wallets can provide a communication channel to applications for the necessary tasks such as creating transactions, creating certificates, signature verification, and more.

All implementors of the HTTP substrate should conform to the following standard for the wallet HTTP API that allows applications to communicate in a predefined and standard way.

Host

We define the wallet HTTP server to support communication over localhost on port 3301. New API versions can be specified as needed using the standard of v1, v2, etc.

Host URL: http://localhost
Standard Port: 3301
Versioning Standard: v1, v2, etc

Example Encrypt Request URL: http://localhost:3301/v1/encrypt

Standard HTTP Requests

We define standardized HTTP requests that applications can use to communicate with wallets for performing various tasks.

Message TypeRequest MethodRoute NameURL Query String ParamsRequest BodyResponse Body

BRC-1 Transaction Creation

POST

createAction

No Params

JSON

JSON

BRC-2 Encryption

POST

encrypt

BRC-56 defined

Binary or String

Binary

BRC-2 Decryption

POST

decrypt

BRC-56 defined

Binary or String

Binary

BRC-3 Signature Creation

POST

createSignature

No Params

JSON

Binary

BRC-3 Signature Verification

POST

verifySignature

BRC-56 defined

Binary or String

JSON

BRC-53 Certificate Creation

POST

createCertificate

No Params

JSON

JSON

BRC-53 Certificate Verification

POST

proveCertificate

No Params

JSON

JSON

BRC-56 HMAC Creation

POST

createHmac

BRC-56 defined

Binary or String

Binary

BRC-56 HMAC Verification

POST

verifyHmac

BRC-56 defined

Binary or String

Boolean

BRC-56 Public Key Derivation

GET

getPublicKey

BRC-56 defined

None

JSON

BRC-56 Certificate List

POST

findCertificates

No Params

JSON

JSON

BRC-56 Version Request

GET

getVersion

No Params

None

String

BRC-56 Network Request

POST

getNetwork

No Params

None

String

BRC-56 Authentication Request

GET

isAuthenticated

No Params

None

JSON

BRC-56 Async Auth Request

POST

waitForAuthentication

No Params

JSON

JSON

JavaScript Code Example

const httpResult = await makeHttpRequest(
      'http://localhost:3301/v1/<routeName>',
      {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          <requestBody>
        })
      }
    )

Implementation

Implementers of applications and wallets will need to create and process HTTP requests in the manner described, according to the various fields and properties as required by BRC-56, and in a manner consistent with the reference implementation, which is the Babbage SDK's HTTP substrate functionality.

Last updated