neobytes/doc/instantsend.md

59 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2024-02-05 23:00:22 +01:00
##InstantSend Technical Information
InstantSend has been integrated into the Core Daemon in two ways:
* "push" notifications (ZMQ and `-instantsendnotify` cmd-line/config option);
* RPC commands.
####ZMQ
When a "Transaction Lock" occurs the hash of the related transaction is broadcasted through ZMQ using both the `zmqpubrawtxlock` and `zmqpubhashtxlock` channels.
* `zmqpubrawtxlock`: publishes the raw transaction when locked via InstantSend
* `zmqpubhashtxlock`: publishes the transaction hash when locked via InstantSend
2024-12-16 19:40:22 +01:00
This mechanism has been integrated into Bitcore-Node-Neobytes which allows for notification to be broadcast through Insight API in one of two ways:
2024-02-05 23:00:22 +01:00
* WebSocket: [https://github.com/neobytes-project/insight-api-neobytes#web-socket-api](https://github.com/neobytes-project/insight-api-neobytes#web-socket-api)
* API: [https://github.com/neobytes-project/insight-api-neobytes#instantsend-transactions](https://github.com/neobytes-project/insight-api-neobytes#instantsend-transactions)
####Command line option
When a wallet InstantSend transaction is successfully locked a shell command provided in this option is executed (`%s` in `<cmd>` is replaced by TxID):
```
-instantsendnotify=<cmd>
```
####RPC
Details pertaining to an observed "Transaction Lock" can also be retrieved through RPC, its important however to understand the underlying mechanism.
2024-12-16 19:40:22 +01:00
By default, the Neobytes Core daemon will launch using the following constant:
2024-02-05 23:00:22 +01:00
```
static const int DEFAULT_INSTANTSEND_DEPTH = 5;
```
2024-12-16 19:40:22 +01:00
This value can be overridden by passing the following argument to the Neobytes Core daemon:
2024-02-05 23:00:22 +01:00
```
-instantsenddepth=<n>
```
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).
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.
**Examples**
* InstantSend transaction just occurred:
* confirmations: 5
* bcconfirmations: 0
* InstantSend transaction received one confirmation from blockchain:
* confirmations: 6
* bcconfirmations: 1
* non-InstantSend transaction just occurred:
* confirmations: 0
* bcconfirmations: 0
* non-InstantSend transaction received one confirmation from blockchain:
* confirmations: 1
* bcconfirmations: 1