InstantSend P2P messages / Guide

- Add diagram of message exchange
 - Add section to guide
This commit is contained in:
thephez 2017-11-09 15:27:38 -05:00
parent 1d999fa23c
commit 4ded024b06
4 changed files with 136 additions and 1 deletions

View file

@ -607,6 +607,40 @@ features in a decentralized, deterministic way.
{% endautocrossref %} {% 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 ### PrivateSend
{% include helpers/subhead-links.md %} {% include helpers/subhead-links.md %}

View file

@ -1444,7 +1444,11 @@ bc8f5e5400000000 ............................ Epoch time: 1415483324
The following network messages all help control the InstantSend feature of Dash. The following network messages all help control the InstantSend feature of Dash.
InstantSend uses the masternode network to lock transaction inputs and enable 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 %} {% endautocrossref %}

View file

@ -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"
}

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="450pt" height="86pt"
viewBox="0.00 0.00 450.00 86.36" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(0.792254 0.792254) rotate(0) translate(4 105)">
<title>%3</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-105 564,-105 564,4 -4,4"/>
<text text-anchor="middle" x="280" y="-7.8" font-family="Sans" font-size="14.00">Overview Of P2P Protocol InstantSend Request And Reply Messages</text>
<!-- ix -->
<g id="node1" class="node"><title>ix</title>
<polygon fill="none" stroke="black" stroke-width="1.75" points="92.5,-59 38.5,-59 38.5,-23 92.5,-23 92.5,-59"/>
<text text-anchor="middle" x="65.5" y="-37.3" font-family="Sans" font-size="14.00">ix</text>
</g>
<!-- inv (txlvote) -->
<g id="node2" class="node"><title>inv (txlvote)</title>
<polygon fill="none" stroke="black" stroke-width="1.75" points="262.5,-59 161.5,-59 161.5,-23 262.5,-23 262.5,-59"/>
<text text-anchor="middle" x="212" y="-37.3" font-family="Sans" font-size="14.00">inv (txlvote)</text>
</g>
<!-- ix&#45;&gt;inv (txlvote) -->
<g id="edge1" class="edge"><title>ix&#45;&gt;inv (txlvote)</title>
<path fill="none" stroke="black" stroke-width="1.75" d="M92.6679,-41C111.78,-41 138.277,-41 161.353,-41"/>
</g>
<!-- getdata -->
<g id="node3" class="node"><title>getdata</title>
<polygon fill="none" stroke="black" stroke-width="1.75" points="395,-59 325,-59 325,-23 395,-23 395,-59"/>
<text text-anchor="middle" x="360" y="-37.3" font-family="Sans" font-size="14.00">getdata</text>
</g>
<!-- inv (txlvote)&#45;&gt;getdata -->
<g id="edge2" class="edge"><title>inv (txlvote)&#45;&gt;getdata</title>
<path fill="none" stroke="black" stroke-width="1.75" d="M262.837,-41C283.158,-41 306.151,-41 324.557,-41"/>
</g>
<!-- txlvote -->
<g id="node4" class="node"><title>txlvote</title>
<polygon fill="none" stroke="black" stroke-width="1.75" points="530,-59 465,-59 465,-23 530,-23 530,-59"/>
<text text-anchor="middle" x="497.5" y="-37.3" font-family="Sans" font-size="14.00">txlvote</text>
</g>
<!-- getdata&#45;&gt;txlvote -->
<g id="edge3" class="edge"><title>getdata&#45;&gt;txlvote</title>
<path fill="none" stroke="black" stroke-width="1.75" d="M395.192,-41C416.517,-41 443.776,-41 464.646,-41"/>
</g>
<!-- label1 -->
<g id="node5" class="node"><title>label1</title>
<text text-anchor="middle" x="65.5" y="-85.8" font-family="Sans" font-size="14.00">Client Requests</text>
<text text-anchor="middle" x="65.5" y="-70.8" font-family="Sans" font-size="14.00">Transaction Lock</text>
</g>
<!-- label2 -->
<g id="node6" class="node"><title>label2</title>
<text text-anchor="middle" x="212" y="-85.8" font-family="Sans" font-size="14.00">Masternodes Reply</text>
<text text-anchor="middle" x="212" y="-70.8" font-family="Sans" font-size="14.00">With Inventory</text>
</g>
<!-- label1&#45;&gt;label2 -->
<!-- label3 -->
<g id="node7" class="node"><title>label3</title>
<text text-anchor="middle" x="360" y="-85.8" font-family="Sans" font-size="14.00">Request For</text>
<text text-anchor="middle" x="360" y="-70.8" font-family="Sans" font-size="14.00">Masternode Vote</text>
</g>
<!-- label2&#45;&gt;label3 -->
<!-- label4 -->
<g id="node8" class="node"><title>label4</title>
<text text-anchor="middle" x="497.5" y="-85.8" font-family="Sans" font-size="14.00">Reply With</text>
<text text-anchor="middle" x="497.5" y="-70.8" font-family="Sans" font-size="14.00">Requested Vote</text>
</g>
<!-- label3&#45;&gt;label4 -->
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB