Money Button Documentation

Money Button Documentation

  • Money Button
  • API
  • Examples
  • Paymail
  • bsv

›Bitcoin SV Library (bsv)

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

Bitcoin Signed Messages


Source code: message.js

There is a standard way to sign arbitrary non-transaction data with a Bitcoin private key that is appropriate for any type of authentication such as signing a public statement of ownership of a particular Bitcoin address. The standard is sometimes called Bitcoin Signed Message.

One interesting property of this format is that it allows someone to share an address rather than a public key. Anyone can verify the signed message in an unusual way, which is by deriving the public key from the signature. A number of candidate public keys are derived and compared against the address. If one of the public keys matches, then that is the correct public key, and normal ECDSA signature verification can be performed.

Because "Message" is not something that is used by all applications, it is separated from the rest of the library and must be included on its own.

Here is an example of signing and verifying a message with Message:

var Message = require('bsv/message')
var bsv = require('bsv')
var privateKey = bsv.PrivKey.fromRandom()
var address = privateKey.toAddress()
var message = "this is the message that i want to sign"
var sig = Message.sign(message, privateKey)
console.log(sig.toString())
// prints:
// H/kgM5HZYfmP9u1l50cuGwb/Hr3liZS8VfHg1JsL9EuHOux2n9pCStyPV0pOTKJp22ekSUeq8zRATOQvrORPw7E=
var verify = Message.verify(message, address, sig)
console.log(verify)
// prints:
// true
← ECDSASignatures →
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.