Protocol Documentation - 0.12.1

December 5, 2017 ยท View on GitHub

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

Common Structures

Simple types

uint256 => char[32]

CScript => uchar[]

COutPoint

Bitcoin Outpoint https://bitcoin.org/en/glossary/outpoint

Field SizeField NameData typeDescription
32hashuint256Hash of transactional output which is being referenced
4nuint32_tIndex of transaction which is being referenced

CTxIn

Bitcoin Input https://bitcoin.org/en/glossary/input

Field SizeField NameData typeDescription
36prevoutCOutPointThe previous output from an existing transaction, in the form of an unspent output
1+script lengthvar_intThe length of the signature script
?scriptCScriptThe script which is validated for this input to be spent
4nSequenceuint_32tTransaction version as defined by the sender. Intended for "replacement" of transactions when information is updated before inclusion into a block.

CTxOut

Bitcoin Output https://bitcoin.org/en/glossary/output

Field SizeField NameData typeDescription
8nValueint64_tTransfered value
?scriptPubKeyCScriptThe script for indicating what conditions must be fulfilled for this output to be further spent

CTransaction

Field SizeField NameData typeDescription
4nVersionint32_tTransaction data format version
1+tx_in countvar_intNumber of Transaction inputs
41+vinCTxInA list of 1 or more transaction inputs
1+tx_out countvar_intNumber of Transaction outputs
9+voutCTxOutA list of 1 or more transaction outputs
4nLockTimeuint32_tThe block number or timestamp at which this transaction is unlocked

CPubKey

Bitcoin Public Key https://bitcoin.org/en/glossary/public-key

Field SizeField NameData typeDescription
33-65vchchar[]The public portion of a keypair which can be used to verify signatures made with the private portion of the keypair.

CService

Field SizeField NameData typeDescription
16IPCNetAddrIP Address
2Portuint16IP Port

Message Types

MNANNOUNCE - "mnb"

CMasternodeBroadcast

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 SizeField NameData typeDescription
41vinCTxInThe unspent output which is holding 1000 DASH
#addrCServiceIPv4 address of the masternode
33-65pubKeyCollateralAddressCPubKeyCPubKey of the main 1000 DASH unspent output
33-65pubKeyMasternodeCPubKeyCPubKey of the secondary signing key (For all other messaging other than announce message)
71-73sigchar[]Signature of this message (verifiable via pubKeyCollateralAddress)
8sigTimeint64_tTime which the signature was created
4nProtocolVersionintThe protocol version of the masternode
#lastPingCMasternodePingThe last known ping of the masternode
8nLastDsqint64_tThe last time the masternode sent a DSQ message (for mixing) (DEPRECATED)

MNPING - "mnp"

CMasternodePing

Every few minutes, masternodes ping the network with a message that propagates the whole network.

Field SizeField NameData typeDescription
41vinCTxInThe unspent output of the masternode which is signing the message
32blockHashuint256Current chaintip blockhash minus 12
8sigTimeint64_tSignature time for this ping
71-73vchSigchar[]Signature of this message by masternode (verifiable via pubKeyMasternode)

MASTERNODEPAYMENTVOTE - "mnw"

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.

Field SizeField NameData typeDescription
41vinMasternodeCTxInThe unspent output of the masternode which is signing the message
4nBlockHeightintThe blockheight which the payee should be paid
?payeeAddressCScriptThe address to pay to
71-73sigchar[]Signature of the masternode which is signing the message

DSTX - "dstx"

CDarksendBroadcastTx

Masternodes can broadcast subsidised transactions without fees for the sake of security in mixing. This is done via the DSTX message.

Field SizeField NameData typeDescription
#txCTransactionThe transaction
41vinCTxInMasternode unspent output
71-73vchSigchar[]Signature of this message by masternode (verifiable via pubKeyMasternode)
8sigTimeint64_tTime this message was signed

DSSTATUSUPDATE - "dssu"

Mixing pool status update

Field SizeField NameData typeDescription
4nMsgSessionIDintSession ID
4nMsgStateintCurrent state of mixing process
4nMsgEntriesCountintNumber of entries in the mixing pool
4nMsgStatusUpdateintUpdate state and/or signal if entry was accepted or not
4nMsgMessageIDintID of the typical masternode reply message

DSQUEUE - "dsq"

CDarksendQueue

Asks users to sign final mixing tx message.

Field SizeField NameData typeDescription
4nDenomintWhich denomination is allowed in this mixing session
41vinCTxInunspend output from masternode which is hosting this session
8nTimeint64_tthe time this DSQ was created
1fReadyboolif the mixing pool is ready to be executed
66vchSigchar[]Signature of this message by masternode (verifiable via pubKeyMasternode)

DSACCEPT - "dsa"

Response to DSQ message which allows the user to join a mixing pool

Field SizeField NameData typeDescription
4nDenomintdenomination that will be exclusively used when submitting inputs into the pool
41+txCollateralintcollateral tx that will be charged if this client acts maliciousely

DSVIN - "dsi"

CDarkSendEntry

When queue is ready user is expected to send his entry to start actual mixing

Field SizeField NameData typeDescription
?vecTxDSInCTxDSIn[]vector of users inputs (CTxDSIn serialization is equal to CTxIn serialization)
8nAmountint64_tdepreciated since 12.1, it's used for backwards compatibility only and can be removed with future protocol bump
?txCollateralCTransactionCollateral transaction which is used to prevent misbehavior and also to charge fees randomly
?vecTxOutCTxOut[]vector of user outputs

DSSIGNFINALTX - "dss"

User's signed inputs for a group transaction in a mixing session

Field SizeField NameData typeDescription
#inputsCTxIn[]signed inputs for mixing session

TXLOCKREQUEST - "ix"

CTxLockRequest

Transaction Lock Request, serialization is the same as for CTransaction.

TXLOCKVOTE - "txlvote"

CTxLockVote

Transaction Lock Vote

Field SizeField NameData typeDescription
32txHashuint256txid of the transaction to lock
36outpointCOutPointThe utxo to lock in this transaction
36outpointMasternodeCOutPointThe utxo of the masternode which is signing the vote
71-73vchMasternodeSignaturechar[]Signature of this message by masternode (verifiable via pubKeyMasternode)

MNGOVERNANCEOBJECT - "govobj"

Governance Object

A proposal, contract or setting.

Field SizeField NameData typeDescription
32nHashParentuint256Parent object, 0 is root
4nRevisionintObject revision in the system
8nTimeint64_tTime which this object was created
32nCollateralHashuint256Hash of the collateral fee transaction
0-16384strDatastringData field - can be used for anything
4nObjectTypeint????
41vinMasternodeCTxInUnspent output for the masternode which is signing this object
66*vchSigchar[]Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)

MNGOVERNANCEOBJECTVOTE - "govobjvote"

Governance Vote

Masternodes use governance voting in response to new proposals, contracts, settings or finalized budgets.

Field SizeField NameData typeDescription
41+vinMasternodeCTxInUnspent output for the masternode which is voting
32nParentHashuint256Object which we're voting on (proposal, contract, setting or final budget)
4nVoteOutcomeint???
4nVoteSignalint???
8nTimeint64_tTime which the vote was created
66*vchSigchar[]Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)

SPORK - "spork"

Spork

Spork

Field SizeField NameData typeDescription
4nSporkIDint
8nValueint64_t
8nTimeSignedint64_t
66*vchSigchar[]Unclear if 66 is the correct size, but this is what it appears to be in most cases

Defined Sporks (per src/sporks.h)

Spork IDNumberNameDescription
100012INSTANTSEND_ENABLEDTurns on and off InstantSend network wide
100023INSTANTSEND_BLOCK_FILTERINGTurns on and off InstantSend block filtering
100045INSTANTSEND_MAX_VALUEControls the max value for an InstantSend transaction (currently 2000 dash)
100078MASTERNODE_PAYMENT_ENFORCEMENTRequires masternodes to be paid by miners when blocks are processed
100089SUPERBLOCKS_ENABLEDSuperblocks are enabled (the 10% comes to fund the dash treasury)
1000910MASTERNODE_PAY_UPDATED_NODESOnly current protocol version masternode's will be paid (not older nodes)
1001112RECONSIDER_BLOCKS
1001213OLD_SUPERBLOCK_FLAG
1001314REQUIRE_SENTINEL_FLAGOnly 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

Field SizeField NameData typeDescription
41vin1CTxInThe unspent output which is holding 1000 DASH for masternode 1
41vin2CTxInThe unspent output which is holding 1000 DASH for masternode 2
#addrCServiceIPv4 address / port of the masternode
4nonceintNonce
4nBlockHeightintThe blockheight
66*vchSig1char[]Signature of by masternode 1 (unclear if 66 is the correct size, but this is what it appears to be in most cases)
66*vchSig2char[]Signature of by masternode 2 (unclear if 66 is the correct size, but this is what it appears to be in most cases)

DSFINALTX - "dsf"

Darksend Final Transaction

Field SizeField NameData typeDescription
4nSessionIDint
#txFinalCTransactionFinal mixing transaction

DSCOMPLETE - "dsc"

Darksend Complete

Field SizeField NameData typeDescription
4nSessionIDint
4nMessageIDint

MNGOVERNANCESYNC - "govsync"

Governance Sync

Field SizeField NameData typeDescription
32nHashuint256
#filterCBloomFilter

DSEG - "dseg"

Masternode List/Entry Sync

Get Masternode list or specific entry

Field SizeField NameData typeDescription
41vinCTxInThe unspent output which is holding 1000 DASH

SYNCSTATUSCOUNT - "ssc"

Sync Status Count

Field SizeField NameData typeDescription
4nItemIDintMasternode Sync Item ID
4nCountintMasternode Sync Count

Defined Sync Item IDs (per src/masternode-sync.h)

Item IDNameDescription
2MASTERNODE_SYNC_LIST
3MASTERNODE_SYNC_MNW
4MASTERNODE_SYNC_GOVERNANCE
10MASTERNODE_SYNC_GOVOBJ
11MASTERNODE_SYNC_GOVOBJ_VOTE

MASTERNODEPAYMENTSYNC - "mnget"

Masternode Payment Sync

Field SizeField NameData typeDescription
4nMnCountint