Skip to content
Snippets Groups Projects
Commit cf620ef4 authored by Éloïs's avatar Éloïs
Browse files

Add min amount for each transaction output & remove rule BR_G106

parent e7ac3561
No related branches found
No related tags found
No related merge requests found
......@@ -437,7 +437,7 @@ A Transaction structure is considered *valid* if:
* `IN_INDEX` must be an integer value
* `UL_CONDITIONS` must be a valid [Input Condition](#input-condition)
* Field `Outputs` is a multiline field whose lines follow `AMOUNT:BASE:CONDITIONS` format:
* `AMOUNT` must be an integer value
* `AMOUNT` must be an integer value. If `HEAD.version >= 12`, then `AMOUNT` must be greater than or equal to `100`.
* `BASE` must be an integer value
* `CONDITIONS` must be a valid [Output Condition](#output-condition)
* Field `Comment` is a string of maximum 255 characters, exclusively composed of alphanumeric characters, space, `-`, `_`, `:`, `/`, `;`, `*`, `[`, `]`, `(`, `)`, `?`, `!`, `^`, `+`, `=`, `@`, `&`, `~`, `#`, `{`, `}`, `|`, `\`, `<`, `>`, `%`, `.`. Must be present even if empty.
......@@ -461,9 +461,11 @@ It follows a machine-readable BNF grammar composed of
* `(` and `)` characters
* `&&` and `||` operators
* `SIG(PUBLIC_KEY)`, `XHX(SHA256_HASH)`, `CLTV(INTEGER)`, `CSV(INTEGER)` functions
* `SIG(PUBLIC_KEY)`, `XHX(SHA256_HASH)`, `CLTV(INTEGER)`, `CSV(INTEGER)`, `DESTROY()` functions
* ` ` space
**A condition that associates `DESTROY()` with other functions or operators is considered invalid.**
**An empty condition or a condition fully composed of spaces is considered an invalid output condition**.
Also, the maximum length of a condition is 1000 characters. // TODO: OK?
......@@ -475,6 +477,7 @@ Also, the maximum length of a condition is 1000 characters. // TODO: OK?
* `(SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd) && CSV(3600))`
* `(SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd) && (CLTV(1489677041) || CSV(3600)))`
* `(SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd) || (SIG(DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV) && XHX(309BC5E644F797F53E5A2065EAF38A173437F2E6)))`
* `DESTROY()`
#### Condition matching
......@@ -828,6 +831,24 @@ Then the `25` units can be spent *exclusively* in a block whose `MedianTime - Tx
`CSV`'s parameter must be an integer with a length between `1` and `8` chars.
##### DESTROY function
###### Definition
Lock:
DESTROY()
Unlock: no unlocking function.
###### Condition
`DESTROY()` always return false.
###### Description
This fonction lock an output for all eternity. This makes it possible to destroy money.
#### Compact format
A transaction may be described with a more compact format, to be used in a [Block](#block) document. The general format is:
......@@ -1254,6 +1275,7 @@ A block cannot contain revocations whose signature does not match the revocation
* A transaction cannot have `SIG(INDEX)` unlocks with `INDEX >= ` issuers count.
* A transaction **must** have signatures matching its content **for each issuer**
* Transaction's version must be equal to `10`.
* If `HEAD.version >= 12`, then `AMOUNT` of each output must be greater than or equal to `100`.
* Signatures count must be the same as issuers count
* Signatures are ordered by issuer
* Signatures are made over the transaction's content, signatures excepted
......@@ -1419,7 +1441,7 @@ Each transaction input produces 1 new entry:
consumed = true
)
Each transaction output produces 1 new entry:
Each transaction output for which `OUTPUT_CONDITIONS != DESTROY()` produces 1 new entry:
SINDEX (
op = 'CREATE'
......@@ -2724,30 +2746,6 @@ For each `LOCAL_IINDEX[member=true] as IDTY` add a new LOCAL_SINDEX entry:
consumed = false
)
###### BR_G106 - Low accounts
Set:
ACCOUNTS = UNIQ(GLOBAL_SINDEX, 'conditions')
For each `ACCOUNTS as ACCOUNT` then:
Set:
ALL_SOURCES = CONCAT(GLOBAL_SINDEX[conditions=ACCOUNT.conditions], LOCAL_SINDEX[conditions=ACCOUNT.conditions])
SOURCES = REDUCE_BY(ALL_SOURCES, 'identifier', 'pos')[consumed=false]
BALANCE = SUM(MAP(SOURCES => SRC: SRC.amount * POW(10, SRC.base)))
If `BALANCE < 100 * POW(10, HEAD.unitBase)`, then for each `SOURCES AS SRC` add a new LOCAL_SINDEX entry:
SINDEX (
op = 'UPDATE'
identifier = SRC.identifier
pos = SRC.pos
written_on = BLOCKSTAMP
written_time = MedianTime
consumed = true
)
###### BR_G92 - Certification expiry
......
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