This is an ongoing WIP project.
We need to have a way to navigate through the chain-state to allow the user to:
- R01: switch between environments and chain states
- R02: tag chain states
- R03: explore the partial state history
- R04: adding transactions and blocks to head
- R05: manipulate the history for testing purposes
- R06: commit transactions and blocks
- R07: fork chains
- R08: sync with the current chain state
- R09: publish selected transactions and blocks to another blockchain
- R10: show info about the current state
The underlaying data structure is a DAG which has similarities to git, therefore the terminology could be applied analogous:
- checkout
- branches, tags, head, fork-root
- log, [step?], [inspect?]
- stage, add, rm
- rebase, (maybe new terminology is needed)
- commit
- fork
- pull OR fetch OR sync
- publish OR push
- status
Much like git the data structure is immutable. It has a default HEAD which is pointing to the root hash of the merkle-trie along with the current metadata state. Apart from this there are tags and branches pointing to root hashes along with their metadata. Like in git tags are static, and branches move with HEAD.
- transaction
- marked: A transaction can be marked if the user want it to be included in the future state merge (R09)
- state node: node in the DAG, represents a transaction or a block with metadata as described in [State](#### State)
- operation - last executed operation, such as adding a block or a transaction
- transaction:
- _id: continuous counter which identifies the transaction
- marked: indicates wether the transaction should be included into the next state merge
- transaction:
- root:
- last_block: pointer to the last block
- tx_state: points to the current transaction
- fork_root: points to the block, where the chain got forked of the main chain
- last_fork: points to the block of the last fork
- environment: TODO
TODO: - merge environment data in here
Usage:
- switch branches:
$ dapple checkout test/updateComponentA
- forget about all pending transactions on the current head:
$ dapple checkout head
Usage:
$ dapple branch
livenet #1232
* testDeploy #1235
oldState #742
<NAME> <BLOCK_HEIGHT>
Usage:
$ dapple log
fork root: #101
1. 0x0123..df: 0xdbcb..10 --> 0x31cf..34
...
4. 0x1234..cd: 0xbcba..21 --> 0x1cf3..45
#102 -- SOMETAG
5. 0x2345..bc: 0xcba9..32 --> 0xcf31..56
#103 -- HEAD
6. 0x3456..ab: 0xba98..43 --> 0xf31e..45
$ dapple log --all
fork root: #101 0xa4f..18
1. 0x0123..df: 0xdbcb..10 --> 0x31cf..34 x
...
4. 0x1234..cd: 0xbcba..21 --> 0x1cf3..45 x
#102 -- SOMETAG
5. 0x2345..bc: 0xcba9..32 --> 0xcf31..56
#103 -- HEAD
6. 0x3456..ab: 0xba98..43 --> 0xf31e..45 x
x - mark committed transactions
- add transaction adding transactions is done implicitly via DappleScript or rpc chain interaction
- add block
$ dapple block add
added 1 transaction to block height #104
1. 0x3456..ab: 0xba98..43 --> 0xf31e..45
- removing: Since removing transactions or blocks alters the history R05 should be used for this purpose instead
TODO 04: - maybe some sort of interactive repl for DappleScript is suitable to "experiment" with the state
Changes the history of the chain.
- removing a transaction Removes a transaction and tries to restore the state after applying each relevant transaction from the change to the current head state root Usage:
dapple <rebase> remove 0xba98..43
SUCCESS: consistent state after 12 transactions
- tx manipulation
- change origin
- change data
- change value
- change gas
TODO 05:
- a better name is needed
- do we need something interactive (repl) instead here?
- what are valid manipulations?
Marks transaction as final/ to commit on sync Usage:
dapple commit 2-3 5
fork the current head
$ dapple fork test/updateComponentA
tries to update your current state to the given remote state. Usage:
dapple pull livenet
SUCCESS: cinsistent state after syncing 12032 Blocks
publishes all marked transactions from the fork root to the current HEAD block in sequence to the given chain
dapple publish livenet
...
SIMULATED SUCCESSFUL
...
...
SCCESS: published 14 transactions in 5 Blocks from block 1203322 to 1203345
GAS: 12.332.256 gas
Usage:
$ dapple status
fork root: #101
last block: #103
pending transactions:
1. 0x0123..df: 0xfdbc..10 -.> 0xf31c..34
2. ...
3. <TX_HASH>: <FROM> --> [ <TO> ]
TODO 10: what information do we need here?