Skip to content

Transaction Details


Drep transactions are transfers of drep that exist within blocks. There are many types of transactions, which are ordinary transaction, creating smart contract transaction, calling smart contract transaction, and sending alias transaction. Each transaction is tailored to one specific occasion, and the user selects the transaction type according to its own need.

Transaction Types

  • Ordinary transaction Send DREP Token from one address to another address, realizing assets transfer.。
  • Creating smart contract transaction Put contracts written in solidity language on Chain to facilitate the decentralized execution of the contract.
  • Executing smart contract transaction A new contract address is generated after the creation of smart contract; The user sends a transaction based on its own right, and can also execute the smart contract.
  • Sending alias transaction It is difficult to remember DREP address type, so the user can set an alias for its own account address. Replacing alias with address is much easier for memory and usage.

Transaction Format

At the protocol level, all transactions share the same basic transaction format; The type of transaction is determined by the type field in the transaction. The section below describes this basic transaction format.

Below are the top-level fields of any transaction data.

Field Description Size
Version Transaction version. This number is used to signify how the transaction should be interpreted. 8 bytes
Nonce Record the number of transactions sent from one account address 1- 8 bytes
Type Transaction type 8 bytes
To The recipient of the transfer, if it is Nil, it means creating a smart contract 20 bytes
ChainId Identify different types of network IDs 4 bytes
Amount The amount of the transfer; if it is 0, it means calling the smart contract. 128 bytes
GasPrice The gas fee set for the current transaction 128 bytes
GasLimit Set the maximum amount of gas for the current transaction. During the transaction, if the gas amount exceeds this setting, the execution of transaction will fail. 128 bytes
Timestamp The system timestamp of the transaction
4 bytes
Data The data carried by the transaction, contract information is stored here when publish or call smart contract; it can be a storage space for other transactions. varary

Below are the top-level fields of any transaction other.

Field Description Size
Sig Signature information for the transaction varary
txHash The transaction hash, store this value to save computing time 20bytes
signMessage Store serialized data in transaction to save computing time varary
message Store serialized transaction data to save computing time varary
from Store the source send address to save computing time 10 bytes

Serialization

The serialization and the hash calculation of transaction require a lot of CPU resources. Therefore, DREP will serialize the transaction and record the data after hash calculation in database, and it can be directly read when needed. The transaction uses drepbinary to serialize it directly to obtain a serialized value, and uses sha3.Keccak256 to get a hash value.

Example Transaction

Below we examine an example transaction from the Drep mainnet.

Raw Transaction (Hex)

Here is the raw hex data for the example transaction.

01000000024ff28b534361e383b5b149df4572feb1fbc659cb07067c3cb6c684452ae79f540100000000ffffffffc619e6ade3f469b8bb60b8ae9b0599eeeca05cd2db251cadea443344eafdac570100000000ffffffff0291c2e26d0200000000001976a914f2ccddc70f8b8bcea24a362bf404841d53cbebc088acd676dd680100000000001976a9141a1f5c7e9f7696989dced5cb9b61464f95790b7288ac000000000000000002ca68865402000000a29c0400040000006a4730440220139466bd10b1f071f9b4ac16ed434d63d090613fd06470f7bca9bba2b6ea6a0a02203cad1297ab9384466b3f304cd61e7e4ffa9abc1ae9fe1630207fae6f200da1680121024d540859b805c5780f2f0da350df8757c1defb72e3381b252d20874478a5549c49743a82010000009e9c0400010000006b483045022100da5b0fde58c4c57a88d96f83b02eddcb67b1b68ce95cc562c895f2e4e57bb44302201a8744aed654d2979bdd797187f6bf63ad1898c5d5c585309eeca558742858b201210307e3d98b004b15561c0f5aa158c90f93de33756d3bfd1f8a1058a4d90ffc7ec7