# Blockchain Layer & Smart Contracts

The blockchain infrastructure underpinning BitStock is engineered to encode asset integrity, transactional determinism, and compliance-enforced control into verifiable, on-chain logic. Deployed on the BNB Chain for its EVM compatibility and predictable gas execution, the smart contract architecture forms the deterministic trust layer for all protocol-level interactions.

Each smart contract module is designed around minimal state exposure and strict access control, structured to model the complete lifecycle of equity-linked digital assets. The system avoids composability with external DeFi protocols to reduce attack surfaces and preserves deterministic behavior by minimizing external call dependencies.

At the data structure level, equity ownership is modeled through soulbound NFT contracts, using tightly scoped metadata mappings (e.g., <mark style="color:green;">tokenId → {ticker, shares, executionHash, custodianRef}</mark>) indexed via event-driven logs to enable verifiable reconstruction of ownership state. These NFTs are designed to be non-transferable at the opcode level, with transfer-related function selectors overridden or access-gated at the contract layer.

Redemption events are initiated via authenticated wallet interactions, triggering the execution of a <mark style="color:green;">burnAndSignal</mark> opcode that emits a broker-facing off-chain event. This event payload includes hashed identity references, tokenId-specific stock data, and time-locked settlement intent proofs. Internally, the contract flags the tokenId as inactive and archives the event to a Merkle-backed ledger for dispute validation if required.

Dividend claim mechanics are implemented through snapshot-based mappings (<mark style="color:green;">snapshotBlock → tokenId → eligibleUSDC</mark>) rather than continuous streaming, which reduces storage reads and optimizes batch distribution gas cost. An internal oracle registry provides off-chain reference points for dividend valuation verification, while distribution is executed using non-custodial push logic—preserving recipient wallet state during payout.

Security architecture follows a modular auditing strategy, with each logic component isolated in function-specific contracts and guarded by:

* <mark style="color:green;">onlyProtocol</mark> execution roles
* stateless reentrancy guards
* externally audited overflow-resistant arithmetic
* per-function gas capping where applicable

All contract logic is accompanied by ABI-level documentation and formal verification coverage for key economic state flows. Future upgradability is intentionally limited, with immutable proxy patterns used only in upgradeable governance or oracle interface modules.

Through this on-chain framework, BitStock establishes not just proof of ownership, but an enforceable computational guarantee of how regulated assets are acquired, held, and monetized within a decentralized environment—without introducing trust assumptions beyond code execution itself.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stockxtoken.xyz/protocol-architecture-and-system-design/blockchain-layer-and-smart-contracts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
