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 Type
Request Method
Route Name
URL Query String Params
Request Body
Response Body

POST

createAction

No Params

JSON

JSON

POST

encrypt

Binary or String

Binary

POST

decrypt

Binary or String

Binary

POST

createSignature

No Params

JSON

Binary

POST

verifySignature

Binary or String

JSON

POST

createCertificate

No Params

JSON

JSON

POST

proveCertificate

No Params

JSON

JSON

POST

createHmac

Binary or String

Binary

POST

verifyHmac

Binary or String

Boolean

GET

getPublicKey

None

JSON

POST

findCertificates

No Params

JSON

JSON

GET

getVersion

No Params

None

String

POST

getNetwork

No Params

None

String

GET

isAuthenticated

No Params

None

JSON

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