Transformation of Real-World Contracts to Smart Contracts for Blockchain Applications
Abstract
1. Introduction
- Ambiguity and Interpretation: Contracts, written in natural language, are inherently open to interpretation. Different parties and developers may have varying understandings of the contract’s meaning, making it difficult to translate these nuances into the precise and unambiguous language of smart contracts.
- Limited Expressive Power: Current smart contract languages might lack the sophistication to fully capture the complexities of collaborative terms within contracts [6]. These terms often involve ongoing interactions and shared decision-making, which can be challenging to represent directly in code.
- Accessibility for Non-Programmers: Smart contracts are written in code, which can be a barrier for participants who lack programming knowledge. This creates difficulties for those who need to interact with the decentralized applications (dApps) built on these contracts.
- (1)
- Automated Conversion Tool: Develop automated tools to analyze the syntax and logic of real-world contracts and transform them into smart contract codes. This method requires a deep understanding of the syntax and semantics of different languages and the design of corresponding transformation rules.
- (2)
- Manual conversion: Professional personnel manually transform the logic and conditions of real-world contracts into smart contract codes. This requires professional knowledge and skills that consume much time and effort.
- (3)
- Intermediate representation language: Using intermediate representation language as a bridge to transform real-world contracts written in different languages into smart contracts. Intermediate representation languages can provide a unified syntax and logical structure, making transformations simpler and standardized.
- (4)
- Deep learning technology: Utilizing deep learning technology to train models to learn transformation rules between different languages. This requires large data and computing resources and may have certain accuracy and applicability limitations.
- (1)
- Identify obstructive clauses: We must pinpoint specific clauses in real-world contracts that hinder a smooth translation to smart contracts.
- (2)
- Multilingual transformation method: A method that facilitates the conversion of real-world contracts across different natural languages into smart contracts needs to be developed.
- (3)
- Automated generation: Ultimately, the goal is to enable automated processes to generate smart contracts directly from real-world contracts.
- Language-Agnostic Contract Abstraction via CTML: We use a human-readable language called CTML to automatically abstract and express the details of real-world contracts in marked-up contracts, overcoming the language dependence of traditional modeling methods.
- Automated Smart Contract Generation Pipeline: The CTML compiler can automatically compile executable code for generating smart contracts. This two-stage approach reduces manual intervention and automatically generates smart contracts from real-world contracts in various fields written in any universal natural language.
- Cross-Language Verification and Consistency: To validate our approach, we provide a detailed explanation using representative legal factoring contracts as an example. Through comparative analysis, we demonstrate the feasibility and consistency of this approach in transforming real-world contracts written in different natural languages (such as English and Chinese) into executable smart contracts.
2. Current State of the Art
2.1. Formal Methods
2.2. Template-Based Approaches
2.3. NLP/LLM-Based Approaches
2.4. Comparison with Our Works
3. Our Overall Approach
- Extracting contract structure, key elements (e.g., involved parties, subject matter, price, time, place of performance, liabilities, dispute resolution methods), and their attributes, forming a foundation for contract processing and application.
- Ensuring consistency between the original contract and the resulting smart contract while automatically transforming the text using the contract template’s regular grammar and vocabulary, enhancing efficiency and accuracy in smart contract development.
3.1. Establishment Principles
- (1)
- Use marks or tags to extract complete meaning and establish the mapping relationship between contracts and DSL-driven smart contracts.
- (2)
- Standardize DSL-driven smart contract programming using CTML transition rules to enhance the efficiency of transforming contract text to executable code.
- (3)
- Create a systematic framework to support “templates” that can be customized using CTML variables.
- (1)
- It supports the man-machine interface based on an offer-acceptance system at the contract level, providing a clear binding framework for the formation of contracts;
- (2)
- It supports automated data exchange at the user level, enabling user customization to suit the specific needs of the parties involved;
- (3)
- It achieves separation of code (representing contract semantics) and data (contract instances) at the technical level, ensuring that the code can be developed and deployed in advance and has broader application.
- Exact expression of contracts’ meaning: By adding contract element symbols and attributes from contract text, contract elements, and content interpretation can be accurately and unambiguously determined.
- Computerized understanding of contracts: By defining semantic transition and data processing methods on extracted contract elements, marked contracts can be transformed into DSL-driven contracts and finally into smart contracts.
3.2. System Framework
- (1)
- Stage 1. Definition of grammar rules: Perform the grammar analysis on the natural language used to write real-world contracts, and the process includes:
- Define Grammar Rules: Identify the natural language of real-world contracts and define relevant grammar rules in CTML.
- Add Encoding Extensions: Add encoding extensions for a specific language to existing rules.
- Extract Contract Contents: Understand and extract the corresponding contract contents based on the definitions of different languages and output grammar rules.
- (2)
- Stage 2. Markup of Real-world Contract: The process includes: Transforming CTML contracts involves annotating the contracts for automated processing and understanding the contract regarding the grammar rules.
- (3)
- Stage 3. Extract Metadata Markup: Metadata Markup from these CTML contracts is extracted into EMD, which provides structured and specific contract information.
- (4)
- Stage 4. Code Generation: Complete the mapping from CTML to smart legal contract language through model transformation. The process includes the following:
- Translation: Translating CTML contracts generated in Stage 2 to DSL using lexical mapping and transformation rules to generate DSL programs.
- Compilation: Compiling the DSL program and linking the program with EMD generated in Stage 3 to generate the smart contract executable code and build a human-machine interface of metadata.
4. Abstraction of Real-World Contracts
- (1)
- Document type description: This declares the document type (DOCTYPE) using a short token string and is only used for schema selection.
- (2)
- Document header: Contains essential information for CTML documents, such as text language.
- (3)
- Document Body: The main content is marked with CTML tags based on the original contract. It’s divided into two parts:
- Semantic Expression: Indicates elements and meanings in contracts, providing a basis for smart contracts through semantic markup.
- Metadata Expression: Marks contract templates or incomplete contracts to identify and locate the parts to be filled automatically.
4.1. CTML Semantic Markup
- (1)
- Law Factor Mark (LFM): A first-level function that identifies and represents legal factor elements.
- (2)
- Law Property Mark (LPM): A secondary function that extracts legal properties under the legal factor.
- (3)
- Law Component Mark (LCM): A third-level function that identifies and represents law components in a nested manner.
- (1)
- In the syntax tree, the domain is a child node of . If requires an element from a property identified by nesting rules, the cross-reference can only retrieve the relevant instances on the branch by default. This means that only and rather than or can be retrieved to satisfy the required syntax rules of CTML implementation. The non-nested forms of legal properties are referred to as and .
- (2)
- includes . If the domain is included in , the cross-reference of should not retrieve because it does not have a containing relationship with .
- (1)
- Obtain the referenced Factor instance;
- (2)
- Iterate through the CTML’s AST to extract the legal attributes that point to the Factor entity, including attributes of nested forms within element entities and non-nested forms pointing to element instances with unique identifier names;
- (3)
- Return the attribute set that meets the specified condition.
| Algorithm 1 getScope |
| Input: field, context, reference Output: A list of Property 1: function getScope() 2: 3: if is null or is null then 4: return 5: else 6: 7: for do 8: if is not null then 9: if then 10: 11: end if 12: end if 13: end for 14: return 15: end if 16: end function |
4.2. CTML Metadata Markup
- (1)
- Select the texts of interaction data and specify the data types in the entire contract.
- (2)
- Obtain the interactive data identifier of Metadata containing the element identifier factorID for use or revision in the follow-up operations.
- (3)
- Configure the options of the Metadata’s interactive operations for the human-machine interface based on the data type, where the option includes singleOption, multiOption, external import, trigger, and allocate to normalize the operation behavior.
- (4)
- Content is stored based on the specified data identifier, data type, and option of interactive operations into the user-specified location or replacing the selected text with the Metadata.
5. Code Generation
- (1)
- Pre-processing: Extracting domain marks and non-nested properties from the AST and restructuring the AST to avoid repeated content and omitted subjects.
- (2)
- Recursion: Filtering out information on the specific Element entities based on the AST.
- (3)
- Generating factors: Creating all factor entities in the SPESC contract based on AST’s mapping relationship.
- (4)
- Generating property, component, or field: Making a pass through all factors to generate properties, components, or fields based on the mapping relationship in every iteration.
| Algorithm 2 fieldProcess |
| Input: contract, EcoreUtil2 Output: A list of field 1: function fieldProcess() 2: 3: 4: for do 5: if is null then 6: if is null then 7: 8: end if 9: end if 10: end for 11: return 12: 13: end function |
- Generate the corresponding factor entities/objects according to the mapping relationships.
- Iterate through the information contained in the entities and generate the corresponding properties, components, or field entities in the SPESC contract.
6. An Illustrative Example
6.1. An Example Contract Written in English
- (1)
- Stage 1: Analyze the grammar in English in the factoring contract.
- Identify the natural language for writing contracts as English and define grammar rules related to the text in CTML.
- Add encoding extensions for English to existing rules.
- Based on the above text definition, extract the corresponding contract contents and define “” in the document type description (Table 3).
- (2)
- Stage 2: Following CTML grammar rules and annotation methods, the factoring contract is transformed into a CTML contract. Figure 3b shows the marked-up CTML contract. Semantic extraction annotates a basic factoring contract divided into six modules: contract title, parties, additional information, assets, terms, and contract conclusion.
- (3)
- Stage 3: The key-pair values for EMD from the CTML contract are extracted. That is, the hierarchical markup method is applied to mark the semantic elements of the contract, and metadata markup is used to generate an EMD for data interaction.
- (4)
- Stage 4: Automatically transform a real-world contract annotated by CTML into a smart legal contract through a Generator.
- To generate the smart legal contract using CTML, the SPESC code for the CTML contract can be automatically generated using the Generator, resulting in a smart legal contract.
- After SLC is generated using CTML, the code can be linked with the EMD, compiled to generate a smart contract executable code, and sent to the Smart Contract Library for contract deployment.
6.2. An Example Contract Written in Chinese
- (1)
- Stage 1: Analyze Chinese grammar written in the factoring contract.
- Identify the natural language for writing contracts as Chinese and define grammar rules related to the text in CTML.
- Add encoding extensions for Chinese to existing rules.
- Extract the corresponding contract contents and define “” in the document type description (See Table 3).
- (2)
- Stage 2: According to CTML syntax rules and annotation methods, a module analysis is conducted on the contract text for semantic extraction, including six modules: contract title, parties, additional information, assets, terms, and contract formation. The annotation of the factoring contract in Chinese (shown in Figure 4a) is represented in Figure 4b.
- (3)
- Stage 3: The hierarchical annotation method annotates the semantic part of the example layer by layer. The EMD containing the key-pair values is generated by marking the data negotiated in the contract with metadata.
- (4)
- Stage 4: CTML contract automatically generates executable code after being mapped by a code generator.
- The SPESC code for the CTML contract is automatically generated by the code generator.
- Link and compile the code with EMD to generate a smart contract executable code and send it to the Smart Contract Library for contract deployment.
6.3. Comparative Analysis
- In the contract abstraction, the approach does not perform a black-box, fully automated translation. Instead, users with legal backgrounds explicitly anchor core clauses (such as payment conditions and default triggers) using CTML. This “human-in-the-loop” model ensures the accurate extraction of key legal intent from natural language.
- In the code generation, CTML employs a deterministic grammar mapping based on Xtext to transform the marked legal logic 1:1 into DSL, thus technically avoiding semantic drift caused by probabilistic models. Developers conduct pre-deployment audits of the generated code. Although the legal enforceability of smart contracts ultimately depends on the interpretation of a specific jurisdiction, CTML provides a robust structural guarantee for the semantic equivalence between legal text and executable code by generating logically consistent code.
7. Advantages and Limitations
7.1. Advantages of Our Approach
- Manual processing stage: Traditionally, legal contracts were painstakingly converted by hand into executable programs. This approach lacked verification tools, making it difficult to ensure the program accurately reflected the original contract’s meaning.
- Smart contract stage: The introduction of smart contracts marked a turning point, enabling automated contract execution. However, challenges such as poor readability, slow development, and inefficient conversion between legal and smart contracts limited their wider adoption in legal settings.
- Smart legal contract stage: Smart legal contracts, with their improved readability, addressed the learning curve associated with traditional smart contracts and bridged the gap between legal and programmatic language. However, the disconnect between smart legal contracts and their natural language counterparts hindered further development.
- Legal code stage (or code-legalization stage): This stage introduces CTML. Here’s how it works:
- –
- Legal contracts in natural language are tagged with CTML, essentially adding structure and instructions.
- –
- These CTML contracts are then transformed into smart legal contracts.
- –
- Finally, these smart legal contracts are compiled into executable code.
This process allows for a complete transformation from a natural language contract to executable code, ensuring the generated program aligns perfectly with the legal intent of the marked-up contract.
- Accuracy: The execution of smart contracts is based on predefined logic and conditions, thus ensuring the accuracy of the contract. This reduces the possibility of misunderstandings and disputes.
- Decentralization: The execution of smart contracts does not rely on centralized institutions or third-party trust. This increases the security and stability of the contract.
- Transparency and verifiability: The execution process of smart contracts is public, and all participants can check and verify the contract results. This provides higher transparency and trust.
- Tampability: Smart contracts cannot be modified or deleted once deployed on the blockchain. This ensures the integrity and immutability of the contract.
- Reducing intermediary costs: The automated execution of smart contracts reduces the involvement of intermediary agencies, thereby lowering transaction and contract execution costs.
7.2. Limitations and Future Work
- (1)
- Annotation burden: Currently, CTML relies on manual or semi-manual labeling (Stage 1), which presents a steep learning curve for non-professionals. While CTML provides a structured way to bridge natural language and code, the annotation burden remains a significant boundary condition. Currently, the precision of the generated smart contract heavily relies on the quality of manual markup. This process requires users to have a deep understanding of both legal logic and CTML syntax. To address this, future research will focus on integrating Large Language Models (LLMs) to automate the initial markup phase, transforming raw contract text into CTML-ready formats with minimal human intervention.
- (2)
- Limitations of domain-specific syntax: Contracts across different industries (such as insurance, supply chain, and intellectual property) have vastly different syntax structures, and current syntax rules may not be sufficient to cover all vertical sectors. Our current framework is optimized for standard commercial agreements. However, contracts in specialized fields—such as insurance derivatives or intellectual property licensing—often contain unique logic structures that may require custom grammar extensions or specialized generators. Future iterations of CTML aim to develop a modular grammar library, allowing users to plug in domain-specific rule sets (e.g., a Supply Chain Module) to enhance the framework’s versatility across different industrial sectors.
- (3)
- Semantic complexity and boundary conditions: Ambiguous terms in legal texts (such as “within a reasonable time”) are difficult to directly translate into rigid code logic. CTML encounters boundary conditions when dealing with semantic ambiguity inherent in natural language (e.g., reasonable efforts). These terms are difficult to formalize into deterministic smart contract code. We plan to explore hybrid execution models where CTML-generated contracts can interact with decentralized oracles or human-in-the-loop consensus mechanisms to resolve subjective legal predicates.
- (4)
- Robustness: For the ambiguity clauses, CTML does not rely on probabilistic automatic parsing but instead uses human experts to lock nondeterministic semantics into deterministic logical labels. For exceptional conditions and complex legal structures, the approach utilizes nested hierarchical syntax rules to fully capture logical branches. For incomplete contracts, the built-in compilation and verification engine can effectively identify missing key elements and trigger semantic error warnings, thereby forcibly avoiding potential logical risks in smart contract execution at the architectural level. While the current framework ensures robustness through expert-led markup and strict grammar validation, future iterations could integrate Formal Verification methods to mathematically prove the consistency between the marked-up contract and the generated bytecode, especially for mission-critical legal constructs.
8. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Yaqoob, I.; Salah, K.; Uddin, M.; Jayaraman, R.; Omar, M.; Imran, M. Blockchain for digital twins: Recent advances and future research challenges. IEEE Netw. 2020, 34, 290–298. [Google Scholar] [CrossRef]
- Hunhevicz, J.J.; Motie, M.; Hall, D.M. Digital building twins and blockchain for performance-based (smart) contracts. Autom. Constr. 2022, 133, 103981. [Google Scholar] [CrossRef]
- Ma, J.; Huang, R. Digital explosions and digital clones. In Proceedings of the 2015 IEEE 12th Intl Conf on Ubiquitous Intelligence and Computing, Beijing, China, 10–14 August 2015; pp. 1133–1138. [Google Scholar]
- Savelyev, A. Contract law 2.0: ‘Smart’ contracts as the beginning of the end of classic contract law. Inf. Commun. Technol. Law 2017, 26, 116–134. [Google Scholar] [CrossRef]
- Chowdhary, K.R. Natural language processing. In Fundamentals of Artificial Intelligence; Springer: New Delhi, India, 2020; pp. 603–649. [Google Scholar]
- Dixit, A.; Deval, V.; Dwivedi, V.; Norta, A.; Draheim, D. Towards user-centered and legally relevant smart-contract development: A systematic literature review. J. Ind. Inf. Integr. 2022, 26, 100314. [Google Scholar] [CrossRef]
- Rasti, A.; Anda, A.A.; Alfuhaid, S.; Parvizimosaed, A.; Amyot, D.; Roveri, M.; Logrippo, L.; Mylopoulos, J. Automated generation of smart contract code from legal contract specifications with Symboleo2sc. Softw. Syst. Model. 2025, 24, 1127–1156. [Google Scholar] [CrossRef]
- Ait Hsain, Y.; Laaz, N.; Mbarki, S. SCEditor-Web: Bridging Model-Driven engineering and generative AI for smart contract development. Information 2025, 16, 870. [Google Scholar] [CrossRef]
- Fan, Y.; Chen, E.; Zhu, Y.; He, X.; Yau, S.S.; Pandya, K. Automatic Generation of Smart Contracts from Real-World Contracts in Natural Language. In Proceedings of 2023 IEEE Smart World Congress (IEEE SWC 2023), Portsmouth, UK, 28–31 August 2023; pp. 1–8. [Google Scholar]
- Hamdaqa, M.; Met, L.A.P.; Qasse, I. iContractML 2.0: A domain-specific language for modeling and deploying smart contracts onto multiple blockchain platforms. Inf. Softw. Technol. 2022, 144, 106762. [Google Scholar] [CrossRef]
- Frantz, C.K.; Nowostawski, M. From institutions to code: Towards automated generation of smart contracts. In Proceedings of the 2016 IEEE 1st International Workshops on Foundations and Applications of Self* Systems (FAS* W), Augsburg, Germany, 12–16 September 2016; pp. 210–215. [Google Scholar]
- Choudhury, O.; Rudolph, N.; Sylla, I.; Fairoza, N.; Das, A. Auto-generation of smart contracts from domain-specific ontologies and semantic rules. In Proceedings of the 2018 IEEE International Conference on Internet of Things (iThings), Halifax, NS, Canada, 30 July–3 August 2018; pp. 963–970. [Google Scholar]
- Jurgelaitis, M.; Butkienė, R. Solidity code generation from UML state machines in model-driven smart contract development. IEEE Access 2022, 10, 33465–33481. [Google Scholar] [CrossRef]
- Tateishi, T.; Yoshihama, S.; Sato, N.; Saito, S. Automatic smart contract generation using controlled natural language and template. IBM J. Res. Dev. 2019, 63, 6:1–6:12. [Google Scholar] [CrossRef]
- Chen, E.; Qin, B.; Zhu, Y.; Song, W.; Wang, S.; Chu, C.C.W.; Yau, S.S. SPESC-Translator: Towards automatically smart legal contract conversion for blockchain-based auction services. IEEE Trans. Serv. Comput. 2021, 15, 3061–3076. [Google Scholar] [CrossRef]
- He, X.; Qin, B.; Zhu, Y.; Chen, X.; Liu, Y. SPESC: A specification language for smart contracts. In Proceedings of 2018 IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC), Tokyo, Japan, 23–27 July 2018; Volume 1, pp. 132–137. [Google Scholar]
- SPESC. A Specification Language for Smart Contracts. Available online: https://github.com/USTB-InternetSecurityLab/SPESC (accessed on 31 January 2023).
- Shi, C.; Xiang, Y.; Yu, J.; Sood, K.; Gao, L. Machine translation-based fine-grained comments generation for solidity smart contracts. Inf. Softw. Technol. 2023, 153, 107065. [Google Scholar] [CrossRef]
- Aejas, B.; Belhi, A.; Bouras, A. Smart Contracts Auto-generation for Supply Chain Contexts. In Proceedings of IFIP International Conference on Product Lifecycle Management; Springer: Cham, Switzerland, 2022; pp. 347–357. [Google Scholar]
- Fang, P.; Zou, Z.; Xiao, X.; Liu, Z. isyn: Semi-automated smart contract synthesis from legal financial agreements. In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis; Association for Computing Machinery: New York, NY, USA, 2023; pp. 727–739. [Google Scholar]
- Ahmed, S.U.; Danish, A.; Ahmad, N.; Ahmad, T. Smart contract generation through NLP and blockchain for legal documents. Procedia Comput. Sci. 2024, 235, 2529–2537. [Google Scholar] [CrossRef]
- Tong, Y.; Tan, W.; Guo, J.; Shen, B.; Qin, P.; Zhuo, S. Smart contract generation assisted by AI-based word segmentation. Appl. Sci. 2022, 12, 4773. [Google Scholar] [CrossRef]
- Napoli, E.A.; Barbàra, F.; Gatteschi, V.; Schifanella, C. Leveraging Large Language Models for Automatic Smart Contract Generation. In Proceedings of the 2024 IEEE 48th Annual Computers, Software, and Applications Conference (COMPSAC), Osaka, Japan, 2–4 July 2024; pp. 701–710. [Google Scholar]
- Santos, H.V.B.; Januario, R.R.S.; Zanatta, R.C.; Matos, S.N.; Ueyama, J. Comparative Analysis of Smart Contract Generation Using Large Language Models. In Anais do XLIII Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC); Sociedade Brasileira de Computação (SBC): Porto Alegre, Brazil, 2025; pp. 112–125. [Google Scholar]
- Barbàra, F.; Napoli, E.A.; Gatteschi, V.; Schifanella, C. Automatic Smart Contract Generation Through LLMs: When The Stochastic Parrot Fails. In Proceedings of the 6th Distributed Ledger Technology Workshop (DLT), Turin, Italy, 24–25 May 2024. [Google Scholar]
- Eysholdt, M.; Behrens, H. Xtext: Implement your language faster than the quick and dirty way. In Proceedings of the ACM International Conference Companion on Object Oriented Programming Systems Languages and Applications Companion, Reno/Tahoe, NV, USA, 17–20 October 2010; pp. 307–309. [Google Scholar]
- Mernik, M.; Heering, J.; Sloane, A.M. When and how to develop domain-specific languages. ACM Comput. Surv. (Csur) 2005, 37, 316–344. [Google Scholar] [CrossRef]
- ISO/IEC 14977:1996; Information Technology-Syntactic Metalanguage-Extended BNF. ISO/IEC Internationl Standard: Geneva, Switzerland, 1996.
- Wile, D.S. Supporting the DSL spectrum. J. Comput. Inf. Technol. 2001, 9, 263–287. [Google Scholar] [CrossRef][Green Version]
- Xtext. Available online: https://www.eclipse.org/Xtext/ (accessed on 22 November 2022).
- Bettini, L. Implementing Domain Specific Languages with Xtext and Xtend, 2nd ed.; Packt Publishing: Birmingham, UK, 2016. [Google Scholar]
- Parekh, S. Understanding Factoring Contracts and How They Work. Available online: https://www.dripcapital.com/en-in/resources/finance-guides/factoring-agreement (accessed on 22 November 2022).
- Standard. Commercial Factoring Contract Guidelines (Appendix). T/CATIS 003-2020. Available online: http://cfi.cfiservice.com/view.php?aid=2174 (accessed on 1 January 2021).





| Approach | Recent Refs | Automation | Semantic Fidelity | Verifiability | Multilingual |
|---|---|---|---|---|---|
| Formal Methods | [10,11,12,13] | Low (Manual) | Very High | Strong (Proof) | Low |
| Template-based | [14,15,16,17] | Medium | Medium | Medium | Low |
| NLP/LLM-Based | [19,20,21,22,23,24,25] | High (Auto) | Low (Probabilistic) | Weak (Black-box) | High |
| Our Approach | this paper | High (Markup) | High (Deterministic) | Strong (Compiler) | High |
| Step | Automation Level | Required Manual/Computing Power |
|---|---|---|
| Grammar Definition in Stage 1 | Manual | One-time Developer Definition (Xtext) |
| Markup/Annotation in Stage 2 | Semi-automatic | Manual Identification Logic + CTML Plugin-Assisted Filling |
| DSL Instantiation in Stages 3 and 4 | Fully automatic | Millisecond-level Compiler Processing |
| Code Generation in Stage 4 | Fully automatic | Millisecond-level Code Mapping |
| Labeling Module | Syntax Definition | |
|---|---|---|
| Document Format | <!DOCTYPE ctml><ctml lang=zh_cn><<factor title@printerDeal>>text<</factor>></ctml> | |
| Semantic Markup | Law Factor | factorExpression ::= <<factor factorSet@factorID(#attribute=value)+>>text<</factor>> factorSet ::= {title, party|group, asset, genTerm|breTerm|arbiTerm, conclusion, addition} |
| Law Property | propertyExpression ::= <<property[factorID.]propertySet[@propertyID] (#attribute=value)+>>text<</property>> propertySet ::= {info, right, action, preCondition, adjCondition, postCondition, against, controversy, institution, signature} | |
| Law Component | componentExpression ::= <<component(#attribute=value)+>>text<</component>> component ::= {actionTime, timePredicate, rangePredicate, deposit|withdraw|transfer, assetExpression} | |
| Field | fieldExpression ::= <<field [factorID.propertySet]@fieldID [%type] [#quantity=value]>>text<</field>> | |
| Metadata Markup | metadataExpression ::= <{[factorID]@exchangedDataID [%type] (#option=value)+}> | |
| Contract Mode | Grammar | |
|---|---|---|
| Architecture | Contracts ::= Title{ Parties+ Assets+ Terms+ Additions+ Signs+ } | |
| Title | Title ::= contract Cname (: serial number Chash)? | |
| Party | Parties ::= party group? Pname {field+ } | |
| Asset Expression | Assets ::= asset Aname{ info{ field+ } right{ field+ } } | |
| Asset Oper- ation | Deposit | Deposits ::= deposit (value RelationOperator)? AssetExpression |
| Withdraw | Withdraws ::= withdraw AssetExpression | |
| Transfer | Transfers ::= transfer AssetExpression to target | |
| Time Expr- ession | ActionEnforce- dTimeQuery | ActionEnforcedTimeQuery ::= (all|some|this)? party did action |
| TimePredicate | TimePredicate ::= (targetTime)? (is | isn’t) (before | after) baseTime | |
| BoundedTime- Predicate | BoundedTimePredicate ::= (within)? boundary (before|after) baseTime | |
| General Term | GeneralTerms ::= term Tname: Pname (must|can|cannot) action(field+) (when preCondition)? (while transactions+)? (where postCondition)? | |
| Term | Breach Term | BreachTerms ::= breach term Bname (against Tname+)? : Pname (must|can) action(field+) (when preCondition)? (while transactions+)? (where postCondition)? |
| Arbitration Term | ArbitrationTerms ::= arbitration term : (The statement of any controversy)? administered by institution : instName | |
| Signature | Signatures ::= Signature of party Pname : { printedName:string, signature: string, Date: date } | |
| Addition Information | Additions ::= field + | |
| field | attribute : ( constant | type ) | |
| Metrics | Formal Methods | Template-Based | NLP/LLM-Based | Our Approach |
|---|---|---|---|---|
| Accuracy | High (Limited to predefined models) | High (Strict adherence to rules) | Variable (Susceptible to hallucinations) | High (Deterministic mapping) |
| Transparency | High (Visual logical flow) | High (Explicit transformation rules) | Low (Opaque “black-box” processing) | High (1:1 semantic-to-code traceability) |
| Coverage | Low (Limited by graphical symbols) | Medium (Dependent on template library) | High (Broad natural language support) | High (Extensible markup grammar) |
| Error Rates | Low (Primarily manual modeling errors) | Low (Errors due to template mismatch) | High/Unpredictable (Stochastic outputs) | Minimal (Controlled via syntax validation) |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Chen, C.E.; Liu, X.; Jia, L.; Liang, B.; Zhu, Y.; Wu, T. Transformation of Real-World Contracts to Smart Contracts for Blockchain Applications. Electronics 2026, 15, 1514. https://doi.org/10.3390/electronics15071514
Chen CE, Liu X, Jia L, Liang B, Zhu Y, Wu T. Transformation of Real-World Contracts to Smart Contracts for Blockchain Applications. Electronics. 2026; 15(7):1514. https://doi.org/10.3390/electronics15071514
Chicago/Turabian StyleChen, Cecilia E., Xuanyu Liu, Limin Jia, Bo Liang, Yan Zhu, and Tong Wu. 2026. "Transformation of Real-World Contracts to Smart Contracts for Blockchain Applications" Electronics 15, no. 7: 1514. https://doi.org/10.3390/electronics15071514
APA StyleChen, C. E., Liu, X., Jia, L., Liang, B., Zhu, Y., & Wu, T. (2026). Transformation of Real-World Contracts to Smart Contracts for Blockchain Applications. Electronics, 15(7), 1514. https://doi.org/10.3390/electronics15071514

