How to setup a Dash Instant-Send Transaction using Insight API — The comprehensive way
While some cryptocurrency out here will require to pass through two years of argues, two differents forks, threaten all users, in order to setup their centralized instant transaction system on-chain;
Dash propose a better decentralized, secure, instant (1.6 seconds) transaction system based on Quorums, keeping a consensus on the secure network empowered by miners and masternodes and still be sure to prevent double-spending.
Sound exciting ? Let’s walk through the different steps that will allow you to bring Instant Send transactions in your business.
While you love your customers, you might not always want to discuss several minutes, waiting for confirmations, before allowing them to enjoy their coffee right ?
Therefore, gives that link to a friendly engineer, mind preparing some coffee for him and let’s rock ! It’s easy, you will see.
Disclaimer : I would like to improve the developer experience, so any advice you found on the process is welcomed.
The idea will be to go fast on that step-by-step guide, so we will setup an open system, that you will need to tweak in order to brings more security.
That will be your job later on, mine here will just to allow you walk-through an easy & quick way to get you working on what you do the best.
Step 1 : Networking
We install a OS on our server, I use most of the time Ubuntu, but I will use Debian on this. Our requirements here are limited to ashiny debian 9 installed (I assume no previous pkg installed) with an internet connection, and … that’s it.
Step 2 : Install a node
Before all, you will need to install a node. I will assume superjacky as your user account (then I’m sure you will mind changing it :p), and root as the root one.
Append, just after the line root ALL=(ALL:ALL) ALL,
superjacky ALL=(ALL:ALL) ALL.
Save with Ctrl+O, Ctrl+X. (or something probably similar to ⌘+ ⌥ + Maj + o + x on Mac OS). And back to our user (su superjacky).
When compiling is done (I will update with the 0.12.2 version later on), we will need to add something.
Whenever you launch DashCore, a ~/.dashcore, folder will be created. It’s where we expected to setup our configuration file. But we didn’t start dashcore yet, so let’s handle that.
And in it we put this configuration :
(You can remove debug as the file will quickly grow, letting that for our exemple, mind to tweak whitelist and rpcallowip later on, and to remove testnet line for livenet).
And simply start it
And here you have your node running, one could decide to stop here and use the npm packages bitcore-lib-dash and bitcoind-rpc-dash in order to setup InstantSend sending. I will continue and guide you to a Insight API that help you.
Step 3 : Setting up an Insight API
Bonus : Interfacing Insight API with our DashCore node.
Drop in it the conf as above :
And only start using
You will then be able to look for the insight at : http://$SERVERIP:3001/insight
And to reach the API at :
Step 4 : Building the transaction :
Assuming you have a PrivKey and a PublicKey , you can retrieve the UTXO of such a Public Key as simply as making a GET request:
You will got an array containing differents input with every part needed to build a new transactions.
Use the inputs, build your transaction with bitcore-lib-dash and then, just broadcast your transaction using a simple POST request and a fully formed and signed rawtx :
Post params :
- rawtx: "Signed transaction in their hex representation"
Post response :
And you just accomplished your first Instant Send Transaction !
You can find more information about documentation on the different repositories :
DashCore : https://github.com/dashpay/dash
Bitcore node dash : https://github.com/dashevo/bitcore-node-dash
Bitcore-lib-dash : https://github.com/dashevo/bitcore-lib-dash
Insight-api-dash : https://github.com/dashevo/insight-api-dash
Bitcoind-rpc-dash : https://github.com/dashevo/bitcoind-rpc-dash