diff --git a/_includes/devdoc/guide_p2p_network.md b/_includes/devdoc/guide_p2p_network.md index 713f73cf..cd51e718 100644 --- a/_includes/devdoc/guide_p2p_network.md +++ b/_includes/devdoc/guide_p2p_network.md @@ -607,6 +607,40 @@ features in a decentralized, deterministic way. {% endautocrossref %} +### InstantSend + +{% include helpers/subhead-links.md %} + +{% autocrossref %} + +Dash Core's InstantSend feature provides a way to lock transaction inputs and +enable secure, instantaneous transactions. + +*InstantSend Data Flow* + +| **InstantSend Client** | **Direction** | **Peers** | **Description** | +| `inv` message (ix) | → | | Client sends inventory for transaction lock request +| | ← | `getdata` message (ix) | Peer responds with request for transaction lock request +| `ix` message | → | | Client sends InstantSend transaction lock request +| | ← | `inv` message (txlvote) | Masternodes in the [quorum](#quorum-selection) respond with votes +| `getdata` message (txlvote) | → | | Client requests vote +| | ← | `txlvote` message | Peer responds with vote + +Once a sufficient number of votes approve the transaction lock, the InstantSend +transaction is approved and shows 5 confirmations (`DEFAULT_INSTANTSEND_DEPTH`). +If an InstantSend transaction is a valid transaction but does not receive a +transaction lock, it reverts to being a standard transaction. + +There are a number of limitations on InstantSend transactions: + +* To be used in an InstantSend transaction, an input must have 6+ confirmations (`INSTANTSEND_CONFIRMATIONS_REQUIRED`) +* The lock request will timeout 15 seconds after the first vote is seen (`INSTANTSEND_LOCK_TIMEOUT_SECONDS`) +* The lock request will fail if it has not been locked after 60 seconds (`INSTANTSEND_FAILED_TIMEOUT_SECONDS`) +* A minimum fee (0.001 Dash) is required since the transaction involves the masternodes in addition to miners. Activation of [DIP-0001](https://github.com/dashpay/dips/blob/master/dip-0001.md) will reduce the fee by an order of magnitude (to 0.0001 Dash). + +{% endautocrossref %} + + ### PrivateSend {% include helpers/subhead-links.md %} diff --git a/_includes/devdoc/ref_p2p_networking.md b/_includes/devdoc/ref_p2p_networking.md index 05e7ba72..968fb378 100644 --- a/_includes/devdoc/ref_p2p_networking.md +++ b/_includes/devdoc/ref_p2p_networking.md @@ -1444,7 +1444,11 @@ bc8f5e5400000000 ............................ Epoch time: 1415483324 The following network messages all help control the InstantSend feature of Dash. InstantSend uses the masternode network to lock transaction inputs and enable -secure, instantaneous transactions. +secure, instantaneous transactions. For additional details, refer to +the Developer Guide [InstantSend section](developer-guide#instantsend). + +![Overview Of P2P Protocol InstantSend Request And Reply Messages](/img/dev/en-p2p-instantsend-messages.svg) + {% endautocrossref %} diff --git a/img/dev/en-p2p-instantsend-messages.dot b/img/dev/en-p2p-instantsend-messages.dot new file mode 100644 index 00000000..37dfda53 --- /dev/null +++ b/img/dev/en-p2p-instantsend-messages.dot @@ -0,0 +1,28 @@ +digraph { + +size="6.25"; +rankdir=LR +nodesep=0.05; +ranksep=0.1; +splines="false" + +edge [ penwidth = 1.75, fontname="Sans", dir="none" ] +node [ penwidth = 1.75, shape = "box", fontname="Sans", ] +graph [ penwidth = 1.75, fontname="Sans" ] + +ix -> "inv (txlvote)"; +"inv (txlvote)" -> getdata; +getdata -> txlvote; + +{ + node [ shape = "none" ]; + label1 [ label = "Client Requests\nTransaction Lock" ]; + label2 [ label = "Masternodes Reply\nWith Inventory" ]; + label3 [ label = "Request For\nMasternode Vote" ]; + label4 [ label = "Reply With\nRequested Vote" ]; + + label1 -> label2 -> label3 -> label4 [style = "invis" ]; +} + +label = "Overview Of P2P Protocol InstantSend Request And Reply Messages" +} diff --git a/img/dev/en-p2p-instantsend-messages.svg b/img/dev/en-p2p-instantsend-messages.svg new file mode 100644 index 00000000..83f48064 --- /dev/null +++ b/img/dev/en-p2p-instantsend-messages.svg @@ -0,0 +1,69 @@ + + + + + + +%3 + +Overview Of P2P Protocol InstantSend Request And Reply Messages + +ix + +ix + + +inv (txlvote) + +inv (txlvote) + + +ix->inv (txlvote) + + + +getdata + +getdata + + +inv (txlvote)->getdata + + + +txlvote + +txlvote + + +getdata->txlvote + + + +label1 +Client Requests +Transaction Lock + + +label2 +Masternodes Reply +With Inventory + + + +label3 +Request For +Masternode Vote + + + +label4 +Reply With +Requested Vote + + + +