-
摘要: 隨著軟件服務交易模式由提前付費向“先服務后結算”轉變,軟件即服務(SaaS)所依賴的訂閱模式面臨著軟件服務金融化與法律化的挑戰—既無法按實際使用量進行金融支付,也難以通過法律形式規范服務提供方、消費方、交易平臺之間權利義務關系。據此,本文將智能法律合約(SLC)引入到服務計算平臺中,提出一種服務即合約(SaaSC)架構。在法律化方面,SaaS+SaaSC的組合支持SLC軟件訂閱合約中設立服務注冊、發現、定制化三種條款,從交互動作、服務狀態、狀態轉移流程等方面規范了各方當事人在服務注冊、發現與消費三階段的交互行為;在金融化方面,將服務接口聲明添加到智能法律合約中,借助智能合約自動執行和檢查條款實現了細化到服務接口調用級別的精準計費模式。進一步,以天氣預報服務作為案例實現了基于區塊鏈智能合約的在線軟件服務獲取、交付及合約化支付,驗證了SaaS+SaaSC方案的合理性和有效性,表明軟件服務合約化是一種新的可行技術路線。Abstract: With software service transactions shifting from pay-before-use to pay-as-you-go, the Software as a Service (SaaS) subscription model is facing legalization and financialization challenges. This means that it does not accept financial payment on a pay-as-you-go basis, nor does it legally regulate the rights and obligations of service providers, consumers, and platforms. To address these issues, this paper introduces a new architecture called Smart Legal Contract (SLC), which is integrated into a service computing platform (SaaSC). To begin with, a contract-type service interface scheme is intended to handle the subscription process of service registration and publication on SaaS. In this scheme, we define six types of interactions, four kinds of microservice states, and their state transition procedures, and then establish the mapping from the general service interface following the OpenAPI Specification to the contract terms in the SLC-style SPESC language. To achieve a regularized interaction approach during service registration, a new term, called Service Registration Term (SRT), is proposed. Furthermore, the legal Negotiation-Acceptance mechanism is used to grant consumer rights to obtain software services. Second, in the process of service discovery and consumption, a payment mechanism for contracting demand is proposed. Specifically, based on the service matching approach with a 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 by SRT, SDT, and SCT has been developed to implement fine-grained charging on the level of service interface calls and to evidence the preservation of service transactions in the blockchain. As a result, it provides a legal guarantee for the use of pay-as-you-go mode. From the aspect of service legalization, the SaaS+SaaSC architecture supports establishing three kinds of terms, including service registration, discovery, and customization terms, in an SLC-based software subscription contract so that a complete transaction procedure can be regulated among the three above parties based on their interactions, service states, and their transition process. In terms of service financialization, the interface declaration is appended to the SLC-based contract. By automatically executing smart contracts and checking the terms, the pay-as-you-go mode is implemented through fine-grained charging every time when calling the service interface. Furthermore, we take the weather forecast service as an example to implement and analyze the acquisition, delivery, and contractual payment of software services on blockchain smart contracts. The experimental results demonstrate the feasibility and effectiveness of the proposed SaaS+SaaSC architecture, which should be a practicable approach for contracting of software services.
-
Key words:
- blockchain smart contract /
- SaaS /
- smart legal contract /
- microservices /
- service registration /
- service discovery
-
表 1 合約交易存儲結構
Table 1. Structure of the transaction storage in contract
Item Field Description Contract input lastTxid The transaction ID of the last one partySig Signature of current action from the party actionType Type of current action content Name and parameters of current action Contract output txid Current Transaction ID contractData Storing data of the latest contract state partyPubList Public key list from the parties 表 2 參與方動作任務請求列表
Table 2. Request list of parties’ action task
Requested tasks Invoked terms Responsed actions Provider commit
(Register)no1_1, no1_2 Platform Register
(party, service)Customer request
(Discover)no2_1, no2_2 Platform Discover( ) Customer request
(Forecast)no3_1, no3_2 Provider Forecast
(time, location)表 3 智能法律合約編譯實驗
Table 3. Compiling experiment of the Smart Legal Contract
Input Compilation Output Number of bytes Lines of code Number of tokens Average compiling time/ms Number of bytes 994 118 187 570 2754 表 4 接口調用測試表
Table 4. Tests of interface time cost
Term No. Service interface Before executing terms After executing terms Average time/ms Confidential interval/ms Average time/ms Confidential interval/ms 1 Commit/Register 3.80 [0.87, 6.73] 5.35 [0.91, 9.79] 2 Request/Discover 11.40 [10.71,12.09] 13.00 [12.06, 13.94] 3 Request/Forecast 9.60 [7.6, 11.6] 11.20 [9.12, 13.28] www.77susu.com -
參考文獻
[1] Varghese B, Buyya R. Next generation cloud computing: New trends and research directions. Future Gener Comput Syst, 2018, 79: 849 doi: 10.1016/j.future.2017.09.020 [2] Bibi S, Katsaros D, Bozanis P. Business application acquisition: On-premise or SaaS-based solutions? IEEE Softw, 2012, 29(3): 86 [3] Chai Z G. Thoughts on contract law of smart contracts under blockchain. Soc Sci Guangdong, 2019(4): 236 doi: 10.3969/j.issn.1000-114X.2019.04.024柴振國. 區塊鏈下智能合約的合同法思考. 廣東社會科學, 2019(4):236 doi: 10.3969/j.issn.1000-114X.2019.04.024 [4] Li R X. Research on the application and governance of smart contract in financial field. Lanzhou Acad J, 2020(6): 85 doi: 10.3969/j.issn.1005-3492.2020.06.009李瑞雪. 智能合約在金融領域的應用及其治理研究. 蘭州學刊, 2020(6):85 doi: 10.3969/j.issn.1005-3492.2020.06.009 [5] Raskin M. The law and legality of smart contracts. 1 Georgetown Law Technology Review, 2017, 1(2): 305 [6] Wang D, Zhu Y, Chen E, et al. Smart legal contract and its research progress. Chin J Eng, 2022, 44(1): 68 doi: 10.3321/j.issn.1001-053X.2022.1.bjkjdxxb202201007王迪, 朱巖, 陳娥, 等. 智能法律合約及其研究進展. 工程科學學報, 2022, 44(1):68 doi: 10.3321/j.issn.1001-053X.2022.1.bjkjdxxb202201007 [7] Chinese Institute of Electronics, People’s Republic of China. T/CIE 159—2020 Formal Expression of Blockchain Smart Contract. Beijing: Standards Press of China, 2021中國電子學會. T/CIE 159-2020區塊鏈智能合約形式化表達. 北京: 中國標準出版社, 2021 [8] Jamshidi P, Pahl C, Mendon?a N C, et al. Microservices: The journey so far and challenges ahead. IEEE Softw, 2018, 35(3): 24 doi: 10.1109/MS.2018.2141039 [9] Taibi D, Spillner J, Wawruch K. Serverless computing-where are we now, and where are we heading? IEEE Softw, 2021, 38(1): 25 [10] Zhu Y, Wang Q S, Qin B H, et al. Survey of blockchain technology and its advances. Chin J Eng, 2019, 41(11): 1361朱巖, 王巧石, 秦博涵, 等. 區塊鏈技術及其研究進展. 工程科學學報, 2019, 41(11):1361 [11] Qing S H. TTP roles in electronic commerce protocols. J Softw, 2003, 14(11): 1936 doi: 10.13328/j.cnki.jos.2003.11.017卿斯漢. 電子商務協議中的可信第三方角色. 軟件學報, 2003, 14(11):1936 doi: 10.13328/j.cnki.jos.2003.11.017 [12] Das D, Sahoo L, Datta S. A survey on recommendation system. Int J Comput Appl, 2017, 160(7): 6 [13] Clack C D. Smart Contract Templates: Legal semantics and code validation. J Digit Bank, 2018, 2(4): 338 [14] Grigg I. The ricardian contract // Proceedings of First IEEE International Workshop on Electronic Contracting. San Diego, 2004: 25 [15] Hendriksen E S, van Breda M F. Accounting Theory [M/OL]. ACADEMIA (1991) [2021-11-25].https://www.academia.edu/36746420/Accounting_Theory_Eldon_Hendriksen [16] Cao H Y, Falleri J R, Blanc X. Automated generation of REST API specification from plain HTML documentation // International Conference on Service-Oriented Computing. Malaga, 2017: 453 [17] Chen J D. The legal structure of smart contract. Orient Law, 2019(3): 18 doi: 10.3969/j.issn.1007-1466.2019.03.002陳吉棟. 智能合約的法律構造. 東方法學, 2019(3):18 doi: 10.3969/j.issn.1007-1466.2019.03.002 [18] Zhu Y, Qin B H, Chen E, et al. An advanced smart contract conversion and its design and implementation for auction contract. Chin J Comput, 2021, 44(3): 652 doi: 10.11897/SP.J.1016.2021.00652朱巖, 秦博涵, 陳娥, 等. 一種高級智能合約轉化方法及競買合約設計與實現. 計算機學報, 2021, 44(3):652 doi: 10.11897/SP.J.1016.2021.00652 -