Transactions

A blockchain is built from blocks containing transactions. Transactions are accumulated by a business chain (L1) and combined into blocks every five seconds. A block is only created if there are new transactions. Those blocks are hashed, signed, and written to the ledger for permanent and immutable storage. The block and its transactions are then sent (sans payload) to Dragon Net for decentralized verification of proofs.

Creating Transactions

Creating a transaction is as simple as creating a transaction type and then passing payload information to the chain. L1 chain payloads can be strings or stringified JSON objects.

Create the transaction type:

$ dctl transactionType create "quickstart"
{
  "status": 200,
  "response": {
    "success": true
  },
  "ok": true
}

Create various transactions:

$ dctl transaction create "quickstart" "hello"
Could not parse JSON for payload, sending raw data instead...
{
  "status": 201,
  "response": {
    "transaction_id": "0296540b-eb8e-429e-addb-f36d6ac08244"
  },
  "ok": true
}

$ dctl transaction create "quickstart" '{"hello":"world"}'
{
  "status": 201,
  "response": {
    "transaction_id": "0f9a75c6-c8db-4c95-9bca-8194211a8e52"
  },
  "ok": true
}

On a real system, it is recommended to standardize the data structure for every transaction type so that you may create efficient indexes to search for transactions based upon important payload fields, however, it is possible to send fully arbitrary payload data within a transaction to your business chain if you so desire.