Skip to content
Snippets Groups Projects
Commit 5b1e682c authored by nanocryk's avatar nanocryk
Browse files

script system introduction

parent d1c4cd4b
No related branches found
No related tags found
1 merge request!6WIP: RFC 5 : New Scalable Blockchain Protocol
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
...@@ -289,9 +289,8 @@ A **transaction document** describes the consumption of **sources** and the crea ...@@ -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 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**. **sum of *inputs* values must equal the sum of *output* values**.
Each *output* describes spending conditions using a **script**. This *script* is defined as Each *output* describes spending conditions using a **script** system which will be
an **Abstract Syntaxic Tree** of operations which returns a boolean : can this output be used described below.
as an input of a new transaction. This format will be describe further in this document.
| Size | Data | | Size | Data |
|:----:|:-----| |:----:|:-----|
...@@ -305,12 +304,30 @@ as an input of a new transaction. This format will be describe further in this d ...@@ -305,12 +304,30 @@ as an input of a new transaction. This format will be describe further in this d
| | **For each unspent input** : | | | **For each unspent input** : |
| *32 bytes* | Source transaction document hash | | *32 bytes* | Source transaction document hash |
| *1 byte* | Source output index | | *1 byte* | Source output index |
| ... | *Unlock conditions* | | ... | *Unlock parameters (with alignement padding)* |
| | **For each output** : | | | **For each output** : |
| *4 bytes* | Unsigned currency value | | *4 bytes* | Unsigned currency value |
| *1 byte* | Unsigned value power base | | *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 TODO
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment