Play CDN

One of Dijets core features is its Ternary Chain Ledger system comprised of three blockchains. These Blockchains are defined by Dijets Virtual Machines (DVMs)

  1. Common DVM - Interface

    common.DVMis a constant type interface that every DVM must implement.

    common.DVM
    
          type DVM interface {
              // Contains handlers for DVM-to-DVM specific messages
              AppHandler
    
              // Periodically called and reported via the node's Health API.
              health.Checkable
    
              // Represents a handler that is called on connection.
              validators.Connector
    
              Initialize(
                  ctx *logique.Context,
                  dbManager manager.Manager,
                  genesisBytes []byte,
                  upgradeBytes []byte,
                  configBytes []byte,
                  toEngine chan<- Message,
                  fxs []*Fx,
                  appSender AppSender,
              ) error
    
              // Bootstrapping is called when bootstrapping starts.
              Bootstrapping() error
    
              // Bootstrapped is called when bootstrapping finishes.
              Bootstrapped() error
    
              // Shutdown is called when the node is shutting down.
              Shutdown() error
    
              // Version returns the version of the DVM.
              Version() (string, error)
    
              // Each extension can specify how locking is managed for convenience.
              CreateStaticHandlers() (map[string]*HTTPHandler, error)
    
              // Creates the HTTP handlers for custom chain network calls.
              CreateHandlers() (map[string]*HTTPHandler, error)
          
  2. Blockchain DVM - Interface

    In order to be compatible with Logique (Dijets Consensus Engine), a DVM must implement the block.ChainDVM.

    block.ChainVM
    
          type ChainVM interface {
              common.DVM
              Getter
              Parser
    
              // Throw if DVM doesn't want to issue a new block.
              BuildBlock() (logique.Block, error)
    
              // Notify the DVM of the currently preferred block.
              SetPreference(ids.ID) error
    
              // LastAccepted returns the ID of the last accepted block.
              LastAccepted() (ids.ID, error)
          }
    
          // Getter defines the functionality for fetching a block by its ID.
          type Getter interface {
              // Attempt to load a block.
              //
              // Throw if the block does not exist.
              //
              GetBlock(ids.ID) (logique.Block, error)
          }
    
          // Parser defines the functionality for fetching a block by its bytes.
          type Parser interface {
    
              // The block should be represented by the full byte array.
              ParseBlock([]byte) (logique.Block, error)
          }
          
  3. State

    The State interface defines the database layer and connections.

    logique.Block
    
          var (
            singletonStatePrefix = []byte("singleton")
            blockStatePrefix     = []byte("block")
    
            _ State = &state{}
        )
    
        // State is a wrapper around djtx.SingleTonState and BlockState
        type State interface {
            // SingletonState is used to understand if db is initialized.
            djtx.SingletonState
            BlockState
    
            Commit() error
            Close() error
        }
    
        type state struct {
            djtx.SingletonState
            BlockState
    
            baseDB *versiondb.Database
        }
    
        func NewState(db database.Database, vm *VM) State {
            // create a new baseDB
            baseDB := versiondb.New(db)
    
            // create a prefixed "blockDB" from baseDB
            blockDB := prefixdb.New(blockStatePrefix, baseDB)
            // create a prefixed "singletonDB" from baseDB
            singletonDB := prefixdb.New(singletonStatePrefix, baseDB)
    
            // return state with created sub state components
            return &state{
                BlockState:     NewBlockState(blockDB, vm),
                SingletonState: djtx.NewSingletonState(singletonDB),
                baseDB:         baseDB,
            }
        }
    
        // Commit commits pending operations to baseDB
        func (s *state) Commit() error {
            return s.baseDB.Commit()
        }
    
        // Close closes the underlying base database
        func (s *state) Close() error {
            return s.baseDB.Close()
        }
          

What to read next

Explore some of the unique technical and economic concepts behind the Dijets Network & its Ternary Chain Ledgers.

  • Platform

    Infinitely scalable, utility-driven, extremely lightweight decentralised platform for the new web.

  • Ternary Chains

    Dijets is an ecosystem of heterogeneous blockchains namely Value Chain, Utility Chain & Method Chain.

  • Consensus

    Delivers a highly scalable & efficient blockchain network which can adapt to changing network conditions.

  • Network & Nodes

    There are two types of Validators for Dijets Network. A public Validator and a hardware node instance; Cacid.

  • Governance

    Read all about Dijets Governance and learn how to participate in Dijets Improvement Proposals.

  • Products & Services

    Dive into the extensive benefits and the wide ranging utilities of Dijets Products & services.