ODRL-Solidity-Translator is a preliminary TypeScript-based tool that converts ODRL (Open Digital Rights Language) policies into executable Solidity smart contracts. This repository enables automated translation of permissions, prohibitions, and obligations defined in ODRL into on-chain logic enforceable on Ethereum-compatible blockchains.
The goal of this project is to automatically translate ODRL policies into Solidity smart contracts. The tool parses ODRL JSON policies and generates Solidity code that enforces the rules on-chain.
Key features:
-
Translate ODRL operators (e.g., eq, lt, gteq) into Solidity expressions.
-
Handle Permission, Prohibition and Obligation rules.
-
Supports logical constraints and combinations of multiple rules.
-
Generates validation functions for multiple constraints.
-
Includes a Solidity modifier to restrict access to authorized functions.
This allows organizations and developers to implement digital rights management and enforce usage policies for digital assets on blockchain platforms.
To run this project, ensure you have Node.js installed. Then install dependencies:
npm install
-
Place your ODRL JSON policy file in the project folder (example: example-policy.json).
-
Run the translator using Node.js / ts-node:
npm start --name=filePathReplace filePath with the path to your JSON policy file.
-
The generated Solidity contract will be saved in the ./contracts folder with the same base name as the JSON file.
Project is created with:
This work was presented at the BRAIN 2025 Workshop, in conjunction with PERCOM 2025.
If you want to cite it, you can use the following BibTex reference:
@inproceedings{DBLP:conf/percom/BistarelliLS25,
author = {Stefano Bistarelli and
Chiara Luchini and
Francesco Santini},
title = {A Preliminary Approach for Translating {ODRL} to Smart Policies},
booktitle = {{IEEE} International Conference on Pervasive Computing and Communications
Workshops and other Affiliated Events, PerCom 2025 - Workshops, Washington
DC, USA, March 17-21, 2025},
pages = {44--49},
publisher = {{IEEE}},
year = {2025},
url = {https://doi.org/10.1109/PerComWorkshops65533.2025.00039},
doi = {10.1109/PERCOMWORKSHOPS65533.2025.00039},
timestamp = {Tue, 01 Jul 2025 06:48:58 +0200},
biburl = {https://dblp.org/rec/conf/percom/BistarelliLS25.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
This project is licensed under the MIT License - see the LICENSE.md file for details