Tockchain Transaction Types

Join the Tockchain public testnet and gain early access to the infrastructure powering the next generation of stablecoins

Transactions.png

0. Overview

Tockchain is a multi-asset blockchain that supports various transaction types including standard transfers, pools, orderbook trading, and cross-chain operations.

This documentation covers the essential transaction types and structures needed to leverage Tockchain transactions.

Tockchain uses a unique transaction identification system called "tockid" instead of traditional transaction hashes. A tockid consists of:

This document explains how to create and process various transaction types within Tockchain. Each transaction consists of two main parts:

  1. Transaction Command: The first part describes the transaction you want to execute. This includes the specific command (e.g., maketx, multisigaddr, etc.) and its associated parameters such as sender, recipient, amount, asset type, and additional data. The command is submitted to the system for processing.
  2. Transaction Result: After processing the command, the system returns the result of the transaction. This will include details such as the transaction’s status (e.g., "result": "success"), the transaction hash, and other relevant information. This output helps you verify if the transaction was successful and view any additional information, such as timestamps and potential chain lag.

Each section in this documentation follows this format: you will first find the transaction command, followed by the transaction result. This structure is consistent across all transaction types described.

1. Standard Transactions

1.0. Introduction to Standard Transactions

To simplify the process of creating different transaction types, a maketx JSON command has been implemented for the websockets interface. This command allows you to specify the transaction type and its parameters. It then returns a hash that needs to be signed, along with the rawhex representation of the transaction.

The first 64 bytes of the rawhex will always be set to 0x00. This is where the transaction signature must be placed. When signing the transaction, the address that signs it must match the sender address specified in the transaction parameters.

1.1. Send Transaction

1.2. Burn Transactions

Burn transactions are used to destroy (or “burn”) a specified amount of an asset, removing it from circulation.

2. Crosschain Transactions

2.1. Crosschain Transaction

3. Order Transactions

3.0. Introduction to Order Transactions

Order Transactions provide a comprehensive orderbook trading solution on Tockchain, specifically for asset trading using a maker/taker system. It leverages hashed addresses to secure orders, incorporates basecoin rewards, and allows for OTC trades. Tracking is simplified with special address tracking for each order type.

Here’s a breakdown of the key features:

3.1. Order Address Transaction

3.2. Maker Order Transaction

3.3. Maker Order Cancellation Transaction

3.4. Maker Order Claim Reward Transaction - Result (Output)

3.5. Taker Order Transaction

3.6. Open Orders Transaction

4. Pool Transactions

4.0. Introduction to Pool Transactions

To create a new asset, a minimum deposit of 1000 VUSD is required. Additionally, before a pool can be used, the asset itself must be deposited into the pool’s address. This deposit can be made by anyone but is typically expected to be done by the asset’s creator. If the asset creator does not fund the other half of the pool, the pool will remain non-functional.

There are three primary pool functions: swap, deposit, and withdraw. Each of these functions has specific inputs and workflows, detailed below with examples.

4.1. Poolswap Transaction

4.2. Pooldeposit Transaction

4.3. Poolwithdraw Transaction

5. Multi-Signature Transactions

5.0. Introduction to Multi-Signature Transactions

For multisig transactions, you need to create a multisig address using the multisigaddr command. Similar to Bitcoin, you specify the number of signers, the minimum signatures required, and all the pubkeys. There is also an optional locktime, which prevents the funds from being spent until that locktime (if nonzero).

Unlike Bitcoin's multisig, the position of the pubkeys matters, as the signatures will be prefixed with the pubkey index, starting from 0.

Regarding size limits, there is approximately 2 KB of space available for both pubkeys and signatures, and any combination that fits within that space is acceptable. The multisigaddr command will return an error if the numsigners and minsigs values exceed the available space.

To estimate if a specific combination will fit, add the number of signers to twice the number of minimum signatures. If the total is less than 64, it will fit—actually, a few more could be squeezed in. For example, a 16 of 32 multisig setup would be close to the size limit, as would a 1 of 64 setup.

5.1. Multi-Signature Address Creation Transaction

5.2. Multi-Signature Spend Transaction

6. Coldspend Transactions

6.1. Coldspend Transaction

7. Hashlock Transactions

7.0. Introduction to Hashlock Transactions

The hashlock transaction combines locking funds to an address until a specific time (locktime) with a hash of a secret. Currently, the supported hashing algorithms are K12 and SHA256, and more hashing types can be added if needed. This mechanism is useful for implementing features like atomic swaps.

For a detailed explanation of atomic swaps, refer to [Chainlink’s guide on Atomic Swaps](https://chain.link/education-hub/atomic-swaps#:~:text=Atomic swaps use a hash timelock contract (HTLC),of tokens has been deposited to the contract.).

The first step in creating a hashlock transaction is to define the locking parameters using the “hashlockaddr” command. This calculates the address where funds will be locked based on the specified parameters. After generating the address, funds can be sent to it and will remain locked until the conditions are met.

{
  "command": "hashlockaddr",
  "locktime": 0,
  "lockedasset": "QUBIC",
  "hashalgo": 1,
  "locker": "COINLIBPCMZHFABKWAFYZLFVNFTBOIVGRSLQPLFTUBKIEMSDVKAXHLEGIMEI",
  "unlocker": "TESTINKCOUDNIHYZBBOGWJSCHFPCZIUDAHQIXYARXEXFYSBYEXHVSALAFNBN",
  "lockhash": "ac618b56e058f928d0c0f5657af041be90b42da3b137dc2ea62e7f8f257036dd"
}

Note that any asset can be locked (lockedasset).

Setting the locktime to 0 disables time-lock functionality and does not support atomic swap protocols. Ensure the lock parameters are configured correctly for your use case. The unlocker field can be left blank to allow anyone to claim the funds if they know the secret. However, this allows the locker (who knows the secret) to reclaim the funds at any time, limiting its use to specific cases like contests or challenges.

Once funds are locked, they can only be unlocked and spent by someone who knows the secret that hashes to the specified lockhash. If locktime is set, the locker cannot reclaim funds until after the locktime. If the secret is known, the funds can be unlocked at any time before or after the locktime.

7.1. Hashlock Transactions

8. Assets Transactions

8.0. Introduction to Assets Transactions

Assets are a fundamental part of Tockchain. While up to 32,000 assets can exist, there needs to be a mechanism for their creation. Creating an asset requires 1,000 VUSD, and some initial amount of the created asset must be allocated for the liquidity pool. The 1,000 VUSD is added to the liquidity pool and serves a vital role in connecting all tokens through feeless VUSD pools. This design allows users to swap between assets (e.g., from A to B and back to A) with a minimal loss of approximately 0.0001%.

Tockchain supports mintable and non-mintable assets:

  1. Mintable Assets:
  2. Non-Mintable Assets:

After an asset is created and the liquidity pool is funded, the initial price of the asset is determined by the reserves in the pool. It is highly recommended that asset creators set an initial price close to the current market value. If there is no pre-existing market, the initial balance provided becomes the starting market price. All Tockchain assets use 8 decimal precision (e.g., 1,000 VUSD = 1,000 × 10⁸ satoshis).

8.1. Assets Creation Transactions

8..2. Asset Minting Transactions

9. Network Transactions

9.0. Introduction to System Transactions

These are special commands reserved for critical network-level operations such as adding, removing, or replacing nodes. The primary purpose is to maintain synchronization and avoid confusion among validators about network changes.

Process to Change Network Configuration:

  1. Issue a systemtx Command: Use the appropriate system transaction to add, remove, or replace a node.
  2. Start the New Generator Node (if applicable): If a node is added or replaced, initialize the new generator node.
  3. Update Existing Generator Nodes: One by one, update the other generator nodes to recognize the new configuration. This effectively hardforks the new node list into the network. Without this step, validators could mistake the new node as an imposter.
  4. Sync the New Validator Node After the Change: Once the next hour begins, start the validator node. Use -fast sync mode to download the previous hour’s STATE files (an external mechanism must be implemented to support large STATE file transfers).

Special Considerations:

9.1. Node Addition Transactions

9.2. Node Removal Transactions

Support