留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

链上、链下协同的智能合约即服务问题

刘浩宇 马泽祁 叶亚飞 胡凯

刘浩宇,马泽祁,叶亚飞,等. 链上、链下协同的智能合约即服务问题[J]. 北京航空航天大学学报,2024,50(10):3262-3273 doi: 10.13700/j.bh.1001-5965.2022.0784
引用本文: 刘浩宇,马泽祁,叶亚飞,等. 链上、链下协同的智能合约即服务问题[J]. 北京航空航天大学学报,2024,50(10):3262-3273 doi: 10.13700/j.bh.1001-5965.2022.0784
LIU H Y,MA Z Q,YE Y F,et al. Smart contracts-as-a-service with on-chain and off-chain collaboration[J]. Journal of Beijing University of Aeronautics and Astronautics,2024,50(10):3262-3273 (in Chinese) doi: 10.13700/j.bh.1001-5965.2022.0784
Citation: LIU H Y,MA Z Q,YE Y F,et al. Smart contracts-as-a-service with on-chain and off-chain collaboration[J]. Journal of Beijing University of Aeronautics and Astronautics,2024,50(10):3262-3273 (in Chinese) doi: 10.13700/j.bh.1001-5965.2022.0784

链上、链下协同的智能合约即服务问题

doi: 10.13700/j.bh.1001-5965.2022.0784
基金项目: 云南省重大科技专项(202103AN080001-001,202002AA100007,202002AD080003);软件开发国家重点实验室开放基金(SKLSDE-2022ZX-11)
详细信息
    通讯作者:

    E-mail:yeyf@bhynii.com

  • 中图分类号: O213.2;V37;TP302.1

Smart contracts-as-a-service with on-chain and off-chain collaboration

Funds: Major Science and Technology Project of Yunnan Province (202103AN080001-001,202002AA100007,202002AD080003); Open fund of State Key Laboratory of software development (SKLSDE-2022ZX-11)
More Information
  • 摘要:

    智能合约是区块链上的一种软件服务,具有价值传导、契约性和可信性等特点,当前各区块链系统上的智能合约数量越来越多,应用范围越来越广泛,传统智能合约的局限性也日益增大。隔离沙箱环境执行使智能合约与外界交互困难、资源受限、从而限制了智能合约的使用场景和性能。同时,传统的云服务等链下服务存在中心化风险,缺乏信任机制保障。提出智能合约即服务方案,提供链上合约与链下服务协同的方法,通过链下服务的链上认证,将服务生命周期纳入区块链管理,使之具有合约服务的可信化特点,以支持服务的注册、定制和组合;提出基于交易触发与事件驱动的通信与协同方法,在面对复杂业务场景或高资源需求任务时智能合约可与扩展服务组合构建工作流。经实验验证表明,智能合约即服务可以极大地拓展合约应用场景,通过将合约内执行的高资源耗费任务卸载到计算型扩展服务可提供更高的性能,性能优势与链下加速比正相关,如在执行1 200维矩阵乘法运算的任务时,性能可提升64%。

     

  • 图 1  区块链即服务平台BaaS的总体架构

    Figure 1.  Architecture of Platform BaaS

    图 2  SCaaS架构

    Figure 2.  SCaaS Architecture Diagram

    图 3  SCaaS数字身份模型

    Figure 3.  Digital identity model of SCaaS

    图 4  扩展服务管理合约基本架构

    Figure 4.  Basic structure of extended service management contract

    图 5  日志存证及查询机制

    Figure 5.  Log storage and query mechanism

    图 6  SCaaS的4种通信场景

    Figure 6.  Four communication scenarios of scaas

    图 7  链上调用链下通信架构

    Figure 7.  On chain call off chain communication architecture

    图 8  SCaaS中的智能合约与人工智能扩展服务协同任务场景示例

    Figure 8.  Examples of collaborative task scenarios between smart contracts and AI-extended services in SCaaS

    图 9  腾讯云机器翻译业务场景的SCaaS调用日志

    Figure 9.  SCaaS call logs for Tencent Cloud Machine translation business scenarios

    图 10  高维矩阵计算任务2种执行方式下执行时间比较

    Figure 10.  Comparison of execution time of high-dimensional matrix computing under two execution modes

    图 11  4 s、10 s的q任务链上智能合约执行和在SCaaS中的执行时间

    Figure 11.  Execution time of 4 s and 10 s task q in on-chain smart contract and within the SCaaS

    表  1  链下扩展服务的数字身份字段

    Table  1.   Digital identity fields for off-chain scaling services

    字段名 作用
    服务名称name
    统一资源定位符URL 唯一指定服务
    方法参数params 形参列表
    服务提供商provider
    服务注册时间regi_time
    描述元信息meta_info 其他服务信息
    codeBytes 服务状态快照
    下载: 导出CSV

    表  2  自定义消息格式表

    Table  2.   Message format table

    字段名 长度/字节 描述
    Header 4 对消息体类型的标识
    Body Not-fixed 承载交易执行状态
    下载: 导出CSV

    表  3  扩展服务执行结果

    Table  3.   Extended service implementation results

    应用场景 图像识别 机器翻译
    阿里云 猫(置信度:70%) warmly celebrate the 70th anniversary of the founding of the school
    华为云 这是一只猫 celebrating the 70th anniversary of the School
    腾讯云 猫为56% ,美国短毛猫为25%,英国短毛猫为15% warmly celebrate the 70th anniversary of the founding of the school
    下载: 导出CSV

    表  4  与业界其他相关工作成果的对比

    Table  4.   Comparison of characteristics with related work

    解决方案 蚂蚁链 BaaS Oracle BaaS ChainLink Mictract SCaaS
    适配链 Antchain和FabricBCOS Fabric Ethereum Fabric 北航链
    即时通信
    合约扩展性
    链下协同
    协同方式 预言机共识网络 扩展服务认证管理
    响应速度
    下载: 导出CSV
  • [1] VACCA A, DI SORBO A, VISAGGIO C A, et al. A systematic literature review of blockchain and smart contract development: techniques, tools, and open challenges[J]. Journal of Systems and Software, 2021, 174: 110891. doi: 10.1016/j.jss.2020.110891
    [2] MOHANTA B K, PANDA S S, JENA D. An overview of smart contract and use cases in blockchain technology[C]// 2018 9th International Conference on Computing, Communication and Networking Technologies (ICCCNT). Piscataway: IEEE Press, 2018: 1-4.
    [3] 袁勇, 王飞跃. 区块链技术发展现状与展望[J]. 自动化学报, 2016, 42(4): 481-494.

    YUAN Y, WANG F Y. Blockchain: the state of the art and future trends[J]. Acta Automatica Sinica, 2016, 42(4): 481-494 (in Chinese).
    [4] 王鹏, 魏必, 王聪. 区块链技术在政务数据共享中的应用[J]. 大数据, 2020, 6(4): 105-114. doi: 10.11959/j.issn.2096-0271.2020037

    WANG P, WEI B, WANG C. Application of blockchain technology in government data sharing[J]. Big Data Research, 2020, 6(4): 105-114 (in Chinese). doi: 10.11959/j.issn.2096-0271.2020037
    [5] 周立群, 李智华. 区块链在供应链金融的应用[J]. 信息系统工程, 2016(7): 49-51. doi: 10.3969/j.issn.1001-2362.2016.07.033

    ZHOU L Q, LI Z H. Application of blockchain in supply chain finance[J]. China CIO News, 2016(7): 49-51 (in Chinese). doi: 10.3969/j.issn.1001-2362.2016.07.033
    [6] ZOU W Q, LO D, KOCHHAR P S, et al. Smart contract development: challenges and opportunities[J]. IEEE Transactions on Software Engineering, 2021, 47(10): 2084-2106. doi: 10.1109/TSE.2019.2942301
    [7] BUTERIN V. A next generation smart contract & decentralized application platform[EB/OL]. ( 2022-07-29)[ 2022-09-05]. https://ethereum.org/zh/whitepaper/.
    [8] GANESHBABU S N, SRIRAM S, RANGARAJU K G. Smart cyber physical systems: advances, challenges and opportunities[M]. Abingdon: Taylor & Francis, 2020: 255-268.
    [9] Spring Cloud. Service registration and discovery[EB/OL]. (2022-05-10)[2022-09-05]. https://spring.io/guides/gs/service-registration-and-discovery.
    [10] Nacos. An easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications[EB/OL]. (2022-06-12)[2022-09-14]. https://nacos.io/en/docs/v1/what-is-nacos/.
    [11] HARN L, REN J. Generalized digital certificate for user authentication and key establishment for secure communications[J]. IEEE Transactions on Wireless Communications, 2011, 10(7): 2372-2379. doi: 10.1109/TWC.2011.042211.101913
    [12] PARK J S, YOUN T Y, KIM H B, et al. Smart contract-based review system for an IoT data marketplace[J]. Sensors, 2018, 18(10): 3577. doi: 10.3390/s18103577
    [13] ABDELMABOUD A , AHMED A I A , ABAKER M, et al. Blockchain for IoT applications: taxonomy, platforms, recent advances, challenges and future research directions[J]. Electronics, 2022, 11(4): 11040630.
    [14] ZHENG Z B, XIE S A, DAI H N, et al. An overview on smart contracts: challenges, advances and platforms[J]. Future Generation Computer Systems, 2020, 105(C): 475-491.
    [15] SUNYAEV A, SUNYAEV A. Internet computing: principles of distributed systems and emerging internet-based technologies [M]. Switzerland: Springer Cham, 2020: 195-236.
    [16] ZHENG W L, ZHENG Z B, CHEN X P, et al. NutBaaS: a blockchain-as-a-service platform[J]. IEEE Access, 2019, 7: 134422-134433. doi: 10.1109/ACCESS.2019.2941905
    [17] 魏凯, 卿苏德, 杨白雪, 等. 区块链即服务平台BaaS白皮书[R]. 北京: 中国信息通信研究院, 2019.

    WEI K, QING S D, YANG B X, et al. Blockchain as a service platform baas white paper [R]. Beijing: China Institute of Information and Communications, 2019(in Chinese).
    [18] 张富利, 侯培宇, 李杉杉, 等. 一种智能合约微服务化框架[J]. 软件学报, 2021, 32(11): 3423-3439.

    ZHANG F L, HOU P Y, LI S S, et al. Framework for architecting smart contracts using microservices[J]. Journal of Software, 2021, 32(11): 3423-3439 (in Chinese).
    [19] TONELLI R, PINNA A, BARALLA G, et al. Ethereum smart contracts as blockchain-oriented microservices[C]// Proceedings of the 19th International Conference on Agile Software Development: Companion. New York: ACM, 2018: 1-2.
    [20] HU K, WAN J, LUO K, et al. Verification algebra for multi-tenant applications in VaaS architecture[J]. Software Testing, Verification and Reliability, 2021, 31(6): e1763. doi: 10.1002/stvr.1763
    [21] 王子凯, 朱健, 张伯钧, 等. 区块链与智能合约并行方法研究与实现[J]. 计算机科学, 2022, 49(9): 318-323. doi: 10.11896/jsjkx.220300190

    WANG Z K, ZHU J, ZHANG B J, et al. Research and implementation of blockchain and smart contract parallel methods[J]. Computer Science, 2022, 49(9): 318-323(in Chinese). doi: 10.11896/jsjkx.220300190
    [22] MIR U B, KAR A K, DWIVEDI Y K, et al. Realizing digital identity in government: Prioritizing design and implementation objectives for Aadhaar in India[J]. Government Information Quarterly, 2020, 37(2): 101442. doi: 10.1016/j.giq.2019.101442
    [23] SALAH K, REHMAN M H U, NIZAMUDDIN N, et al. Blockchain for AI: review and open research challenges[J]. IEEE Access, 2019, 7: 10127-10149. doi: 10.1109/ACCESS.2018.2890507
  • 加载中
图(11) / 表(4)
计量
  • 文章访问数:  308
  • HTML全文浏览量:  129
  • PDF下载量:  6
  • 被引次数: 0
出版历程
  • 收稿日期:  2022-09-15
  • 录用日期:  2022-11-25
  • 网络出版日期:  2023-01-17
  • 整期出版日期:  2024-10-31

目录

    /

    返回文章
    返回
    常见问答