Skip to main content

Video Tutorial

The Contract

pragma language_version >= 0.16 && <= 0.18;

import CompactStandardLibrary;

// Public state visible on the blockchain
export ledger round: Counter;

// Circuit that increments the counter by 1
export circuit increment(): [] {
  round.increment(1);
}

How It Works

Public Ledger State

export ledger round: Counter;
Counter is a built-in type for counting operations. The value is publicly visible on the blockchain.

The Increment Circuit

export circuit increment(): [] {
  round.increment(1);
}
Increments the counter by 1. Counter values can only increase.

What’s Next