From 864dd6ec0ccae0588483157949ff32f65e2aacab Mon Sep 17 00:00:00 2001 From: thephez Date: Tue, 12 Sep 2017 15:09:40 -0400 Subject: [PATCH] Masternode P2P messages (dseg, mnb, mnget, mnp, mnv, mnw, mnwb, ssc) - Add reference/crossref entries - Add message structure --- _autocrossref.yaml | 14 +++++ _includes/devdoc/ref_p2p_networking.md | 72 +++++++++++++++++++++++++- _includes/references.md | 7 +++ 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/_autocrossref.yaml b/_autocrossref.yaml index c36fc5a6..f2853829 100644 --- a/_autocrossref.yaml +++ b/_autocrossref.yaml @@ -34,6 +34,8 @@ DER-formatted: der '`dsi` messages': dsi message '`dsq` message': dsq message '`dsq` messages': dsq message +'`dseg` message': dseg message +'`dseg` messages': dseg message '`dss` message': dss message '`dss` messages': dss message '`dssu` message': dssu message @@ -101,6 +103,16 @@ merge: Merge avoidance: micropayment channel: micropayment channels: micropayment channel +'`mnb` message': mnb message +'`mnb` messages': mnb message +'`mnget` message': mnget message +'`mnget` messages': mnget message +'`mnp` message': mnp message +'`mnp` messages': mnp message +'`mnv` message': mnv message +'`mnv` messages': mnv message +'`mnw` message': mnw message +'`mnw` messages': mnw message '`MSG_BLOCK`': msg_block '`MSG_FILTERED_BLOCK`': msg_filtered_block '`MSG_TX`': msg_tx @@ -161,6 +173,8 @@ RPCs: rpc secp256k1: '`spork` message': spork message '`spork` messages': spork message +'`ssc` message': ssc message +'`ssc` messages': ssc message standard block relay: transaction object format: transaction version number: diff --git a/_includes/devdoc/ref_p2p_networking.md b/_includes/devdoc/ref_p2p_networking.md index b59ca7ad..2643f69f 100644 --- a/_includes/devdoc/ref_p2p_networking.md +++ b/_includes/devdoc/ref_p2p_networking.md @@ -1881,6 +1881,18 @@ The `mnb` message is sent whenever a masternode comes online or a client is syncing. The masternode will send this message which describes the masternode entry and how to validate messages from it. +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 41 | vin | txIn | Required | The unspent output which is holding 1000 DASH +| # | addr | CService | Required | IPv4 address of the masternode +| 33-65 | pubKeyCollateralAddress | CPubKey | Required | CPubKey of the main 1000 DASH unspent output +| 33-65 | pubKeyMasternode | CPubKey | Required | CPubKey of the secondary signing key (For all other messaging other than announce message) +| 66* | sig | char[] | Required | Signature of this message verifiable via pubKeyMasternode (66 bytes in most cases. Length (1 byte) + Signature (65 bytes)) +| 8 | sigTime | int64_t | Required | Time which the signature was created +| 4 | nProtocolVersion | int | Required | The protocol version of the masternode +| # | lastPing | `mnp` message | Required | The last known ping of the masternode +| 8 | nLastDsq | int64_t | Deprecated | The last time the masternode sent a DSQ message (for mixing) (DEPRECATED) + The following annotated hexdump shows a `mnb` message. (The message header has been omitted and the actual IP address has been replaced with a RFC5737 reserved IP address.) @@ -1959,6 +1971,10 @@ Masternode Ping Message The `mnget` message requests masternode payment sync. +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 4 | nMnCount | int | Required | + The following annotated hexdump shows a `mnget` message. (The message header has been omitted.) @@ -1976,7 +1992,14 @@ a8170000 ................................... Count: 6056 The `mnp` message is sent by masternodes every few minutes to ping the network with a message that propagates across the whole network. -The following annotated hexdump shows a `dseg` message. (The +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 41 | vin | txIn | Required | The unspent output of the masternode (holding 1000 DASH) which is signing the message +| 32 | blockHash | uint256 | Required | Current chaintip blockhash (minus 12??) +| 8 | sigTime | int64_t | Required | Time which the signature was created +| 66* | vchSig | char[] | Required | Signature of this message by masternode - verifiable via pubKeyMasternode (66 bytes in most cases. Length (1 byte) + Signature (65 bytes)) + +The following annotated hexdump shows a `mnp` message. (The message header has been omitted.) {% highlight text %} @@ -2013,6 +2036,18 @@ Masternode Signature The `mnv` message is used to verify masternodes. +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 41 | vin1 | txIn | Required | The unspent output which is holding 1000 DASH for masternode 1 +| 41 | vin2 | txIn | Required | The unspent output which is holding 1000 DASH for masternode 2 +| # | addr | CService | Required | IPv4 address and port of the masternode +| 4 | nonce | int | Required | Nonce +| 4 | nBlockHeight | int | Required | Block height +| 66* | vchSig1 | char[] | Required | Signature of this message by masternode 1 - verifiable via pubKeyMasternode (66 bytes in most cases. Length (1 byte) + Signature (65 bytes)) +| 66* | vchSig2 | char[] | Required | Signature of this message by masternode 2 - verifiable via pubKeyMasternode (66 bytes in most cases. Length (1 byte) + Signature (65 bytes)) + + + {% endautocrossref %} #### mnw @@ -2024,6 +2059,13 @@ The `mnw` message is used to pick the next winning masternode. When a new block is found on the network, a masternode quorum will be determined and those 10 selected masternodes will issue the masternode payment vote message. +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 41 | vin | txIn | Required | The unspent output which is holding 1000 DASH +| 4 | nBlockHeight | int | Required | The blockheight which the payee should be paid +| ? | payeeAddress | CScript | Required | The address receiving payment +| 66* | vchSig | char[] | Required | Signature of the masternode which is signing the message (66 bytes in most cases. Length (1 byte) + Signature (65 bytes)) + The following annotated hexdump shows a `mnw` message. (The message header has been omitted.) @@ -2066,7 +2108,18 @@ Masternode Signature {% autocrossref %} -There is no message for `mnwb` (inventory only). +There is no message for `mnwb` (`inv` message only). + +The following annotated hexdump shows an `inv` message with a `mnwb` +inventory entry. (The message header has been omitted.) + +{% highlight text %} +01 ................................. Count: 1 + +08000000 ........................... Type: MSG_MASTERNODE_PAYMENT_BLOCK (8) +dd6cc6c11211793b239c2e311f1496e2 +2281b200b35233eaae465d2aa3c9d537 ... Hash (mnwb) +{% endhighlight %} {% endautocrossref %} @@ -2077,6 +2130,21 @@ There is no message for `mnwb` (inventory only). The `ssc` message is used to track the sync status of masternode objects. +| Bytes | Name | Data type | Required | Description | +| ---------- | ----------- | --------- | -------- | -------- | +| 4 | nItemID | int | Required | Masternode Sync Item ID +| 4 | nCount | int | Required | Masternode Sync Count + +Sync Item IDs + +| ID | Description +|------|-------------- +| 2 | MASTERNODE_SYNC_LIST +| 3 | MASTERNODE_SYNC_MNW +| 4 | MASTERNODE_SYNC_GOVERNANCE +| 10 | MASTERNODE_SYNC_GOVOBJ +| 11 | MASTERNODE_SYNC_GOVOBJ_VOTE + The following annotated hexdump shows a `ssc` message. (The message header has been omitted.) diff --git a/_includes/references.md b/_includes/references.md index 0872f418..d0d96254 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -207,6 +207,7 @@ http://opensource.org/licenses/MIT. [dsc message]: /en/developer-reference#dsc "A P2P network message used to indicates a PrivateSend mixing session is complete" [dsf message]: /en/developer-reference#dsf "A P2P network message sent to indicate the queue is ready and the user is expected to send the entry inputs to start mixing" [dsi message]: /en/developer-reference#dsi "A P2P network message sent as the final mixing transaction in a PrivateSend mixing session" +[dseg message]: /en/developer-reference#dseg "A P2P network message which requests a masternode list or specific entry" [dss message]: /en/developer-reference#dss "A P2P network message which sends the user’s signed inputs for a group transaction in a mixing session" [dssu message]: /en/developer-reference#dssu "A P2P network message providing a mixing pool status update" [dsq message]: /en/developer-reference#dsq "A P2P network message asking users to sign a final mixing TX messages" @@ -228,12 +229,18 @@ http://opensource.org/licenses/MIT. [ix message]: /en/developer-reference#ix "A P2P protocol message which sends a single serialized transaction via InstantSend" [mempool message]: /en/developer-reference#mempool "A P2P protocol message used to request one or more inv messages with currently-unconfirmed transactions" [merkleblock message]: /en/developer-reference#merkleblock "A P2P protocol message used to request a filtered block useful for SPV proofs" +[mnb message]: /en/developer-reference#mnb "A P2P protocol message used to describe the masternode entry and how to validate messages from it" +[mnget message]: /en/developer-reference#mnget "A P2P protocol message that requests masternode payment sync" +[mnp message]: /en/developer-reference#mnp "A P2P protocol message sent by masternodes every few minutes to ping the network with a message that propagates across the whole network" +[mnv message]: /en/developer-reference#mnv "A P2P protocol message used to verify masternodes." +[mnw message]: /en/developer-reference#mnw "A P2P protocol message used to pick the next winning masternode (payee)" [notfound message]: /en/developer-reference#notfound "A P2P protocol message sent to indicate that the requested data was not available" [ping message]: /en/developer-reference#ping "A P2P network message used to see if the remote host is still connected" [pong message]: /en/developer-reference#pong "A P2P network message used to reply to a P2P network ping message" [reject message]: /en/developer-reference#reject "A P2P network message used to indicate a previously-received message was rejected for some reason" [sendheaders message]: /en/developer-reference#sendheaders "A P2P network message used to request new blocks be announced through headers messages rather than inv messages" [spork message]: /en/developer-reference#spork "A P2P network message used to send the activation status of a spork" +[ssc message]: /en/developer-reference#ssc "A P2P network message used to track the sync status of masternode objects" [tx message]: /en/developer-reference#tx "A P2P protocol message which sends a single serialized transaction" [txlvote message]: /en/developer-reference#txlvote "A P2P protocol message which masternodes send in response to an ix (transaction lock request) message if the transaction inputs can be locked." [verack message]: /en/developer-reference#verack "A P2P network message sent in reply to a version message to confirm a connection has been established"