An exploratory study on smart legal contracts

Karen Sze Suen Lee · DR-NTU (Nanyang Technological University) · 2026

The rapid adoption of blockchain technology has made the security of smart contracts a critical priority. However, authoring contracts directly in Solidity remains a com plex and error-prone process, where minor implementation defects frequently result in catastrophic, irreversible financial losses. Current development paradigms struggle to address these risks: manual coding imposes an unsustainable security burden on developers, template-based generators offer insufficient flexibility, and emerging Large Language Model (LLM) tools introduce non-determinism and ”hallucinated” code that undermine the auditability required for financial software. Consequently, there isa pressing need for a development approach that bridges high-level abstraction with rigorous, reproducible security gurantees.To address this gap, this research presents a deterministic, compiler-driven transla tion system that converts a high-level Domain-Specific Language (DSL) into secure,standards-compliant Solidity code. Delivered via an integrated web-based IDE, the system abstracts the low-level intricacies of the Ethereum Virtual Machine (EVM) behind a streamlined ”Author → Generate → Verify” workflow. The backend utilizes a strict, multi-stage compilation architecture: raw DSL input is parsed via a formal grammar into a structured intermediate Abstract Syntax Tree (AST), subjected to rigor ous semantic validation, and deterministically rendered into human-readable Solidity source code.Crucially, the system shifts smart contract security from a reactive, post-hoc pro cess to a proactive, secure-by-construction paradigm. During the AST transformation phase, the engine programmatically injects battle-tested security primitives, including ownership-based access control, reentrancy protection, and emergency stop mecha nisms. This architectural guarantee mitigates pervasive vulnerability classes without requiring manual intervention. Furthermore, the system integrates a sandboxed com pilation environment that enforces bounded import resolution and executes heuristic AST analysis to detect high-risk Solidity constructs prior to deployment.The system is evaluated using quantitative codebase metrics, deterministic correct ness checks, and a standardized usability protocol. Results demonstrate that the pro posed framework consistently produces deterministic, syntactically valid, and security compliant Solidity contracts while significantly improving workflow efficiency. By providing a practical and auditable alternative to non-deterministic generation tools, this work demonstrates that secure defaults and a structured translation pipeline can successfully mitigate the inherent risks of smart contract development.

Read the paper · More papers on PaperTik