On this page:
Reach:   The Safest and Easiest DApp Programming Language
0.1.2

Reach: The Safest and Easiest DApp Programming Language

Jay McCarthy <jay@reach.sh>

Reach is a domain-specific language for building decentralized applications (DApps).

This set of documents contains everything you need to know about Reach.

If you are looking for something specific, here are some places to look:

The source of this site is available on GitHub; we welcome Pull Requests for improvements and Issues for problem reports!

    1 Overview

      1.1 Decentralized applications

      1.2 A minimal Reach program

      1.3 Compile

      1.4 Verify

      1.5 Interface

      1.6 Execute

      1.7 Next steps

    2 Tutorial

      2.1 Install and Initialize

      2.2 Scaffolding and Setup

      2.3 Rock, Paper, and Scissors

      2.4 Bets and Wagers

      2.5 Trust and Commitments

      2.6 Timeouts and Participation

      2.7 Play and Play Again

      2.8 Interaction and Independence

      2.9 Onward and Further

    3 Guide

      3.1 Using Reach on Windows

      3.2 How does Reach use version numbers?

      3.3 How and what to verify

      3.4 Finding and using loop invariants

      3.5 Choosing a deployment mode

      3.6 Non-participation: What it is and how to protect against it

      3.7 Determinism, simultaneity, and choice in decentralized applications

      3.8 Building decentralized abstractions

      3.9 What are Reach’s limitations and its future roadmap

      3.10 How does Reach work?

    4 Workshop

      4.1 Workshop: Hash Lock

        4.1.1 Problem Analysis

        4.1.2 Data Definition

        4.1.3 Communication Construction

        4.1.4 Assertion Insertion

        4.1.5 Interaction Introduction

        4.1.6 Deployment Decisions

        4.1.7 Discussion

      4.2 Workshop: Relay Account

        4.2.1 Problem Analysis

        4.2.2 Data Definition

        4.2.3 Communication Construction

        4.2.4 Assertion Insertion

        4.2.5 Interaction Introduction

        4.2.6 Deployment Decisions

        4.2.7 Discussion and Next Steps

      4.3 Workshop: Trust Fund

        4.3.1 Problem Analysis

        4.3.2 Data Definition

        4.3.3 Communication Construction

        4.3.4 Assertion Insertion

        4.3.5 Interaction Introduction

        4.3.6 Deployment Decisions

        4.3.7 Discussion and Next Steps

      4.4 Workshop: Fair Rock-Paper-Scissors

      4.5 Workshop: Efficient Rock-Paper-Scissors

      4.6 Workshop: Rental Agreement

      4.7 Workshop: Simultaneous Games

      4.8 Workshop: Guardian Account

      4.9 Workshop: Periodic Payment

      4.10 Workshop: Nim

      4.11 Workshop: Tic-Tac-Toe

      4.12 Workshop: Secured Loan

      4.13 Workshop: Oracle

      4.14 Workshop: Timed English Auction

      4.15 Workshop: Crowd-funding

    5 Reference

      5.1 Installation

      5.2 Usage

        5.2.1 reach compile

        5.2.2 reach init

        5.2.3 reach run

        5.2.4 reach scaffold

        5.2.5 reach upgrade

        5.2.6 reach update

        5.2.7 reach version

      5.3 Language Model

        5.3.1 Evaluation Model

        5.3.2 Compilation Model

        5.3.3 Syntax Model

      5.4 Programs

        5.4.1 Validity

          5.4.1.1 Security levels and scope

        5.4.2 Modules

          5.4.2.1 Statements

            5.4.2.1.1 export

            5.4.2.1.2 import

          5.4.2.2 Expressions

            5.4.2.2.1 Reach.App

        5.4.3 Steps

          5.4.3.1 Statements

            5.4.3.1.1 only and each

            5.4.3.1.2 publish, pay, and timeout

            5.4.3.1.3 wait

            5.4.3.1.4 exit

          5.4.3.2 Expressions

            5.4.3.2.1 unknowable

            5.4.3.2.2 closeTo

        5.4.4 Local Steps

          5.4.4.1 Statements

          5.4.4.2 Expressions

            5.4.4.2.1 interact

            5.4.4.2.2 assume

            5.4.4.2.3 declassify

            5.4.4.2.4 makeCommitment

        5.4.5 Consensus Steps

          5.4.5.1 Statements

            5.4.5.1.1 commit

            5.4.5.1.2 Participant.set and .set

            5.4.5.1.3 while

            5.4.5.1.4 continue

          5.4.5.2 Expressions

            5.4.5.2.1 transfer

            5.4.5.2.2 require

            5.4.5.2.3 checkCommitment

        5.4.6 Computations

          5.4.6.1 Comments

          5.4.6.2 Blocks

          5.4.6.3 Statements

            5.4.6.3.1 const and function

            5.4.6.3.2 return

            5.4.6.3.3 if

            5.4.6.3.4 switch

            5.4.6.3.5 Block statements

            5.4.6.3.6 Expression statements

          5.4.6.4 Expressions

            5.4.6.4.1 Identifier reference

            5.4.6.4.2 Function application

            5.4.6.4.3 Types

            5.4.6.4.4 Literal values

            5.4.6.4.5 Operator expression

            5.4.6.4.6 Parenthesized expression

            5.4.6.4.7 Tuples

            5.4.6.4.8 array

            5.4.6.4.9 Element reference

            5.4.6.4.10 Array & tuple length: Tuple.length, Array.length, and .length

            5.4.6.4.11 Array & tuple update: Tuple.set, Array.set, and .set

            5.4.6.4.12 Array group operations: Array.iota, Array.concat & .concat, Array.empty, Array.zip & .zip, Array.map & .map, Array.reduce & .reduce, Array.forEach & .forEach, and Array.replicate

            5.4.6.4.13 Objects

            5.4.6.4.14 Field reference

            5.4.6.4.15 Object.set

            5.4.6.4.16 Data

            5.4.6.4.17 Maybe

            5.4.6.4.18 Conditional expression

            5.4.6.4.19 Arrow expression

            5.4.6.4.20 makeEnum

            5.4.6.4.21 assert

            5.4.6.4.22 forall

            5.4.6.4.23 possible

            5.4.6.4.24 digest

            5.4.6.4.25 balance

            5.4.6.4.26 implies

            5.4.6.4.27 ensure

            5.4.6.4.28 hasRandom

      5.5 Consensus Network Connectors

        5.5.1 Ethereum

        5.5.2 Algorand

      5.6 Participant Backends

        5.6.1 JavaScript

          5.6.1.1 Guarantees

          5.6.1.2 loader.mjs

          5.6.1.3 Standard Library

            5.6.1.3.1 Utilities

          5.6.1.4 ask.mjs

    Index