Blockchain technology has transformed how we think about data integrity, transparency, and decentralization. A common question that arises—especially among developers and enterprise architects—is: Where exactly is blockchain data stored? Is it on the chain, or in a database? To answer this clearly, we need to distinguish between two often-confused terms: blockchain data and on-chain data.
Understanding these concepts not only clarifies technical architecture but also informs decisions around performance, auditability, and system design—especially in enterprise blockchain platforms like FISCO BCOS.
What Is Blockchain Data?
At a high level, blockchain data includes two primary components:
- Block Data: This records every transaction that occurs on the blockchain. For example, “Alice transferred 50 units to Bob” or “Bob deposited 20 units.” These transactions are grouped into blocks and cryptographically linked over time.
- State Data: This reflects the current status of accounts or smart contracts. For instance, Alice’s current balance is 50 units, and Bob’s is 100 units. State data evolves as transactions are executed.
Both types of data are managed and stored by blockchain nodes—software programs running on physical machines, virtual servers, or cloud instances. These nodes form a distributed network, communicating with each other to maintain consensus and data consistency.
👉 Discover how blockchain nodes manage data efficiently across distributed systems.
While nodes handle the logic and communication, they rely on storage engines to persist data. Instead of writing directly to disk, most blockchain platforms use databases to abstract low-level storage operations. Common choices include:
- Embedded databases like LevelDB and RocksDB
- Standalone databases like MySQL
Embedded vs. Standalone Databases
| Type | Examples | Deployment Model | Use Case |
|---|
(Note: No tables allowed per instructions)
Instead:
- Embedded databases (e.g., RocksDB) are tightly integrated into the node process. They start and stop with the node, offering high-speed access with minimal overhead. Ideal for performance-sensitive environments.
- Standalone databases (e.g., MySQL) run as separate services. They can be hosted locally or remotely, support clustering, and allow easier monitoring and SQL-based querying. Better suited for auditing, governance, and integration with existing enterprise systems.
So when someone says, “Blockchain data is stored in a database,” they’re technically correct—nodes use databases (like MySQL or RocksDB) to write blockchain data to disk.
What Does “On-Chain” Mean?
Now let’s clarify on-chain data—a term often used interchangeably with blockchain data, but with a critical distinction.
On-chain data refers specifically to information that is directly or indirectly produced through blockchain consensus. That means:
- Transactions submitted by users
- Blocks created by validators
- State changes resulting from transaction execution
For example:
- Initial state: Alice has 50 units, Bob has 100 units.
- Transaction: Alice sends 50 units to Bob.
- After consensus: The block containing this transaction is validated, and state data updates—Alice now has 0, Bob has 150.
Both the transaction log (block data) and the updated balances (state data) are on-chain, because they result from consensus.
👉 Learn how consensus mechanisms secure on-chain data integrity.
Thus, "on-chain" describes origin and validation, not physical storage location. Whether data resides in RocksDB, MySQL, or another backend doesn’t change its “on-chain” status—as long as it stems from verified consensus.
Where Is FISCO BCOS Data Stored?
FISCO BCOS, an enterprise-grade blockchain platform, defaults to using RocksDB for storing blockchain data on disk. It's embedded, fast, and efficient for typical node operations.
However, for scenarios requiring deeper analysis or compliance reporting, FISCO BCOS supports switching to MySQL as the backend storage engine.
To configure MySQL storage:
- Deploy a MySQL instance.
- Edit the group configuration file:
conf/group.1.ini - Update the
[storage]section:
[storage]
type=mysql
db_ip=127.0.0.1
db_port=3306
db_username=root
db_name=db_Group1_A
db_passwd=******Key parameters:
type: Set tomysqlto enable MySQL storagedb_ip: IP address of the MySQL server (use127.0.0.1for local)db_port: Default is 3306db_username/db_passwd: Login credentialsdb_name: Database name (will be auto-created if missing)
After saving the configuration, restart the node. From then on, all new blockchain data will be written to MySQL.
This flexibility allows organizations to:
- Use RocksDB for high-performance transaction processing
- Switch to MySQL for easier auditing, monitoring, and integration with BI tools
Regardless of backend choice, all data remains on-chain, as it originates from consensus.
Frequently Asked Questions (FAQ)
Q: Can blockchain data be deleted once written?
No. Blockchain data is immutable by design. Once a transaction is confirmed and added to the chain, it cannot be altered or removed. This ensures trust and traceability. However, while raw data persists, privacy-preserving techniques like zero-knowledge proofs or off-chain storage can help manage sensitive information.
Q: If I add a new node to the network, does it automatically sync existing data?
Yes. When a new node joins the network, it automatically synchronizes historical block and state data from existing peers through broadcast and consensus protocols. This ensures consistency across the network without manual intervention.
Q: Does using MySQL slow down the blockchain?
Not necessarily. While MySQL may introduce slightly more latency than embedded databases like RocksDB due to network and connection overhead, it’s optimized for read-heavy analytics and administrative tasks. For most enterprise use cases—especially those involving audits or regulatory reporting—the trade-off is justified.
Q: Is data in MySQL still considered “on-chain”?
Absolutely. The term “on-chain” refers to how data is generated—not where it’s stored. As long as the data results from blockchain consensus (e.g., validated transactions and state changes), it remains on-chain regardless of whether it's in RocksDB, MySQL, or another compliant storage engine.
Q: How do I monitor the size of my blockchain data in MySQL?
You can use standard SQL queries or database management tools to inspect table sizes, growth trends, and schema structure. For example:
SHOW TABLE STATUS FROM db_Group1_A;This helps track storage usage over time—a key metric for capacity planning.
Final Thoughts
The question “Is blockchain data stored on-chain or in a database?” reflects a misunderstanding of abstraction layers in blockchain architecture.
To clarify:
- On-chain refers to data origin—anything produced via consensus
- Database refers to storage medium—where nodes persist that data
FISCO BCOS embraces both perspectives by supporting flexible storage backends without compromising on-chain integrity.
Organizations can choose:
- RocksDB for speed and simplicity
- MySQL for visibility and control
This duality empowers enterprises to align their blockchain infrastructure with operational needs—whether prioritizing performance, compliance, or long-term maintainability.
👉 Explore how modern blockchain platforms balance performance and transparency.
For further reading on FISCO BCOS storage capabilities, refer to the official documentation on distributed storage mechanisms.
Core Keywords: blockchain data, on-chain data, FISCO BCOS, RocksDB, MySQL, consensus mechanism, enterprise blockchain, distributed ledger