2016-04-19 23:44:47 +02:00
Protocol Documentation - 0.12.1
=====================================
2017-06-26 15:56:52 +02:00
This document describes the protocol extensions for all additional functionality build into the Dash protocol. This doesn't include any of the Bitcoin protocol, which has been left intact in the Dash project. For more information about the core protocol, please see https://en.bitcoin.it/w/index.php?title#Protocol_documentation& action#edit
2016-04-19 23:44:47 +02:00
## Common Structures
### Simple types
uint256 => char[32]
CScript => uchar[]
2016-10-11 15:06:44 +02:00
### COutPoint
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Bitcoin Outpoint https://bitcoin.org/en/glossary/outpoint
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-04-19 23:44:47 +02:00
| 32 | hash | uint256 | Hash of transactional output which is being referenced
| 4 | n | uint32_t | Index of transaction which is being referenced
2016-10-11 15:06:44 +02:00
### CTxIn
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Bitcoin Input https://bitcoin.org/en/glossary/input
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| 36 | prevout | [COutPoint ](#coutpoint ) | The previous output from an existing transaction, in the form of an unspent output
2016-04-19 23:44:47 +02:00
| 1+ | script length | var_int | The length of the signature script
| ? | script | CScript | The script which is validated for this input to be spent
| 4 | nSequence | uint_32t | Transaction version as defined by the sender. Intended for "replacement" of transactions when information is updated before inclusion into a block.
2016-10-11 15:06:44 +02:00
### CTxOut
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Bitcoin Output https://bitcoin.org/en/glossary/output
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 8 | nValue | int64_t | Transfered value
| ? | scriptPubKey | CScript | The script for indicating what conditions must be fulfilled for this output to be further spent
2016-04-19 23:44:47 +02:00
2017-09-05 12:53:15 +02:00
### CTransaction
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| 4 | nVersion | int32_t | Transaction data format version
| 1+ | tx_in count | var_int | Number of Transaction inputs
2018-03-02 14:13:47 +01:00
| 41+ | vin | [CTxIn ](#ctxin )[] | A list of 1 or more transaction inputs
2017-09-05 12:53:15 +02:00
| 1+ | tx_out count | var_int | Number of Transaction outputs
2018-03-02 14:13:47 +01:00
| 9+ | vout | [CTxOut ](#ctxout )[] | A list of 1 or more transaction outputs
2017-09-05 12:53:15 +02:00
| 4 | nLockTime | uint32_t | The block number or timestamp at which this transaction is unlocked
2016-10-11 15:06:44 +02:00
### CPubKey
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Bitcoin Public Key https://bitcoin.org/en/glossary/public-key
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 33-65 | vch | char[] | The public portion of a keypair which can be used to verify signatures made with the private portion of the keypair.
2016-04-19 23:44:47 +02:00
2017-09-05 12:53:15 +02:00
### CService
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| 16 | IP | CNetAddr | IP Address
| 2 | Port | uint16 | IP Port
2016-04-19 23:44:47 +02:00
## Message Types
2016-10-11 15:06:44 +02:00
### MNANNOUNCE - "mnb"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CMasternodeBroadcast
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Whenever a masternode comes online or a client is syncing, they will send this message which describes the masternode entry and how to validate messages from it.
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-15 08:29:44 +01:00
| 36 | outpoint | [COutPoint ](#coutpoint ) | The unspent output which is holding 1000 DASH
2017-09-05 12:53:15 +02:00
| # | addr | [CService ](#cservice ) | IPv4 address of the masternode
| 33-65 | pubKeyCollateralAddress | [CPubKey ](#cpubkey ) | CPubKey of the main 1000 DASH unspent output
| 33-65 | pubKeyMasternode | [CPubKey ](#cpubkey ) | CPubKey of the secondary signing key (For all other messaging other than announce message)
2017-06-26 15:56:52 +02:00
| 71-73 | sig | char[] | Signature of this message (verifiable via pubKeyCollateralAddress)
2016-10-11 15:06:44 +02:00
| 8 | sigTime | int64_t | Time which the signature was created
| 4 | nProtocolVersion | int | The protocol version of the masternode
2018-03-02 14:13:47 +01:00
| # | lastPing | [CMasternodePing ](#mnping---mnp ) | The last known ping of the masternode
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### MNPING - "mnp"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CMasternodePing
Every few minutes, masternodes ping the network with a message that propagates the whole network.
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | --------- |
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is signing the message
2016-10-11 15:06:44 +02:00
| 32 | blockHash | uint256 | Current chaintip blockhash minus 12
| 8 | sigTime | int64_t | Signature time for this ping
| 71-73 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)
2018-02-16 15:54:53 +01:00
| 1 | fSentinelIsCurrent | bool | true if last sentinel ping was current
| 4 | nSentinelVersion | uint32_t | The version of Sentinel running on the masternode which is signing the message
| 4 | nDaemonVersion | uint32_t | The version of dashd of the masternode which is signing the message (i.e. CLIENT_VERSION)
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### MASTERNODEPAYMENTVOTE - "mnw"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CMasternodePaymentVote
When a new block is found on the network, a masternode quorum will be determined and those 10 selected masternodes will issue a masternode payment vote message to pick the next winning node.
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is signing the message
2016-10-11 15:06:44 +02:00
| 4 | nBlockHeight | int | The blockheight which the payee should be paid
| ? | payeeAddress | CScript | The address to pay to
| 71-73 | sig | char[] | Signature of the masternode which is signing the message
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSTX - "dstx"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CDarksendBroadcastTx
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Masternodes can broadcast subsidised transactions without fees for the sake of security in mixing. This is done via the DSTX message.
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| # | tx | [CTransaction ](#ctransaction ) | The transaction
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is signing the message
2016-10-11 15:06:44 +02:00
| 71-73 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)
| 8 | sigTime | int64_t | Time this message was signed
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSSTATUSUPDATE - "dssu"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Mixing pool status update
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 4 | nMsgSessionID | int | Session ID
| 4 | nMsgState | int | Current state of mixing process
| 4 | nMsgEntriesCount | int | Number of entries in the mixing pool
2016-10-22 18:52:14 +02:00
| 4 | nMsgStatusUpdate | int | Update state and/or signal if entry was accepted or not
| 4 | nMsgMessageID | int | ID of the typical masternode reply message
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSQUEUE - "dsq"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CDarksendQueue
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Asks users to sign final mixing tx message.
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 4 | nDenom | int | Which denomination is allowed in this mixing session
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is hosting this session
2017-12-05 23:17:45 +01:00
| 8 | nTime | int64_t | the time this DSQ was created
| 1 | fReady | bool | if the mixing pool is ready to be executed
| 66 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSACCEPT - "dsa"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Response to DSQ message which allows the user to join a mixing pool
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 4 | nDenom | int | denomination that will be exclusively used when submitting inputs into the pool
2018-03-02 14:13:47 +01:00
| 216+ | txCollateral | [CTransaction ](#ctransaction ) | collateral tx that will be charged if this client acts maliciously
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSVIN - "dsi"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
CDarkSendEntry
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
When queue is ready user is expected to send his entry to start actual mixing
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| ? | vecTxDSIn | CTxDSIn[] | vector of users inputs (CTxDSIn serialization is equal to [CTxIn ](#ctxin ) serialization)
2018-03-02 14:13:47 +01:00
| 216+ | txCollateral | [CTransaction ](#ctransaction ) | Collateral transaction which is used to prevent misbehavior and also to charge fees randomly
| ? | vecTxOut | [CTxOut ](#ctxout )[] | vector of user outputs
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### DSSIGNFINALTX - "dss"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
User's signed inputs for a group transaction in a mixing session
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| # | inputs | [CTxIn ](#ctxin )[] | signed inputs for mixing session
2016-10-11 15:06:44 +02:00
2017-02-19 22:02:33 +01:00
### TXLOCKREQUEST - "ix"
CTxLockRequest
2017-09-05 12:53:15 +02:00
Transaction Lock Request, serialization is the same as for [CTransaction ](#ctransaction ).
2017-02-19 22:02:33 +01:00
### TXLOCKVOTE - "txlvote"
CTxLockVote
Transaction Lock Vote
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-02-19 22:02:33 +01:00
| 32 | txHash | uint256 | txid of the transaction to lock
2017-09-05 12:53:15 +02:00
| 36 | outpoint | [COutPoint ](#coutpoint ) | The utxo to lock in this transaction
| 36 | outpointMasternode | [COutPoint ](#coutpoint ) | The utxo of the masternode which is signing the vote
2017-02-19 22:02:33 +01:00
| 71-73 | vchMasternodeSignature | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)
2016-10-11 15:06:44 +02:00
### MNGOVERNANCEOBJECT - "govobj"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Governance Object
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
A proposal, contract or setting.
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2016-10-11 15:06:44 +02:00
| 32 | nHashParent | uint256 | Parent object, 0 is root
| 4 | nRevision | int | Object revision in the system
| 8 | nTime | int64_t | Time which this object was created
| 32 | nCollateralHash | uint256 | Hash of the collateral fee transaction
| 0-16384 | strData | string | Data field - can be used for anything
| 4 | nObjectType | int | ????
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is signing this object
2017-09-05 12:53:15 +02:00
| 66* | vchSig | char[] | Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
### MNGOVERNANCEOBJECTVOTE - "govobjvote"
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Governance Vote
2016-04-19 23:44:47 +02:00
2016-10-11 15:06:44 +02:00
Masternodes use governance voting in response to new proposals, contracts, settings or finalized budgets.
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output of the masternode which is voting
2016-10-11 15:06:44 +02:00
| 32 | nParentHash | uint256 | Object which we're voting on (proposal, contract, setting or final budget)
| 4 | nVoteOutcome | int | ???
2017-02-19 22:02:33 +01:00
| 4 | nVoteSignal | int | ???
2016-10-11 15:06:44 +02:00
| 8 | nTime | int64_t | Time which the vote was created
2017-09-05 12:53:15 +02:00
| 66* | vchSig | char[] | Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)
2017-06-26 15:56:52 +02:00
### SPORK - "spork"
Spork
Spork
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
| 4 | nSporkID | int | |
| 8 | nValue | int64_t | |
| 8 | nTimeSigned | int64_t | |
| 66* | vchSig | char[] | Unclear if 66 is the correct size, but this is what it appears to be in most cases |
2017-06-26 15:56:52 +02:00
#### Defined Sporks (per src/sporks.h)
| Spork ID | Number | Name | Description |
| ---------- | ---------- | ----------- | ----------- |
| 10001 | 2 | INSTANTSEND_ENABLED | Turns on and off InstantSend network wide
| 10002 | 3 | INSTANTSEND_BLOCK_FILTERING | Turns on and off InstantSend block filtering
| 10004 | 5 | INSTANTSEND_MAX_VALUE | Controls the max value for an InstantSend transaction (currently 2000 dash)
2018-02-16 15:54:53 +01:00
| 10005 | 6 | NEW_SIGS | Turns on and off new signature format for Dash-specific messages
2017-06-26 15:56:52 +02:00
| 10007 | 8 | MASTERNODE_PAYMENT_ENFORCEMENT | Requires masternodes to be paid by miners when blocks are processed
| 10008 | 9 | SUPERBLOCKS_ENABLED | Superblocks are enabled (the 10% comes to fund the dash treasury)
| 10009 | 10 | MASTERNODE_PAY_UPDATED_NODES | Only current protocol version masternode's will be paid (not older nodes)
2018-01-06 11:05:55 +01:00
| 10011 | 12 | RECONSIDER_BLOCKS | |
| 10012 | 13 | OLD_SUPERBLOCK_FLAG | |
2017-06-26 15:56:52 +02:00
| 10013 | 14 | REQUIRE_SENTINEL_FLAG | Only masternode's running sentinel will be paid
## Undocumented messages
### MASTERNODEPAYMENTBLOCK - "mnwb"
Masternode Payment Block
*NOTE: Per src/protocol.cpp, there is no message for this (only inventory)*
### MNVERIFY - "mnv"
Masternode Verify
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint1 | [COutPoint ](#coutpoint ) | The unspent output which is holding 1000 DASH for masternode 1
| 36 | masternodeOutpoint2 | [COutPoint ](#coutpoint ) | The unspent output which is holding 1000 DASH for masternode 2
2017-09-05 12:53:15 +02:00
| # | addr | [CService ](#cservice ) | IPv4 address / port of the masternode
| 4 | nonce | int | Nonce
| 4 | nBlockHeight | int | The blockheight
| 66* | vchSig1 | char[] | Signature of by masternode 1 (unclear if 66 is the correct size, but this is what it appears to be in most cases)
| 66* | vchSig2 | char[] | Signature of by masternode 2 (unclear if 66 is the correct size, but this is what it appears to be in most cases)
2017-06-26 15:56:52 +02:00
### DSFINALTX - "dsf"
Darksend Final Transaction
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
| 4 | nSessionID | int | |
2017-09-05 12:53:15 +02:00
| # | txFinal | [CTransaction ](#ctransaction ) | Final mixing transaction
2017-06-26 15:56:52 +02:00
### DSCOMPLETE - "dsc"
Darksend Complete
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
| 4 | nSessionID | int | |
| 4 | nMessageID | int | |
2017-06-26 15:56:52 +02:00
### MNGOVERNANCESYNC - "govsync"
Governance Sync
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
| 32 | nHash | uint256 | |
| # | filter | CBloomFilter | |
2017-09-05 12:53:15 +02:00
2017-06-26 15:56:52 +02:00
### DSEG - "dseg"
Masternode List/Entry Sync
Get Masternode list or specific entry
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-15 08:29:44 +01:00
| 36 | masternodeOutpoint | [COutPoint ](#coutpoint ) | The unspent output which is holding 1000 DASH
2017-09-05 12:53:15 +02:00
2017-06-26 15:56:52 +02:00
### SYNCSTATUSCOUNT - "ssc"
Sync Status Count
2017-09-05 12:53:15 +02:00
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2017-09-05 12:53:15 +02:00
| 4 | nItemID | int | Masternode Sync Item ID
| 4 | nCount | int | Masternode Sync Count
#### Defined Sync Item IDs (per src/masternode-sync.h)
| Item ID | Name | Description |
| ---------- | ---------- | ----------- |
2018-01-06 11:05:55 +01:00
| 2 | MASTERNODE_SYNC_LIST | |
| 3 | MASTERNODE_SYNC_MNW | |
| 4 | MASTERNODE_SYNC_GOVERNANCE | |
| 10 | MASTERNODE_SYNC_GOVOBJ | |
| 11 | MASTERNODE_SYNC_GOVOBJ_VOTE | |
2017-09-05 12:53:15 +02:00
2017-06-26 15:56:52 +02:00
### MASTERNODEPAYMENTSYNC - "mnget"
2017-09-05 12:53:15 +02:00
Masternode Payment Sync
| Field Size | Field Name | Data type | Description |
2018-01-06 11:05:55 +01:00
| ---------- | ----------- | --------- | ---------- |
2018-02-21 17:32:21 +01:00
| 4 | nMnCount | int | | (DEPRECATED)
2017-09-05 12:53:15 +02:00
2018-02-21 17:32:21 +01:00
*NOTE: There are no fields in this mesasge starting from protocol 70209*