Relysia
Relysia WalletAPI DocumentationGithub RepositoryDemo
  • Relysia SDK
  • Getting Started
    • Setup
    • API
    • Infrastructure
  • Wallets
    • Wallets
    • Mnemonic
    • Addresses
    • Metrics
    • Balance
    • History
  • Payments
    • Lookup
    • Sweep
    • URI
    • Transactions
    • Raw Transactions
    • Invoices
      • Create Invoice
      • Get Invoice
      • Pay Invoice
    • Payments
    • Asm
  • token
    • Basics
    • Token Issuance
    • NFT Issuance
    • Atomic Swaps
    • Details
    • Leaderboard
  • Utility
    • Post
    • Upload
    • Conversion
    • Paymail
    • Transpile-Compile
  • Enterprise Wallet
    • Overview
    • Authentication
    • Management
    • Wallet
    • Smart Contracts
    • Transaction
    • Fee Manager
    • Events
  • Realtime Transaction Notification
    • Use Case
    • Setup and Configuration
    • Events and Messages
  • More
    • Metashard
    • Satolearn
Powered by GitBook
On this page
  1. Payments

URI

How to convert address formats to sensible inputs

PreviousSweepNextTransactions

Last updated 1 year ago

A Uniform Resource Identifier

In Bitcoin, there are over 30 combinations sharing address formats. Some include memos, which are short messages to the receiver, others include payment requests of specified amounts.

The URI endpoint resolves a variety of address formats such as 63@relysia.com or 1McLoHnGZnXBinS82dqPnRDV9VQJjJpBZF and it automatically resolves and returns the underlying information.

Since p2p paymails resolve differently than normal paymails, and invoices can be sometimes just a web link instead of an address. To make it easier for app developers, we created a URI function to catch them all, no matter the format. The function enables developers to scan QR codes without worrying to ever not having the right resolver at hand.

Lets have a closer look at what addresses can look like:

Address Format variations
//// address ////
19KXpbJMt1SjUNh3ATMgj8FkzvSX7C83gq

//// bip21 ////
bitcoin:19KXpbJMt1SjUNh3ATMgj8FkzvSX7C83gq?amount=10000

//// paymail ////
payto:90@relysia.com?purpose=cashback&amount=10000

//// paymail-noScheme ////
90@relysia.com

//// bip272 ////
bitcoin:?sv=&r=https%3A%2F%2Fstaging.centi.ch%2Fpayment%2Fapi%2Fpayment_request%2F2662e521-ff52-418a-b7e5-c98aefd7295a

//// DPP ////
pay:?r=https://api.relysia.com/v1/paymentRequest/8f9f4c27-3782-46e2-b76f-1ef956f52c61

As we can see above, a unified resolver reduces the uncertainty of interpreting QR codes and address inputs. Instead of enforcing a single format, the URI endpoint helps to enhance app user friendliness and compatibility with the greater ecosystem.

const resp = await relysia.utility.v1.uri({uri: '90@relysia.com'});

The response body schema looks as follows, independent of the input.

{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "Operation completed successfully",
    "data": {
      "uri": "90@relysia.com",
      "type": "paymail",
      "mainProtocol": "paymail",
      "outputs": [
        {
          "script": "76a9149196f6ef3234d17080ebf16460c502c21157125988ac",
          "satoshis": 10000
        }
      ],
      "inputs": [],
      "memo": "Send to 90@relysia.com",
      "isBSV": true,
      "peer": "https://api.relysia.com/v1/bsvalias/receive-transaction/90@relysia.com",
      "peerData": "i164psehd1a",
      "peerProtocol": "paymail"
    }
  }
}

The response body of the URI can be used as input for the endpoint (for invoices) or simply be used to decode the string of a QR code.

/pay