How to Accept Dimecoin on a Website using Electrum-Dime

This tutorial will show you how to accept Dimecoin on a website with SSL signed payment requests, according to BIP-70. The docs are updated for Electrum-Dime 1.0 (currently in development).

You will need a valid SSL certificate (signed by a CA, for example free Letsencrypt). Please follow the instructions to install the development version. Do not forget the submodule update command.

Add your SSL Certificate to Electrum-Dime

electrum -o setconfig ssl_keyfile /path/to/ssl/privkey.pem
electrum -o setconfig ssl_certfile /path/to/ssl/fullchain.pem

For details see How to Add SSL

Create and Use your Merchant Wallet

Create a wallet on your protected machine, as you want to keep your cryptocurrency safe. If anybody compromise your merchant server, s/he will be able to access read-only version of your wallet only and won’t be able to spent currency.

Please notice that the potential intruder still will be able to see your addresses, transactions and balance, though. It’s also recommended to use a separate wallet for your merchant purposes (and not your main wallet).

electrum create

Still being on a protected machine, export your Master Public Key (xpub):

electrum getmpk -w .electrum/wallets/your-wallet

Now you are able to set up your electrum merchant daemon.

On the server machine restore your wallet from previously exported Master Public Key (xpub):

electrum restore xpub...............................................

Configure your full hostname and port:

electrum -o setconfig payserver_address ecdsa.org:80

Start the Electrum-Dime Daemon

Once your read-only wallet is (re-)created, start Electrum-Dime as a daemon:

electrum daemon -d
electrum load_wallet

Note: to stop the daemon

electrum stop

Create a Signed Payment Request

electrum add_request 0.5 -m "test"
{
 "URI": "dimecoin:bc1qyr5xx5jkue3k72sldm5xa0taqs3n2achupymz8?amount=0.5&message=test&time=1589115653&exp=3600",
 "address": "bc1qyr5xx5jkue3k72sldm5xa0taqs3n2achupymz8",
 "amount": 50000000,
 "amount_BTC": "0.5",
 "bip70_url": "https://ecdsa.org:80/bip70/bc1qyr5xx5jkue3k72sldm5xa0taqs3n2achupymz8.bip70",
 "exp": 3600,
 "id": "6988b80931",
 "memo": "test",
 "status": 0,
 "status_str": "Expires in about 1 hour",
 "time": 1589115653,
 "type": 0,
 "view_url": "https://ecdsa.org:80/r/pay?id=bc1qyr5xx5jkue3k72sldm5xa0taqs3n2achupymz8"
}

This command returns a json object with two URLs:

  • bip70_url is the URL of the signed BIP70 request.

  • view_url is the URL of a webpage displaying the request.

You can view the current list of requests using the ‘list_requests’ command. You can clear the list using ‘clear_requests’.

Open the payment request page in your browser

Let us open view_url in a web browser.

_images/payrequest.png

The page shows the payment request. You can open the dimecoin: URI with a wallet, or scan the QR code. The bottom line displays the time remaining until the request expires.

_images/payreq_window.png

The page will update itself when the payment is received, using websockets.