Overview

SentiChain is a purpose-built blockchain designed for storing and verifying sentiment analysis data. Unlike general-purpose blockchains, SentiChain is optimized for a specific data model: 768-dimensional embedding vectors derived from social media posts using the MPNet encoder.

The blockchain ensures data integrity through cryptographic signatures at multiple levels: individual transaction signatures, embedding vector signatures, and Merkle tree-based consensus roots that summarize all transactions in a block.

Application
API Gateway
Block Explorer
Aparecium
Service
Blockchain
Vectorizer
Mapper
Consensus
Proof of Verification
Validator Selection
Storage
PostgreSQL
Merkle Trees

Proof of Verification

SentiChain uses a Proof of Verification (PoV) consensus mechanism specifically designed for sentiment data integrity. Unlike Proof of Work or traditional Proof of Stake, PoV validators are responsible for verifying the cryptographic validity of sentiment data before including it in blocks.

Validation Process

When a transaction is submitted, validators perform the following checks:

  1. Schema Validation - Verify all required fields are present and correctly formatted
  2. Signature Verification - Validate the RSA signature against the sender's public key
  3. Matrix Signature Check - Verify the embedding vector's signature to ensure authenticity
  4. Deduplication - Check that the embedding matrix hasn't been submitted before
  5. Timestamp Validation - Ensure transaction timestamps are within acceptable bounds

Validator Selection

Validators are selected using a stake-weighted random selection algorithm. Higher-stake validators have proportionally higher chances of being selected to propose the next block, but all validators participate in verification.

# Simplified validator selection
def select_validator(validators, stakes):
    total_stake = sum(stakes.values())
    selection_point = random.uniform(0, total_stake)
    
    cumulative = 0
    for validator in validators:
        cumulative += stakes[validator]
        if cumulative >= selection_point:
            return validator

Merkle Consensus Root

Each block in SentiChain contains a Consensus Root: the root hash of a Merkle tree constructed from all transactions in the block. This enables efficient verification of transaction inclusion without downloading the entire block.

Block Consensus Root Hash(ABC) Hash(AB) Hash(BC) Hash(A) Hash(B) Hash(C) Emb [A] Emb [B] Emb [C]

Verification Benefits

  • Efficient Proofs - O(log n) proof size for transaction inclusion
  • Tamper Detection - Any modification to a transaction invalidates the root
  • Light Clients - Clients can verify data with only the consensus root

Block Structure

Each block in the SentiChain contains a header with metadata and a body with transactions. The block hash is computed from the header fields, creating an immutable chain.

Block Header

Field Type Description
block_number int Sequential block identifier, starting from 0
hash str SHA-256 hash of the block header
previous_hash str Hash of the preceding block
consensus_root str Merkle root of all transactions
timestamp float Unix timestamp of block creation
validator str Address of the block proposer
# Example block response
{
    "block_number": 1542,
    "hash": "a3f8c2d1...",
    "previous_hash": "9b2e4f7a...",
    "consensus_root": "c7d4e9f2...",
    "timestamp": 1703424000.0,
    "validator": "validator_01",
    "transactions": [...]
}

Transaction Model

Transactions in SentiChain store sentiment analysis results, not raw content. Each transaction contains a 768-dimensional embedding vector generated by the MPNet encoder, along with cryptographic signatures to ensure authenticity.

Transaction Fields

Field Type Description
hash str Unique transaction identifier
sender str Validator or submitter address
public_key str PEM-encoded RSA public key
post_timestamp float Original post creation time
post_link str URL reference to source post
post_content str Original post text (API key required)
vector list[float] 768-D MPNet embedding (API key required)
vector_signature str RSA signature of the embedding
signature str Transaction signature
nonce int Replay protection counter
timestamp float Transaction submission time

Validator Staking

The validator network secures SentiChain through stake-based participation. Validators stake tokens to participate in block proposal and earn rewards for honest verification.

Staking Mechanics

  • Minimum Stake - Validators must meet a minimum stake threshold
  • Proportional Selection - Higher stakes increase block proposal probability
  • Slashing - Malicious behavior results in stake reduction
  • Rewards - Validators earn rewards proportional to their stake

Becoming a Validator

To become a validator, you must register with the network, provide a minimum stake, and maintain uptime requirements. Contact us for validator onboarding information.

Storage Layer

SentiChain uses PostgreSQL as its primary storage backend. The database interface is abstracted through a DBInterface class, allowing alternative implementations.

Database Schema

The storage layer maintains the following primary tables:

  • blocks - Block headers and metadata
  • transactions - Transaction data with foreign key to blocks
  • stakes - Validator stake amounts and addresses
  • transaction_pool - Pending unconfirmed transactions

Pluggable Architecture

The DBInterface abstraction allows swapping storage backends. To implement a custom backend, extend the interface class and implement all required methods.