Skip to content

Introducing new tx versioning

Prasanna Loganathar edited this page Dec 15, 2021 · 3 revisions

Currently custom transaction in defichain are part of vout0 scriptPubKey starting by OP_RETURN say 6a4466547843 + marker DfTx + tx type 'C' for createmasternode the bytes afterwards are floating, that means protocol unstable between hardforks.

The main goal of tx versioning is to have deterministic version on every tx type, so when one version is supported it's unchanged and stable on protocol side. Increasing version on blockchain side means the type structure is completely different and it should have new handler at protocol side. By changing marker from DfTx to something similar but different to indicate we start tx type versioning, let's say DfcTx - DeFiChain Transaction, we can introduce an well cooperate new marker with legacy one.

The proposal is quite simple and well defined:

DfcTx marker + 8 bytes timestamp + tx type say createmasternode C + one byte version 0-255 followed by the data.

TODO: DfTxMarker + (DfTx Version) + (Expiry blockheight) + tx type say createmasternode C + one byte version + ...

On blockchain side both markers will be supported, all tx type versions at same time, no deprecation. Timestamp stays to ensure when exactly tx is being constructed and it can live some time, on mempool or wherever, but it cannot be part of blockchain, somehow resend, if it's too old, covered by consensus.