|
| 1 | +##InstantSend Technical Information |
| 2 | + |
| 3 | +InstantSend has been integrated into the Core Daemon in two ways: |
| 4 | +* "push" notifications (ZMQ and `-instantsendnotify` cmd-line/config option); |
| 5 | +* RPC commands. |
| 6 | + |
| 7 | +####ZMQ |
| 8 | + |
| 9 | +When a "Transaction Lock" occurs the hash of the related transaction is broadcasted through ZMQ using both the `zmqpubrawtxlock` and `zmqpubhashtxlock` channels. |
| 10 | + |
| 11 | +* `zmqpubrawtxlock`: publishes the raw transaction when locked via InstantSend |
| 12 | +* `zmqpubhashtxlock`: publishes the transaction hash when locked via InstantSend |
| 13 | + |
| 14 | +This mechanism has been integrated into Bitcore-Node-Dash which allows for notification to be broadcast through Insight API in one of two ways: |
| 15 | +* WebSocket: [https://github.com/dashpay/insight-api-dash#web-socket-api](https://github.com/dashpay/insight-api-dash#web-socket-api) |
| 16 | +* API: [https://github.com/dashpay/insight-api-dash#instantsend-transactions](https://github.com/dashpay/insight-api-dash#instantsend-transactions) |
| 17 | + |
| 18 | +####Command line option |
| 19 | + |
| 20 | +When a wallet InstantSend transaction is successfully locked a shell command provided in this option is executed (`%s` in `<cmd>` is replaced by TxID): |
| 21 | + |
| 22 | +``` |
| 23 | +-instantsendnotify=<cmd> |
| 24 | +``` |
| 25 | + |
| 26 | +####RPC |
| 27 | + |
| 28 | +Details pertaining to an observed "Transaction Lock" can also be retrieved through RPC, it’s important however to understand the underlying mechanism. |
| 29 | + |
| 30 | +By default, the Dash Core daemon will launch using the following constant: |
| 31 | + |
| 32 | +``` |
| 33 | +static const int DEFAULT_INSTANTSEND_DEPTH = 5; |
| 34 | +``` |
| 35 | + |
| 36 | +This value can be overridden by passing the following argument to the Dash Core daemon: |
| 37 | + |
| 38 | +``` |
| 39 | +-instantsenddepth=<n> |
| 40 | +``` |
| 41 | + |
| 42 | +The key thing to understand is that this value indicates the number of "confirmations" a successful Transaction Lock represents. When Wallet RPC commands are performed (such as `listsinceblock`) this attribute is taken into account when returning information about the transaction. The value in `confirmations` field you see through RPC is showing the number of `"Blockchain Confirmations" + "InstantSend Depth"` (assuming the funds were sent via InstantSend). |
| 43 | + |
| 44 | +There is also a field named `bcconfirmations`. The value in this field represents the total number of `"Blockchain Confirmations"` for a given transaction without taking into account whether it was InstantSend or not. |
| 45 | + |
| 46 | +**Examples** |
| 47 | +* InstantSend transaction just occurred: |
| 48 | + * confirmations: 5 |
| 49 | + * bcconfirmations: 0 |
| 50 | +* InstantSend transaction received one confirmation from blockchain: |
| 51 | + * confirmations: 6 |
| 52 | + * bcconfirmations: 1 |
| 53 | +* non-InstantSend transaction just occurred: |
| 54 | + * confirmations: 0 |
| 55 | + * bcconfirmations: 0 |
| 56 | +* non-InstantSend transaction received one confirmation from blockchain: |
| 57 | + * confirmations: 1 |
| 58 | + * bcconfirmations: 1 |
0 commit comments