Transactions

Transactions

  • are used to transfer DFI and dTokens
  • have inputs and outputs
  • difference between inputs and outputs is considered a transaction fee
  • not encrypted
  • identified by their SHA256 hashes

Custom Transactions also exist to interact with dApps such as the DeX and Loans.

Transaction Format

Block bodies contain CTransaction which have the following structure:

NameData TypeDescription
nVersionint32_tCurrently 4.
vinvectorList of input transactions.
voutvectorList of output transactions.
nLockTimeuint32_tBlock height or timestamp when transaction is final
hashuint256Hash of transaction without witness data.
m_witness_hashuint256Hash of transaction with witness data.

CTxIn is an input transaction, and has the following structure:

NameData TypeDescription
prevoutCOutPointHash and index of transaction holding the output to spend.
scriptSigCScriptTransaction unlocking script.
nSequenceuint32_tSequence number. Defaults to 0xFFFFFFFE.
scriptWitnessCScriptWitnessWitness data for this input transaction.

Similar to Bitcoin's script system, a scriptPubKey must be able to unlock the respective scriptSig.

Each non-coinbase input spends an outpoint (COutPoint) from a previous transaction. Coinbase transactions set prevout to null, and encode the block height in scriptSig.

CTxOut is the output of the current transaction, and has the following structure:

NameData TypeDescription
nValueCAmountAmount of DFI to spend.
scriptPubKeyCScriptDefines the conditions which must be satisfied to spend this output.
nTokenIdDCT_IDID of token transferred. DFI has ID 0.

Coinbase Transaction

Coinbase transactions have the following properties

  • it is the first transaction in a block
  • there can only be one coinbase transaction per block
  • creates new DFI in mining masternode's wallet

The base block reward is split into 6 different recipients. Recipients marked with UTXO are the only outputs present in the coinbase transaction.

RecipientCoinbase allocationDescription
Masternode (UTXO)33.33%Masternode rewards. Masternode also receives additional income from transaction fees.
Community Fund (UTXO)4.91%Community fund controlled by the Foundation, used to finance DeFiChain initiatives. ref
Anchor0.02%Fund to pay the Bitcoin transaction fee for anchoring.
Liquidity Pools25.45%Distributed to LP providers as incentive.
Loans24.68%Incentives for atomic swap and DeFiChain futures.
Options9.88%Distributed to options holders. Not in use currently.
Unallocated1.73%N/A

External Resources