《工程科学学报》录用稿,htps://doi.org/10.13374/i,issn2095-9389.2021.11.25.009©北京科技大学2022 一种基于区块链智能合约的软件服务交易方法 王晟典,陈娥),朱岩),林映春),刘国伟2) (1.北京科技大学,计算机与通信工程学院北京100083) (2.北京市经济和信息化局,北京100744) 摘要:随着软件服务交易模式由提前付费向“先服务后结算”转变,软件即服务(SaaS)所依赖的订阅 模式面临着软件服务金融化与法律化的挑战一一既无法按实际使用量进行金融支付,也难以通过法律形式规 范服务提供方、消费方、交易平台之间权利义务关系。据此,本文将智能法律合约($LC)引入到服务计算平 台中,提出一种服务即合约(SaaSC)架构。在法律化方面,SaaS+SaaSC的组合支持SLC软件订阅合约中设 立服务注册、发现、定制化三种条款,从交互动作、服务状态、状态转移流程等方面规范了各方当事人在服务 注册、发现与消费三阶段的交互行为:在金融化方面,将服务接口声明添加到智能法律合约中,借助智能合 约自动执行和检查条款实现了细化到服务接口调用级别的精准计费模式。进一步以以气预报服务作为案例 实现了基于区块链智能合约的在线软件服务获取、交付及合约化支付,验证了 aSC方案的合理性和有 效性,表明软件服务合约化是一种新的可行技术路线。 关键词:区块链智能合约:SaaS:智能法律合约:微服务:服务注册: 发现 中图分类号:TP319 文献标识码:A A Software Service Transaction Approach Based on-Blockchain Smart Contracts Wang Shengdian',Chen E,Zhu Yan!,Lin Yingchun',Liu Guowei2 (1.School of Computer&Communication Engineering.Universityo of Science and Technology Beijing,Beijing 100083,China) (2.Beijing Municipal Bureau of Econony and Information Technology,Beijing 100744,China) Abstract:With software service transactions changing from pay-before-use to pay-as-you-go,the subscription model of Software as a Service (SaaS)is facing the challenges on legalization and financialization of software service. This means that it neither realize financial payment on a pay-as-you-go basis,nor regulate the rights and obligations among service's providers,consumers and platforms in a legal form.To address these challenges,in this paper Smart Legal Contract(SLC)is integrated into service computing platform by introducing a new architecture,called Service as a Smart Contract(SaaSC).Firstly a contract-type service interface scheme is designed to perform the subscription process of service registration and publication on SaaS.In this scheme,we define six types of interactions,four kinds of microservice's states,and their state transition procedure,and then establish the mapping from general service interface following the OpenAPI Specification to the contract terms in the SLC-style SPESC language.Especially,a new term,called Service Registration Term (SRT),is proposed to attain a regularized interaction approach during service registration,In addition,the legal Negotiation-Acceptance mechanism is utilized for granting the consumer's rights to obtain software service.Secondly,a payment mechanism for contracting consumers'demand is proposed in the process of service discovery and consumption.Exactly,based on service matching approach with three-level cache, other new terms,called Service Discovery Term(SDT)and Service Customization Term(SCT),are designed to specify the requests and responses of service discovery and invocation.A billing model driven on SRT,SDT,and SCT is developed to implement fine-grained charging on the level of service interface calls and evidence preservation of service transactions in blockchain.Therefore,it provides a legal guarantee for the implementation of pay-as-you-go mode.To sum up,from the aspect of service legalization,the SaaS+SaaSC architecture supports establishing three kinds ofterms,including service's registration,discovery and customization terms,in SLC-based software subscription contract,so that a complete transaction procedure can be regulated among three above parties from their interactions, service states and their transition process.From the aspect of service financialization,the declaration of service's1 一种基于区块链智能合约的软件服务交易方法 王晟典 1),陈娥 1),朱岩 1),林映春 1),刘国伟 2) (1. 北京科技大学, 计算机与通信工程学院 北京 100083) (2. 北京市经济和信息化局, 北京 100744) 摘 要:随着软件服务交易模式由提前付费向“先服务后结算”转变,软件即服务(SaaS)所依赖的订阅 模式面临着软件服务金融化与法律化的挑战——既无法按实际使用量进行金融支付,也难以通过法律形式规 范服务提供方、消费方、交易平台之间权利义务关系。据此,本文将智能法律合约(SLC)引入到服务计算平 台中,提出一种服务即合约(SaaSC)架构。在法律化方面,SaaS+SaaSC 的组合支持 SLC 软件订阅合约中设 立服务注册、发现、定制化三种条款,从交互动作、服务状态、状态转移流程等方面规范了各方当事人在服务 注册、发现与消费三阶段的交互行为;在金融化方面,将服务接口声明添加到智能法律合约中,借助智能合 约自动执行和检查条款实现了细化到服务接口调用级别的精准计费模式。进一步,以天气预报服务作为案例 实现了基于区块链智能合约的在线软件服务获取、交付及合约化支付,验证了 SaaS+SaaSC 方案的合理性和有 效性,表明软件服务合约化是一种新的可行技术路线。 关键词:区块链智能合约;SaaS;智能法律合约;微服务;服务注册;服务发现 中图分类号: TP319 文献标识码:A A Software Service Transaction Approach Based on Blockchain Smart Contracts Wang Shengdian1 , Chen E1 , Zhu Yan1 , Lin Yingchun1 , Liu Guowei2 (1. School of Computer & Communication Engineering, University of Science and Technology Beijing, Beijing 100083, China) (2. Beijing Municipal Bureau of Economy and Information Technology, Beijing 100744, China) Abstract:With software service transactions changing from pay-before-use to pay-as-you-go, the subscription model of Software as a Service (SaaS) is facing the challenges on legalization and financialization of software service. This means that it neither realize financial payment on a pay-as-you-go basis, nor regulate the rights and obligations among service’s providers, consumers and platforms in a legal form. To address these challenges, in this paper Smart Legal Contract (SLC) is integrated into service computing platform by introducing a new architecture, called Service as a Smart Contract (SaaSC). Firstly, a contract-type service interface scheme is designed to perform the subscription process of service registration and publication on SaaS. In this scheme, we define six types of interactions, four kinds of microservice’s states, and their state transition procedure, and then establish the mapping from general service interface following the OpenAPI Specification to the contract terms in the SLC-style SPESC language. Especially, a new term, called Service Registration Term (SRT), is proposed to attain a regularized interaction approach during service registration. In addition, the legal Negotiation-Acceptance mechanism is utilized for granting the consumer’s rights to obtain software service. Secondly, a payment mechanism for contracting consumers’ demand is proposed in the process of service discovery and consumption. Exactly, based on service matching approach with three-level cache, other new terms, called Service Discovery Term (SDT) and Service Customization Term (SCT), are designed to specify the requests and responses of service discovery and invocation. A billing model driven on SRT, SDT, and SCT is developed to implement fine-grained charging on the level of service interface calls and evidence preservation of service transactions in blockchain. Therefore, it provides a legal guarantee for the implementation of pay-as-you-go mode. To sum up, from the aspect of service legalization, the SaaS+SaaSC architecture supports establishing three kinds of terms, including service’s registration, discovery and customization terms, in SLC-based software subscription contract, so that a complete transaction procedure can be regulated among three above parties from their interactions, service states and their transition process. From the aspect of service financialization, the declaration of service’s 《工程科学学报》录用稿,https://doi.org/10.13374/j.issn2095-9389.2021.11.25.009 ©北京科技大学 2022 录用稿件,非最终出版稿