Skip to content
Snippets Groups Projects

WIP: RFC 5 : New Scalable Blockchain Protocol

Closed nanocryk requested to merge rfc5-duniter-protocol-rework into master
1 file
+ 23
6
Compare changes
  • Side-by-side
  • Inline
@@ -289,9 +289,8 @@ A **transaction document** describes the consumption of **sources** and the crea
of UDs to spend. Each source or UD can be spent only once, and the
**sum of *inputs* values must equal the sum of *output* values**.
Each *output* describes spending conditions using a **script**. This *script* is defined as
an **Abstract Syntaxic Tree** of operations which returns a boolean : can this output be used
as an input of a new transaction. This format will be describe further in this document.
Each *output* describes spending conditions using a **script** system which will be
described below.
| Size | Data |
|:----:|:-----|
@@ -305,12 +304,30 @@ as an input of a new transaction. This format will be describe further in this d
| | **For each unspent input** : |
| *32 bytes* | Source transaction document hash |
| *1 byte* | Source output index |
| ... | *Unlock conditions* |
| ... | *Unlock parameters (with alignement padding)* |
| | **For each output** : |
| *4 bytes* | Unsigned currency value |
| *1 byte* | Unsigned value power base |
| ... | *Lock script* |
| ... | *Lock script (with alignement padding)* |
### 8.X Script system
### 8.2 Script system
> This system is heavily inspired by Bitcoin script system discribed
> [here](https://en.bitcoin.it/wiki/Script). It adds to it transaction data reflection
> such as outputs, amounts, merkelized scripts and multiple cryptographic systems
> support.
The script system is simple, stack-based and processed from left to right. It is intentionnaly
not Turing-complete, with no loops.
A transaction is valid if nothing in the combined script triggers a failure and the top
stack item is `true` (non-zero) when the script exits.
That stacks hold byte vectors. When used as numbers, byte vectors are interpreted as
big-endian variable-length integers with two's complement fir sign handling. 0 can also be
represented by a null-length vector. Byte vectors are interpreted as booleans where `false`
is represented by 0 and `true` by any other value.
#### Opcodes
TODO
\ No newline at end of file
Loading