How to convert address formats to sensible inputs

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 lookup endpoint resolves a variety of address formats such as [email protected] 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 ////
//// bip21 ////
//// paymail ////
payto:[email protected]?purpose=cashback&amount=0.013
//// paymail-noScheme ////
//// bip272 ////
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 lookup endpoint helps to enhance app user friendliness and compatibility with the greater ecosystem.
The response body of the URI can be used as input for the /pay endpoint (for invoices) or simply be used to decode the string of a QR code.
const resp = await relysiaSDK.URI({uri: '[email protected]'});
The response body schema looks as follows, independent of the input.
"statusCode": 200,
"data": {
"status": "success",
"msg": "Operation completed successfully",
"data": {
"type": "paymail",
"mainProtocol": "paymail",
"outputs": [
"script": "76a9149196f6ef3234d17080ebf16460c502c21157125988ac",
"satoshis": -1
"inputs": [],
"memo": "Send to [email protected]",
"isBSV": true,
"peer": "https://api.relysia.com/v1/bsvalias/receive-transaction/[email protected]",
"peerData": "i164psehd1a",
"peerProtocol": "paymail"
The satoshi amount in outputs is set to -1 when no payment request was made.
Copy link