Skip to content

Instantly share code, notes, and snippets.

@tynes
Created April 7, 2020 06:47
Show Gist options
  • Save tynes/e2ca9d149637543093da71f7c9c1b5e0 to your computer and use it in GitHub Desktop.
Save tynes/e2ca9d149637543093da71f7c9c1b5e0 to your computer and use it in GitHub Desktop.
structs for handshake utxo
## Output Structuring
In a UTXO-based blockchain, the typical transaction output consists of a
_locking script_, or _predicate_, combined with an output value.
A typical bitcoin output exists as a struct of:
fig. 16
``` c
struct output_s {
int64_t value;
uint8_t script[];
} output;
```
With `script` being the locking script; the predicate which locks up money for
redemption. We add a new field called `covenant`:
fig. 17
``` c
struct output_s {
int64_t value;
uint8_t script[];
struct covenant_s {
uint8_t action;
uint8_t arguments[][];
} covenant;
} output;
```
The money can still be locked up by the predicate just the same. However, when
money is sent into a covenant, it limits where the output may be redeemed _to_.
Due to the fact that the covenant behavior is only prescribed at the consensus
level, this construction should be resistant to fungibility attacks in
comparison to other covenants proposals.
cite: handshake white paper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment