Implementing SAMOS in Mandala

Public Blockchains (BC) in support of Smart Contracts (SC), like Ethereum, enable everyone to coordinate in a decentralized approach the management of scarce, valuable resources (like cryptocurrencies). Such BCs allow for building SCs that own resources and manage permissions describing who is allowed to interact with these resources and what actions can be applied to them. However, programming languages and runtime systems used in current BCs lack a secure, flexible, and straightforward way to implement permissions within their SCs. This unnecessary complexity can lead to erroneous implementations, allowing unauthorized access. The best-known incident related to a permission problem was the “Parity Hack”, which led to the “loss” of tokens, valued at approximately 31 M USD. SAMOS designed a concept to achieve an improved access control representation. It provides a secure path to a capability-based permission management system by using opaque and substructural types. This paper presents an implementation of SAMOS in the functional SC language Mandala, which offers a mechanism to enforce the key properties of opaque and substructural types during the SC execution by using an on-chain soundness checker.