Skip to main content
QUICK REVIEW

[Paper Review] Obsidian: Typestate and Assets for Safer Blockchain Programming

Michael Coblenz, Reed Oei|arXiv (Cornell University)|Sep 8, 2019
Blockchain Technology Applications and SecurityComputer Science43 references12 citations
TL;DR

Obsidian is a domain-specific programming language that combines typestate and linear types to statically detect common smart contract bugs, such as improper state transitions and asset loss. By enforcing ownership and state discipline at compile time, Obsidian reduces boilerplate and improves safety, as demonstrated in case studies on parametric insurance and supply chain management compared to Solidity.

ABSTRACT

Blockchain platforms are coming into broad use for processing critical transactions among participants who have not established mutual trust. Many blockchains are programmable, supporting smart contracts, which maintain persistent state and support transactions that transform the state. Unfortunately, bugs in many smart contracts have been exploited by hackers. Obsidian is a novel programming language with a type system that enables static detection of bugs that are common in smart contracts today. Obsidian is based on a core calculus, Silica, for which we proved type soundness. Obsidian uses typestate to detect improper state manipulation and uses linear types to detect abuse of assets. We describe two case studies that evaluate Obsidian's applicability to the domains of parametric insurance and supply chain management, finding that Obsidian's type system facilitates reasoning about high-level states and ownership of resources. We compared our Obsidian implementation to a Solidity implementation, observing that the Solidity implementation requires much boilerplate checking and tracking of state, whereas Obsidian does this work statically.

Motivation & Objective

  • To address the growing risk of security vulnerabilities in smart contracts due to common programming errors.
  • To design a programming language that enables static detection of bugs related to state manipulation and asset misuse.
  • To combine typestate and linear types into a practical, usable language for blockchain developers.
  • To evaluate the language's effectiveness through real-world case studies in insurance and supply chain management.
  • To provide a sound, formally verified foundation for smart contract programming via a core calculus, Silica.

Proposed method

  • Designing Obsidian as a surface language built on top of a core calculus, Silica, which is formally proven sound.
  • Using typestate to enforce correct state transitions, ensuring that methods are only called when an object is in a valid state.
  • Applying linear types to track asset ownership and prevent accidental loss or duplication of digital assets.
  • Implementing a permission system that restricts aliasing to maintain safety guarantees while supporting practical programming.
  • Supporting both on-chain smart contracts and off-chain client programs in a unified language to ensure end-to-end safety.
  • Integrating the language with blockchain platforms like Hyperledger Fabric and planning support for Ethereum.

Experimental results

Research questions

  • RQ1Can typestate and linear types be effectively combined in a practical programming language to prevent common smart contract bugs?
  • RQ2How does Obsidian's approach compare to existing languages like Solidity in terms of code conciseness and safety?
  • RQ3Can Obsidian's type system be used to build nontrivial, real-world smart contracts with strong safety guarantees?
  • RQ4What are the architectural implications of using a unified language for both smart contracts and client programs?
  • RQ5How does the formal foundation (Silica) support the reliability and extensibility of the language?

Key findings

  • Obsidian's type system statically prevents common bugs such as improper state transitions and asset loss, reducing runtime vulnerabilities.
  • Compared to Solidity, Obsidian eliminates much of the boilerplate code needed for state and asset tracking, resulting in more concise and maintainable programs.
  • Case studies in parametric insurance and supply chain management demonstrated that Obsidian's typestate and asset modeling were well-suited to domains involving value transfer and state-dependent operations.
  • Despite being a research prototype with limited documentation, developers successfully implemented nontrivial smart contracts in Obsidian.
  • The core calculus, Silica, was formally proven sound, providing a trustworthy foundation for Obsidian and future typestate-oriented languages.
  • The language's unified approach to on-chain and off-chain programming enables consistent safety guarantees across the entire application stack.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.