info_tfgrid/collections/projectinca/specs_blockchain/ourworld_blockchain.md
2024-08-17 13:22:25 +02:00

6.0 KiB

OurWorld Blockchain

This blockchain has been implemented for the Digital FreeZone Company OurWorld of Zanzibar.

The blockchain has unique properties

  • run by trusted parties who have strong agreement with the OurWorld Digital Freezone
  • it can run very flexible smart contracts
  • the smart contracts can interact with multiple blockchains at once
  • every execution is logged for in a blockchain log system which can not be modified (WORM)
  • the result of actions are records being changed in a normal SQL relational database
  • certain fields of this database can be private
  • the consensus mechanism is very strong
graph TB
    subgraph Validator1
        CE1[Consensus Engine]
        EE1[Execution Engine]
        BE1[Build Engine]
        BL1[Blockchain Logger]
        
        subgraph Storage1
            BD1[(Blockchain DB)]
            ZS1[Zero-Stor]
            ZDB1[(Zero-DB)]
        end
    end
    
    subgraph Validator2
        CE2[Consensus Engine]
        EE2[Execution Engine]
        BE2[Build Engine]
        BL2[Blockchain Logger]
        
        subgraph Storage2
            BD2[(Blockchain DB)]
            ZS2[Zero-Stor]
            ZDB2[(Zero-DB)]
        end
    end
    
    subgraph Validator3
        CE3[Consensus Engine]
        EE3[Execution Engine]
        BE3[Build Engine]
        BL3[Blockchain Logger]
        
        subgraph Storage3
            BD3[(Blockchain DB)]
            ZS3[Zero-Stor]
            ZDB3[(Zero-DB)]
        end
    end
    
    RPC[RPC Requests] --> CE1
    RPC --> CE2
    RPC --> CE3
    
    CE1 <--> CE2
    CE2 <--> CE3
    CE3 <--> CE1
    
    CE1 --> EE1
    CE1 --> BE1
    BE1 --> EE1
    EE1 --> BD1
    EE1 --> BL1
    BL1 --> ZS1
    ZS1 --> ZDB1
    
    CE2 --> EE2
    CE2 --> BE2
    BE2 --> EE2
    EE2 --> BD2
    EE2 --> BL2
    BL2 --> ZS2
    ZS2 --> ZDB2
    
    CE3 --> EE3
    CE3 --> BE3
    BE3 --> EE3
    EE3 --> BD3
    EE3 --> BL3
    BL3 --> ZS3
    ZS3 --> ZDB3

    classDef validator1 fill:#f9f,stroke:#333,stroke-width:2px;
    classDef validator2 fill:#ff9,stroke:#333,stroke-width:2px;
    classDef validator3 fill:#9ff,stroke:#333,stroke-width:2px;
    classDef storage fill:#bbf,stroke:#333,stroke-width:2px;
    
    class Validator1 validator1;
    class Validator2 validator2;
    class Validator3 validator3;
    class Storage1,Storage2,Storage3 storage;

Initial Smart Contracts

Implementation Details

Implemented using consensus engine which has unique properties

  • super flexible execution is possible (flexible contracts as above)
  • each execution is logged and auditable afterwards
  • secure by consensus ring (which is a custom made blockchain based on Tendermint)
  • the data is stored in relational database (postgresql)
  • the consensus ring guarantees correct execution and consensus over the databases
  • each validator has 1 database
  • the validators can talk to multiple blockchains e.g. Stellar, ...

the blockchain has following components

  • Validator
    • is a node which runs all the components as described below
  • Consensus_Engine
    • every RPC (remote procedure call) request goes over the engine
    • the engine make sure all RPC's are executed in order and reach all Validator
  • Blockchain_DB = Blockchain Database
    • a SQL Database
  • Blockchain_Logger = logger whichs records all changes, logs, ... and stores them on the Zero-Stor
  • Zero-Stor = is a key valye stor which stores everything in containers which are encoded, encrypted, compressed and dispersed to multiple Zero-DB's
    • Zero-Stor will check validity of the data and makes sure data can never be corrupted nor lost
    • the Zero-Stor is used in WORM mode which means Write One Time, read Many Times
  • Zero-DB = the storage engine behind which stores the info on the storage device
  • Build_Engine:
    • builds the code (if needed) to run by the Execution_Engine
    • will check the hashes and signatures to make sure the right code is run
  • Execution_Engine
    • there can be more than one and they can even be created in multiple languages
    • they will execute all the logic (the smart contracts)
    • only if all execution engines have the same result the the consensus engine will agree with the RPC request and the transaction is valid.

Consensus Engine

Is a proper proof of stake blockchain

graph TB
    Start((Start)) --> Proposer
    Proposer -->|Create block| ProposeBlock[Propose Block]
    ProposeBlock --> Broadcast[Broadcast to Network]
    Broadcast --> Validators[Validators Receive]
    
    Validators --> ValidCheck{Valid Block?}
    ValidCheck -->|Yes| Prevote[Prevote]
    ValidCheck -->|No| NilPrevote[Nil Prevote]
    
    Prevote --> CollectPrevotes[Collect Prevotes]
    NilPrevote --> CollectPrevotes
    
    CollectPrevotes --> PrevoteCheck{2/3+ Prevotes?}
    PrevoteCheck -->|Yes| Precommit[Precommit]
    PrevoteCheck -->|No| NextRound[Next Round]
    
    Precommit --> CollectPrecommits[Collect Precommits]
    
    CollectPrecommits --> PrecommitCheck{2/3+ Precommits?}
    PrecommitCheck -->|Yes| Commit[Commit Block]
    PrecommitCheck -->|No| NextRound
    
    Commit --> Finalize[Finalize Block]
    Finalize --> End((End))
    
    NextRound --> Start
    
    subgraph Consensus Engine
        Proposer
        ProposeBlock
        Broadcast
        Validators
        ValidCheck
        Prevote
        NilPrevote
        CollectPrevotes
        PrevoteCheck
        Precommit
        CollectPrecommits
        PrecommitCheck
        Commit
        Finalize
    end
    
    classDef process fill:#f9f,stroke:#333,stroke-width:2px;
    classDef decision fill:#ff9,stroke:#333,stroke-width:2px;
    class Proposer,ProposeBlock,Broadcast,Validators,Prevote,NilPrevote,CollectPrevotes,Precommit,CollectPrecommits,Commit,Finalize process;
    class ValidCheck,PrevoteCheck,PrecommitCheck decision;