TingChain
  • Overview of Tingchain
  • Backer & Investor
  • Executive Summary
  • Introduction
  • Ting Chain Ecosystem
    • Technical Foundation
    • Product Offerings
    • Utilization of Polygon Technology with TON Products
    • Developers
      • Tokenomics
        • Glossary
        • Tokenomics
      • Testnet
      • Get started
        • Installation
        • Local Setup
        • Cloud Setup
        • CLI Command
      • Additional Features
        • Explorer
        • Network stress testing
      • Architecture
        • Architecture Overview
        • Modules
          • Blockchain
          • Consensus
          • Jason RPC
          • Minimal
          • Networking
          • Other modules
          • Protocol
          • Sealer
          • State
          • Storage
          • TxPool
          • Types
      • Community
        • Propose a new feature
        • Report an issue
      • Concepts
        • State in Ethereum
      • Configuration
        • Manage private keys
        • Server configuration file
      • Consensus
        • Proof of Stake
        • Set up and use Proof of Stake (PoS)
      • Working with node
        • Backup/restore node instance
        • Query JSON RPC endpoints
        • Query operator information
      • Development Roadmap
  • Target Audience
  • 🗺️Roadmap
  • Ambassador Program
  • List Project Testnet
  • Social Channel
  • Conclusion
Powered by GitBook
On this page
  • Overview
  • Run Method
  1. Ting Chain Ecosystem
  2. Developers
  3. Architecture
  4. Modules

Sealer

Overview

The Sealer is an entity that gathers the transactions, and creates a new block. Then, that block is sent to the Consensus module to seal it.

The final sealing logic is located within the Consensus module.

Run Method

func (s *Sealer) run(ctx context.Context) {
	sub := s.blockchain.SubscribeEvents()
	eventCh := sub.GetEventCh()

	for {
		if s.config.DevMode {
			// In dev-mode we wait for new transactions to seal blocks
			select {
			case <-s.wakeCh:
			case <-ctx.Done():
				return
			}
		}

		// start sealing
		subCtx, cancel := context.WithCancel(ctx)
		done := s.sealAsync(subCtx)

		// wait for the sealing to be done
		select {
		case <-done:
			// the sealing process has finished
		case <-ctx.Done():
			// the sealing routine has been canceled
		case <-eventCh:
			// there is a new head, reset sealer
		}

		// cancel the sealing process context
		cancel()

		if ctx.Err() != nil {
			return
		}
	}
}

:::caution Work in progress The Sealer and the Consensus modules will be combined into a single entity in the near future.

The new module will incorporate modular logic for different kinds of consensus mechanisms, which require different sealing implementations:

  • PoS (Proof of Stake)

  • PoA (Proof of Authority)

Currently, the Sealer and the Consensus modules work with PoW (Proof of Work). :::

PreviousProtocolNextState

Last updated 8 months ago