Empower merchants to bring Bitcoin Cash into our daily lives!
Introducing React PoS & Pyxpub
React Point-of-Sale is a client-side point-of-sale app for Bitcoin Cash. It runs in the browser and fetches its data from a private payment gateway, pyxpub, which I’ll introduce later. It best explains itself by checking out the demo.
This JavaScript based web app is made to showcase the features of pyxpub, and ideally can serve as an example for developers to develop more merchant apps on top of pyxpub. Aside from that, it is a modern, fully featured point-of-sale app that can get you started receiving Bitcoin payments in an instant.
Introducing Pyxpub
Pyxpub Private Payment Gateway is a simple web app that generates unique payment requests for Bitcoin Cash. It exposes the needed features of a receive-only wallet through a JSON API to enable quick development of point-of-sale systems. This without the developer having to worry to much about the sensitive bits. Pyxpub makes it easy to follow Bitcoin best practices and future-proofs your application in order to scale towards future needs.
Target Audience
The target audience for this project are small to medium businesses savvy enough to run their point-of-sale system in-house and not rely on custodial services. As well as developers trying to integrate BCH into their current PoS or develop their own app. This project would also fit perfectly in the toolkit of anyone trying to setup a consulting business spreading the use of BCH with merchants.
Scale
Pyxpub can easily scale from a single checkout to a couple dozen without any hassle. It has a built-in multi-threaded application server suited for the deployment of a couple of registers. But, it can also be run as a uWSGI application served through NGINX, which greatly improves performance for larger deployments, while remaining low in resource usage.
You can easily get started with a Raspberry Pi and a cheap tablet.
Privacy & Security
Attention to privacy is a must since Bitcoin is a public ledger. When every customer would use the same address to pay, everybody would know the details about your business. Pyxpub handles this issue by generating a new address for each payment. It does so by making use of the xpub key provided by hierarchical deterministic wallets (the standard for most bitcoin wallets these days). The xpub key provides us with the functionality to create a receive-only wallet. In essence, allowing us to generate new receiving addresses without having any private keys on the server.
Pyxpub aims to be secure and reliable by having as little information on board as needed and providing critical functionality through a single codebase.
Nothing on the server can compromise your funds. If somebody got a hold of your xpub key all they could do is predict all your receiving addresses and monitor the payments you receive. Nothing is stopping you to create a new key every now and then though.
Also, by keeping the xpub key on the server, it is not accessible from the point-of-sale applications. Eliminating another possible data leak.
Features
Right now the API offers 4 services:
API Service | Parameters | Description |
---|---|---|
/qr | addr, amount, label | Generate QR image with specified parameters. |
/api/payment | amount, label | Generate new payment request. |
/api/verify | addr & amount or label | Verify payment of payment request. |
/api/ledger | - | Load sales ledger. |
Examples
/api/payment
curl 'http://localhost:8080/api/payment?amount=0.0023&label=SHOP:1Wed2B44'
{
"payment": {
"amount": "0.0023",
"addr": "bitcoincash:qpej4uw429m9m0wawcphw9v4sch2ymd6qsqh7jx9gl",
"legacy_addr": "1BVx9uf5UGJDt1eMqjut8qh1K4mmEeDSFQ",
"label": "SHOP:1Wed2B44",
"qr_img": "/qr?addr=bitcoincash:qpej4uw429m9m0wawcphw9v4sch2ymd6qsqh7jx9gl&amount=0.0023&label=SHOP:1Wed2B44",
"payment_uri": "bitcoincash:qpej4uw429m9m0wawcphw9v4sch2ymd6qsqh7jx9gl?amount=0.0023&message=SHOP:1Wed2B44"
}
}
/api/verify
curl 'http://localhost:8080/api/verify?addr=bitcoincash:qpemxfnepk9f0g2yzgsyk4ynnklaaunr7g99rrwas9&amount=0.0023'
{"received": 0}
or
{"received": 1}
/api/ledger
curl 'http://localhost:8080/api/ledger'
{
"1":{
"id":1,
"timestamp":1519152761.0008476,
"addr":"bitcoincash:qzwdulf49wfmalj6a36gn2h5ncvrxmw98ydzhxe7gz",
"amount":"0.00040650",
"label":"DEVZERO.BE:5cc4f403-9351-42f1-8850-a50735f921fd",
"received":1,
"confirmations":0,
"txid":"5bae0304eb76e78167af30fe6b98f83462828ae974b9c7bc236ebb5b7a9d9e26"
},
"2":{
"id":2,
"timestamp":1519159704.388939,
"addr":"bitcoincash:qpej4uw429m9m0wawcphw9v4sch2ymd6qsqh7jx9gl",
"amount":"0.00976920",
"label":"DEVZERO.BE:7d2cc3a5-9a6b-4112-b8ac-c60f89d28408",
"received":0,
"confirmations":0,
"txid":"NoTX"
},
"3":{
"id":3,
"timestamp":1519220076.8360977,
"addr":"bitcoincash:qpemxfnepk9f0g2yzgsyk4ynnklaaunr7g99rrwas9",
"amount":"0.0023",
"label":"SHOP:1Wed2B44",
"received":0,
"confirmations":0,
"txid":"NoTX"
}
}
/qr
Will serve a QR png image
http://localhost:8080/qr?addr=bitcoincash:qpej4uw429m9m0wawcphw9v4sch2ymd6qsqh7jx9gl&amount=0.0023&label=SHOP:PAYM123
Disclaimer & Call for Help!
Pyxpub is still a new piece of software and can use some testing and code review. All feedback, bug reports, feature requests and help are welcome and would be very much appreciated. Feel free to create an issue or pull request on GitHub.