具有区块链结构的数据库
2020-08-13任晋宏肖攸安黄文禹
任晋宏 肖攸安 黄文禹



摘 要: 区块链是一种链式存储数据结构,它的特点是对于数据修改有固有抵抗力,但在检索方面有着较大的弊端。传统SQL数据库中由于开放数据访问和复杂的网络安全破坏机制所提供的易变环境,数据极易被篡改且无法被直接检测到。本文通过借鉴区块链技术思想,设计10区块链结构数据表为传统关系型数据库赋予区块链的防篡改、防伪特性,在保证数据可信的同时拥有较高的检索速度。
关键词: 区块链;数据库;防篡改;数据可信
中图分类号: TP311 文献标识码: A DOI:10.3969/j.issn.1003-6970.2020.06.013
本文著录格式:任晋宏,肖攸安,黄文禹,等. 具有区块链结构的数据库[J]. 软件,2020,41(06)6367
【Abstract】: Block chain is a kind of chained storage data structure, which has inherent resistance to data modification, but it has great disadvantages in retrieving information. Due to the volatile environment provided by open data access and complex network security failure mechanism in traditional SQL database, data is easily tampered and cannot be directly detected. In this essay, by referring to the block chain technology, the data table with blockchain structure is designed to give the block chain 25tamper-proof and anti-counterfeiting features to the traditional relational database, so as to ensure the data credibility and at the same time have a high retrieval speed.
【Key words】: Blockchain; Database; Tamper proof storage; Reliable data
0 引言
随着Bitcoin、Ethereum、Ripple等加密货币的兴起,其底层的区块链技术不断发展并受到各领域的密切关注[1]。区块链技术规定了区块链的数据定义,以比特币为例,每个区块由区块头和区块体两部分组成,区块体中存放了自前一区块之后发生的多笔交易;区块头中存放了前块哈希(PreBlockHash)、随机数(Nonce)、Merkle根(MerkleRoot)等[2]。区块链是用于数据存储并保证数据可信的链式数据结构。
区块链的特点和它的缺点一样突出,由于其较差的数据格式,它在搜索查询方面不尽如人意。例如,比特币中一个事物的发布、验证和最终的确认可能需要1个小时甚至更久的时间[3]。传统SQL数据库不但有数据结构化的特点,还有快速查询处理的优势,但它不能抵抗数据修改。
为了实现同时具备区块链对数据的固有抵抗力和高效的查询速度,本文借鉴区块链技术设计了区块链结构的数据库,通过对数据库表增设hash、prehash等字段并结合数字签名技术、哈希算法使其符合区块链数据结构。……
