计算机科学 ›› 2021, Vol. 48 ›› Issue (11): 54-61.doi: 10.11896/jsjkx.210100220
於志勇, 林力强, 陈艳, 周天, 倪一涛, 陈星
YU Zhi-yong, LIN Li-qiang, CHEN Yan, ZHOU Tian, NI Yi-tao, CHEN Xing
摘要: 区块链技术具有去中心化、不可篡改、可追溯等优势,已经在各领域得到广泛应用。但区块链作为一项前沿技术,存在开发难度大、学习成本高等问题,且大多数开发者更熟悉基于关系型数据库的应用开发方法,即通过SQL操作关系型数据库。Hyperledger Fabric是目前最为主流的区块链开发框架。针对此问题,文中提出了一种面向Hyperledger Fabric的SQL访问框架。首先,针对Fabric和SQL底层存储结构不一致的问题,定义了关系模型至键值模型的转换规则,实现了模型转换算法;然后,基于智能合约技术开发了SQL执行合约,实现了SQL语句向底层状态数据库CouchDB操作语句的自动转换,进而操作Fabric底层的数据;最后,从应用层开发的角度,设计了应用自动化重构工具,工具包含两个部分,分别是应用重构工具和区块链网络的交互中间件Fabric-Driver。实验结果表明,相比现有方案,使用所提框架开发区块链应用能节省82%左右的时间,且使用此框架降低的读写性能仅有5%左右。
中图分类号:
[1]EF Codd:A Relational Model of Data for Large Shared Databa-ses[J].Information Processing,2003,44(10):1090. [2]HELLERSTEIN J M,STONEBRAKER M.Architecture of aDatabase System[J].Foundations & Trends in Databases,2007,1(2):141-259. [3]ANDROULAKI E,BARGER A,BORTNIKOV V,et al.Hy-perledger fabric:a distributed operating system for permissioned blockchains[C]//Proceedings of the Thirteenth EuroSys Conference.2018:1-15. [4]CACHIN C.Architecture of the hyperledger blockchain fabric[C]//Workshop on Distributed Crypto Cxirrencies and Consensus Ledgers.2016. [5]GRIGONK I.SSTable and log structured storage:LevelDB[EB/OL].https://www.igvita.com/2012/02/06/sstable-and-log-structured-storage-leveldb/. [6]LIM H,FAN B,ANDERSEN D G,et al.SILT:A Memory-Efficient,High-Performance Key-Value Store[C]//ACM Sympo-sium on Operating Systems Principles.2011:1-13. [7]RAHIM S R M,MOHAMAD Z Z,BAKAR J A,et al.Artificial Intelligence,Smart Contract and Islamic Finance[J].Asian Social Ence.,2018,14(2):145. [8] PARK K,PENG L.A Design of High-speed Big Data QueryProcessing System for Social Data Analysis:Using Spark SQL[J].International Journal of Applied Engineering Research,2016,11(14 Pt.2):8221-8225. [9]WHITE T.Hadoop:The Definitive Guide[J].O'rlly Media Inc Gravenstn Highway North,2012,215(11):1-4. [10]WANG Q G,HE P,NIE T Z,et al.Data storage and query technology of blockchain system[J].Computer Science,2018,45(12):19-25. [11]YUAN Y,WANG F Y.Development status and prospect of blockchain technology[J].Journal of Automation,2016,42(4):481-494. [12]HE P,YU G,ZHANG Y F,et al.Overview of blockchain technology and application[J].Computer Science,2017,44(4):1-7. [13]Al A E.CouchDB Definitive Guide[J].Andre,2010,215(1):76-80. [14]ANDERSON J C,LEHNARDT J,SLATER N.CouchDB:The Definitive Guide:Time to Relax[M]//CouchDB:The Definitive Guide Time to Relax.O'Reilly Media,Inc.,2010. [15]TSCHORSCH F,SCHEUERMANN B.Bitcoin and Beyond:ATechnical Survey on Decentralized Digital Currencies[J].IEEE Communications Surveys & Tutorials,2016,18(3):2084-2123. [16]BÖHME R,CHRISTIN N,EDELMAN B,et al.Bitcoin:economics,technology,and governance[J].Journal of Economic Perspectives,2015,29(2):213-238. [17]Ethereum White Paper.A next-generation smart contract anddecentralized application platform[EB/OL].https://github.com/ethereum /wiki/wiki/White-Paper,2015. [18]BUTERIN V.A next-generation smart contract and decentra-lized application platform[OL].https://ethereum.org/en/whitepaper/. [19]Tencent FiT,Tencent Research Institute.Whitepaper for ten-cent trustSQL[EB/OL].https://trustsql.qq.com/. [20]MCCONAGHY T,MARQUES R,MULLER A,et al.BigchainDB:A Scalable Blockchain Database[EB/OL].(2016-06-08).https://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf. [21]LI Y,ZHENG K,YAN Y,et al.EtherQL:a query layer forblockchain system[C]//International Conference on Database Systems for Advanced Applications.Cham:Springer,2017:556-567. |
[1] | 王子凯, 朱健, 张伯钧, 胡凯. 区块链与智能合约并行方法研究与实现 Research and Implementation of Parallel Method in Blockchain and Smart Contract 计算机科学, 2022, 49(9): 312-317. https://doi.org/10.11896/jsjkx.210800102 |
[2] | 黄松, 杜金虎, 王兴亚, 孙金磊. 以太坊智能合约模糊测试技术研究综述 Survey of Ethereum Smart Contract Fuzzing Technology Research 计算机科学, 2022, 49(8): 294-305. https://doi.org/10.11896/jsjkx.220500069 |
[3] | 李博, 向海昀, 张宇翔, 廖浩德. 面向食品溯源场景的PBFT优化算法应用研究 Application Research of PBFT Optimization Algorithm for Food Traceability Scenarios 计算机科学, 2022, 49(6A): 723-728. https://doi.org/10.11896/jsjkx.210800018 |
[4] | 周航, 姜河, 赵琰, 解相朋. 适用于各单元共识交易的电力区块链系统优化调度研究 Study on Optimal Scheduling of Power Blockchain System for Consensus Transaction ofEach Unit 计算机科学, 2022, 49(6A): 771-776. https://doi.org/10.11896/jsjkx.210600241 |
[5] | 傅丽玉, 陆歌皓, 吴义明, 罗娅玲. 区块链技术的研究及其发展综述 Overview of Research and Development of Blockchain Technology 计算机科学, 2022, 49(6A): 447-461. https://doi.org/10.11896/jsjkx.210600214 |
[6] | 高健博, 张家硕, 李青山, 陈钟. RegLang:一种面向监管的智能合约编程语言 RegLang:A Smart Contract Programming Language for Regulation 计算机科学, 2022, 49(6A): 462-468. https://doi.org/10.11896/jsjkx.210700016 |
[7] | 卫宏儒, 李思月, 郭涌浩. 基于智能合约的秘密重建协议 Secret Reconstruction Protocol Based on Smart Contract 计算机科学, 2022, 49(6A): 469-473. https://doi.org/10.11896/jsjkx.210700033 |
[8] | 毛典辉, 黄晖煜, 赵爽. 符合监管合规性的自动合成新闻检测方法研究 Study on Automatic Synthetic News Detection Method Complying with Regulatory Compliance 计算机科学, 2022, 49(6A): 523-530. https://doi.org/10.11896/jsjkx.210300083 |
[9] | 王思明, 谭北海, 余荣. 面向6G可信可靠智能的区块链分片与激励机制 Blockchain Sharding and Incentive Mechanism for 6G Dependable Intelligence 计算机科学, 2022, 49(6): 32-38. https://doi.org/10.11896/jsjkx.220400004 |
[10] | 孙浩, 毛瀚宇, 张岩峰, 于戈, 徐石成, 何光宇. 区块链跨链技术发展及应用 Development and Application of Blockchain Cross-chain Technology 计算机科学, 2022, 49(5): 287-295. https://doi.org/10.11896/jsjkx.210800132 |
[11] | 阳真, 黄松, 郑长友. 基于区块链与改进CP-ABE的众测知识产权保护技术研究 Study on Crowdsourced Testing Intellectual Property Protection Technology Based on Blockchain and Improved CP-ABE 计算机科学, 2022, 49(5): 325-332. https://doi.org/10.11896/jsjkx.210900075 |
[12] | 任畅, 赵洪, 蒋华. 一种量子安全拜占庭容错共识机制 Quantum Secured-Byzantine Fault Tolerance Blockchain Consensus Mechanism 计算机科学, 2022, 49(5): 333-340. https://doi.org/10.11896/jsjkx.210400154 |
[13] | 冯了了, 丁滟, 刘坤林, 马科林, 常俊胜. 区块链BFT共识算法研究进展 Research Advance on BFT Consensus Algorithms 计算机科学, 2022, 49(4): 329-339. https://doi.org/10.11896/jsjkx.210700011 |
[14] | 杨昕宇, 彭长根, 杨辉, 丁红发. 基于演化博弈的理性拜占庭容错共识算法 Rational PBFT Consensus Algorithm with Evolutionary Game 计算机科学, 2022, 49(3): 360-370. https://doi.org/10.11896/jsjkx.210900110 |
[15] | 王鑫, 周泽宝, 余芸, 陈禹旭, 任昊文, 蒋一波, 孙凌云. 一种面向电能量数据的联邦学习可靠性激励机制 Reliable Incentive Mechanism for Federated Learning of Electric Metering Data 计算机科学, 2022, 49(3): 31-38. https://doi.org/10.11896/jsjkx.210700195 |
|