Money Button Documentation

Money Button Documentation

  • Money Button
  • API
  • Examples
  • Paymail
  • bsv

›Paymail

Money Button

  • Money Button Overview
  • HTML
  • Javascript
  • React
  • Crypto Operations
  • Invisible Money Button
  • Paymail Signatures
  • Paymail Encryption
  • Simple Fabriik Protocol for Tokens

API

  • API Overview
  • Apps
  • Webhooks
  • Tokens
  • Currencies
  • Javascript Client
  • Authentication

    • Authentication Overview
    • OAuth
    • OAuth With JS Client

    API v1

    • Get User Identity
    • Get User Profile
    • Get User Balance
    • Get Payments
    • Get Payment By ID

    API v2

    • Get User Balances
    • Get Payments
    • Get Payment By ID
    • Get Assets
    • Create Asset
    • Modify Asset

Examples

  • Examples Overview
  • OP_RETURN Scripts
  • Assets

Paymail

  • Paymail Overview
  • Paymail Video Series
  • Paymail Introduction
  • BRFC Specifications
  • Specification Documents
  • BRFC ID Assignment
  • Service Discovery
  • Host Discovery
  • Capability Discovery
  • Public Key Infrastructure
  • Payment Addressing
  • Payment Addressing (Basic Address Resolution)
  • Payment Addressing (Payer Validation)
  • Payment Addressing (Payee Approvals)
  • Payment Addressing (PayTo Protocol Prefix)
  • Verify Public Key Owner
  • P2P Transactions
  • P2P Payment Destination
  • Recommendations

Bitcoin SV Library (bsv)

  • Bitcoin SV Library (bsv)
  • Big Numbers
  • Points (Elliptic Curves)
  • Hash Functions
  • Base 58
  • Private Keys
  • Public Keys
  • Addresses
  • ECDSA
  • Bitcoin Signed Messages
  • Signatures
  • HD Private Keys (BIP32)
  • HD Public Keys (BIP32)
  • Mnemonics (BIP39)
  • Script

BRFC ID Assignment

It is desirable that a BRFC document be uniquely identified. Without a central authority to issue an identification number, we have chosen to borrow inspiration from Bitcoin and use hashes of content.

ID Construction

To construct a BRFC ID from a specification, take the UTF8 string value of the title, author and version metadata fields (omit those not present), trim leading and trailing whitespace (leaving whitespace mid-way through the value), concatenate each value, then reinterpret the string as a byte array, and apply a double SHA256 hash.

let hash = sha256d(
  spec.title.trim() +
  (spec.author || '').trim() +
  (spec.version || '').trim()
);

Hex-format the hash as per Bitcoin conventions (usually this means reversing the bytes before converting to hex).

let bitcoinDisplayHash = hash
  .reverse()
  .toString('hex');

Take the first 12 characters of the Bitcoin-style display hash (representing the last six bytes of the underlying sha256d value):

let brfcId = bitcoinDisplayHash.substring(0, 12);

Considerations

Hashing the title, author and version metadata of a specification allows us to generate a unique ID without central authority. Hashing the entire specification was considered, however this was discounted due to the following drawbacks:

  • Any change, however minor (like typo fixes) would create an entirely new specification id
  • Different platforms handle line endings differently, and different source control and editor software can replace these without warning. This leads to unstable hashes across seemingly identical documents
  • Some file formats update metadata even when content remains unchanged. Again, this would lead to unstable hashes over otherwise stable content

Test Cases

title: BRFC Specifications
author: andy (nChain)
version: 1

Expected BRFC ID: 57dd1f54fc67

title: bsvalias Payment Addressing (PayTo Protocol Prefix)
author: andy (nChain)
version: 1

Expected BRFC ID: 74524c4d6274

title: bsvalias Integration with Simplified Payment Protocol
author: andy (nChain)
version: 1

Expected BRFC ID: 0036f9b8860f

← Specification DocumentsService Discovery →
  • ID Construction
  • Considerations
  • Test Cases
Money Button Documentation
Docs
Money ButtonAPIDesignbsv
Community
redditYoutubeTelegramTwitter
More
BlogInstagramGitHubStar
See an error in our documentation? Issue a pull request to fix it.
Copyright © 2021 Yours Inc.