Legal Compliance Evaluation of Smart Contracts Generated By Large Language Models

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Wijayakoon, Chanuka, Dong, Hai, Bandara, H. M. N. Dilum, Tari, Zahir, Soin, Anurag
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866910979829268480
author Wijayakoon, Chanuka
Dong, Hai
Bandara, H. M. N. Dilum
Tari, Zahir
Soin, Anurag
author_facet Wijayakoon, Chanuka
Dong, Hai
Bandara, H. M. N. Dilum
Tari, Zahir
Soin, Anurag
contents Smart contracts can implement and automate parts of legal contracts, but ensuring their legal compliance remains challenging. Existing approaches such as formal specification, verification, and model-based development require expertise in both legal and software development domains, as well as extensive manual effort. Given the recent advances of Large Language Models (LLMs) in code generation, we investigate their ability to generate legally compliant smart contracts directly from natural language legal contracts, addressing these challenges. We propose a novel suite of metrics to quantify legal compliance based on modeling both legal and smart contracts as processes and comparing their behaviors. We select four LLMs, generate 20 smart contracts based on five legal contracts, and analyze their legal compliance. We find that while all LLMs generate syntactically correct code, there is significant variance in their legal compliance with larger models generally showing higher levels of compliance. We also evaluate the proposed metrics against properties of software metrics, showing they provide fine-grained distinctions, enable nuanced comparisons, and are applicable across domains for code from any source, LLM or developer. Our results suggest that LLMs can assist in generating starter code for legally compliant smart contracts with strict reviews, and the proposed metrics provide a foundation for automated and self-improving development workflows.
format Preprint
id arxiv_https___arxiv_org_abs_2506_00943
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Legal Compliance Evaluation of Smart Contracts Generated By Large Language Models
Wijayakoon, Chanuka
Dong, Hai
Bandara, H. M. N. Dilum
Tari, Zahir
Soin, Anurag
Software Engineering
Artificial Intelligence
Smart contracts can implement and automate parts of legal contracts, but ensuring their legal compliance remains challenging. Existing approaches such as formal specification, verification, and model-based development require expertise in both legal and software development domains, as well as extensive manual effort. Given the recent advances of Large Language Models (LLMs) in code generation, we investigate their ability to generate legally compliant smart contracts directly from natural language legal contracts, addressing these challenges. We propose a novel suite of metrics to quantify legal compliance based on modeling both legal and smart contracts as processes and comparing their behaviors. We select four LLMs, generate 20 smart contracts based on five legal contracts, and analyze their legal compliance. We find that while all LLMs generate syntactically correct code, there is significant variance in their legal compliance with larger models generally showing higher levels of compliance. We also evaluate the proposed metrics against properties of software metrics, showing they provide fine-grained distinctions, enable nuanced comparisons, and are applicable across domains for code from any source, LLM or developer. Our results suggest that LLMs can assist in generating starter code for legally compliant smart contracts with strict reviews, and the proposed metrics provide a foundation for automated and self-improving development workflows.
title Legal Compliance Evaluation of Smart Contracts Generated By Large Language Models
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2506.00943