Skip to content

Commit

Permalink
Consoldiating resources
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Feb 17, 2025
1 parent 6795c2f commit bebcaee
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 500 deletions.
59 changes: 4 additions & 55 deletions documentation/00_leo.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,14 @@ title: The Leo Programming Language
sidebar_label: Leo
---

Welcome to the Leo programming language. Leo is a statically-typed programming language for private applications. Designed for intuitive Aleo blockchain development, Leo lays the foundation for a private, decentralized ecosystem.
Welcome to the Leo programming language. Leo is a statically-typed programming language for private applications. Designed for intuitive Aleo blockchain development, Leo lays the foundation for a private, decentralized ecosystem. Happy learning!

:::info
The Leo language is currently in active development. Please monitor the repository on [**GitHub**](https://github.com/ProvableHQ/leo) for possibly breaking changes.
:::

## Installing Leo
T

Proceed to [**Installation**](./leo/01_installation.md) for information on how to install Leo.

## Getting Started
### Contributing

Check out the [**Hello Leo**](./leo/02_hello.md) tutorial for a brief walk-through of Leo and the Leo CLI.
Found a bug? Have an idea for a feature? File an issue or PR on the [**Leo GitHub**](https://github.com/ProvableHQ/leo/issues/new/choose) or the [**Documentation Source**](https://github.com/ProvableHQ/leo-docs-source).

## Language Guide

To learn about Leo's supported types, start with [**Data Types and Values**](./leo/03_language.md).

To learn the core concepts and syntax of Leo, start with the [**Layout of a Leo Program**](./leo/03_language.md#layout-of-a-leo-program).

To view the full list of supported operators in Leo, see [**Operators**](./leo/04_operators.md).

For a quick reference of Leo syntax, see the [**Leo Cheat Sheet**](./leo/08_cheatsheet.md).

## Formal Language Documentation

A formal ABNF grammar specification for the syntax of Leo can be viewed [here](https://github.com/ProvableHQ/grammars/blob/master/leo.abnf).

## Command Line Interface Documentation

The Leo CLI provides a suite of commands to make programming in Leo easy.

- [**leo example**](./leo/05_commands.md#leo-example)
- [**leo new**](./leo/05_commands.md#leo-new)
- [**leo build**](./leo/05_commands.md#leo-build)
- [**leo run**](./leo/05_commands.md#leo-run)
- [**leo execute**](./leo/05_commands.md#leo-execute)
- [**leo clean**](./leo/05_commands.md#leo-clean)
- [**leo update**](./leo/05_commands.md#leo-update)
- [**leo account**](./leo/05_commands.md#leo-account)

[//]: # (- [**leo deploy**](./leo/05_commands.md#leo-deploy))
[//]: # (- [**leo node**](./leo/05_commands.md#leo-node))

## Additional Material
Install Leo for your favorite code [**editor**](./leo/06_tooling.md).

For additional developer resources such as examples and community projects, see [**Developer Resources**](./leo/07_resources.md).

Is your Leo code formatted correctly? Check out the [**Style Guide**](./leo/07_resources.md#style-guide) and [**Common Patterns**](./leo/07_resources.md#common-patterns) for the official guidelines.

Found a bug? Have an idea for a feature? File an issue on the [**Leo GitHub**](https://github.com/ProvableHQ/leo/issues/new/choose).

See the [**Contributing Guide**](./leo/07_resources.md#contributing) for more information.

## Examples
- [Private Auction](./leo/09_auction.md)
- [Basic Bank](./leo/10_basic_bank.md)
- [Vote](./leo/11_vote.md)
- [Token](./leo/12_token.md)
- [TicTacToe](./leo/13_tictactoe.md)
- [Battleship](./leo/14_battleship.md)
4 changes: 0 additions & 4 deletions documentation/01_whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ title: Latest in Leo
sidebar_label: What's New?
---

Welcome to the Aleo community. Together we are working to build a platform for web applications that are
performant, secure, and private. Aleo introduces an application runtime environment that allows your software
to compile, execute, and finalize its state autonomously.

:::tip
# What's new on Aleo?
### [**🔧 Getting Ready for Testnet Beta**](./leo/16_testnet_beta.md) - A guide on updating your Leo applications for Testnet Beta.
Expand Down
78 changes: 9 additions & 69 deletions documentation/cli/00_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@ The Leo CLI is a command line interface tool that comes equipped with the Leo co
You can print the list of commands by running `leo --help`
:::

* [`example`](#leo-example) - Create a new Leo package from an example program.
* [`new`](#leo-new) - Create a new Leo package in a new directory.
* [`build`](#leo-build) - Compile the current package as a program.
* [`run`](#leo-run) - Run a program with input variables.
* [`execute`](#leo-execute) - Execute a program with input variables.
* [`add`](#leo-add) - Add a new on-chain or local dependency to the current package.
* [`deploy`](#leo-deploy) - Deploy a program.
* [`clean`](#leo-clean) - Clean the output directory.
* [`update`](#leo-update) - Update to the latest version of Leo.
* [`account`](#leo-account) - Create a new Aleo account, sign and verify messages.
* [`new`](#leo-new) - Create a new Leo project in a new directory.
* [`build`](#leo-build) - Compile the current project.
* [`run`](#leo-run) - Run a program without producing a proof.
* [`execute`](#leo-execute) - Execute a program and produce a transaction containing a proof.
* [`deploy`](#leo-deploy) - Generate proving and verifying keys and produce a transaction contianing the deployment.
* [`add`](#leo-add) - Add a new on-chain or local dependency to the current project.
* [`remove`](#leo-remove) - Remove a dependency from the current project.
* [`clean`](#leo-clean) - Clean the build and output artifacts.
* [`update`](#leo-update) - Update to the latest version of Leo.

[//]: # (* [`deploy`](#leo-deploy) - Deploy a program.)
[//]: # (* [`node`](#leo-node) - Start a local development server.)

## `leo example`

Expand Down Expand Up @@ -274,61 +272,3 @@ Options:
-h, --help Print help
```
### `leo account sign`
The `leo account sign` command enables developers and users to create cryptographic signatures using an Aleo private key. These signatures can be verified within leo using the [`signature::verify`](../leo/04_operators.md#signatureverify) function or with the `leo account verify` command.
To generate a signature for Leo and Aleo values, run the following:
```bash
# replace `5field` with any aleo value
leo account sign --private-key {$PRIVATE_KEY} -m 5field
# Output:
sign1...
```
To generate a signature for any plaintext, use the `--raw` flag:
```bash
# replace "Hello, Aleo" with any plaintext message
leo account sign --private-key {$PRIVATE_KEY} -raw -m "Hello, Aleo"
# Output:
sign1...
```
There are a few alternatives to using the `--private-key` flag:
- `--private-key-file <path/to/file>` - read a private key from a text file
- no flags - read a private key from environment, or `.env`
### `leo account verify`
To complement with the [`leo account sign`](#leo-account-sign) command, the `leo account verify` command verifies the signatures of Aleo values and plaintext messages.
To verify signed aleo values, run:
```bash
# replace `5field` with the message and `sign1signaturehere` with the signature
leo account verify -a {$ADDRESS} -m 5field -s sign1signaturehere
# Output:
✅ The signature is valid
# Error Output:
Error [ECLI0377002]: cli error: ❌ The signature is invalid
```
To verify signatures of signed plaintext values, run:
```bash
# replace "Hello, Aleo" with the message and `sign1signaturehere` with the signature
leo account verify -a {$ADDRESS} --raw -m "Hello, Aleo" -s sign1signaturehere
# Output:
✅ The signature is valid
# Error Output:
Error [ECLI0377002]: cli error: ❌ The signature is invalid
```
59 changes: 58 additions & 1 deletion documentation/cli/03_signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,61 @@ title: Sign and Verify
sidebar_label: Sign and Verify
---

Coming soon!
## `leo account sign`

The `leo account sign` command enables developers and users to create cryptographic signatures using an Aleo private key. These signatures can be verified within leo using the [`signature::verify`](../leo/04_operators.md#signatureverify) function or with the `leo account verify` command.

To generate a signature for Leo and Aleo values, run the following:

```bash
# replace `5field` with any aleo value
leo account sign --private-key {$PRIVATE_KEY} -m 5field

# Output:
sign1...
```

To generate a signature for any plaintext, use the `--raw` flag:

```bash
# replace "Hello, Aleo" with any plaintext message
leo account sign --private-key {$PRIVATE_KEY} -raw -m "Hello, Aleo"

# Output:
sign1...
```

There are a few alternatives to using the `--private-key` flag:

- `--private-key-file <path/to/file>` - read a private key from a text file
- no flags - read a private key from environment, or `.env`

## `leo account verify`

To complement with the [`leo account sign`](#leo-account-sign) command, the `leo account verify` command verifies the signatures of Aleo values and plaintext messages.

To verify signed aleo values, run:

```bash
# replace `5field` with the message and `sign1signaturehere` with the signature
leo account verify -a {$ADDRESS} -m 5field -s sign1signaturehere

# Output:
✅ The signature is valid

# Error Output:
Error [ECLI0377002]: cli error: ❌ The signature is invalid
```

To verify signatures of signed plaintext values, run:

```bash
# replace "Hello, Aleo" with the message and `sign1signaturehere` with the signature
leo account verify -a {$ADDRESS} --raw -m "Hello, Aleo" -s sign1signaturehere

# Output:
✅ The signature is valid

# Error Output:
Error [ECLI0377002]: cli error: ❌ The signature is invalid
```
96 changes: 48 additions & 48 deletions documentation/getting_started/01_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,59 +13,59 @@ There are a number of ways to install Leo, depending on your platform and prefer

<Tabs defaultValue="cargo"
values={[
{ label: 'Cargo', value: 'cargo' },
{ label: 'Pre-Built Binaries', value: 'prebuilt' },
{ label: 'Build from Source', value: 'source' },
{ label: 'Cargo', value: 'cargo' },
{ label: 'Pre-Built Binaries', value: 'prebuilt' },
{ label: 'Build from Source', value: 'source' },
]}>
<TabItem value="cargo">
<h3>1. Install Cargo</h3>
<p>The easiest way to install Cargo is to install the latest stable release of Rust: <a href="https://bit.ly/start-rust">bit.ly/start-rust</a></p>
<h3>2. Install Leo</h3>
<pre><code>cargo install leo-lang</code></pre>
<p>This will generate the executable at <code>~/.cargo/bin/leo</code>.</p>
</TabItem>
<TabItem value="prebuilt">
<p>Download and install Leo with the official pre-built binaries.</p>
<h3>For MacOS (Apple Silicon)</h3>
<ul>
<li><a href="https://github.com/ProvableHQ/leo/releases/latest/download/leo.zip"><strong>Download Leo for Apple Silicon (MacOS)</strong></a></li>
<li>This will download a <code>.zip</code> file containing a <strong>Unix Executable File</strong>.</li>
</ul>
<h4>Installation:</h4>
<ol>
<li>Extract the <code>.zip</code> file.</li>
<li>Open a terminal and navigate to the extracted directory.</li>
<li>Run <code>chmod +x leo</code> to make the file executable.</li>
<li>Move <code>leo</code> to <code>/usr/local/bin</code> to use it system-wide.</li>
<pre><code>mv leo /usr/local/bin</code></pre>
<li>Run <code>leo --version</code> to confirm installation.</li>
</ol>
<h3>For Other Platforms</h3>
<ul>
<li><a href="https://github.com/ProvableHQ/leo/releases"><strong>Browse all Leo releases</strong></a></li>
</ul>
</TabItem>
<TabItem value="source">
<h2>Install from Source</h2>
<p>To use the latest Leo features, install the Leo source code from GitHub.</p>
<h3>1. Install the Prerequisites</h3>
<ul>
<li><strong>Install Git:</strong> <a href="https://bit.ly/start-git">bit.ly/start-git</a></li>
<li><strong>Install Rust:</strong> <a href="https://bit.ly/start-rust">bit.ly/start-rust</a></li>
</ul>
<h4>Verify Installation</h4>
<pre><code>git --version</code></pre>
<pre><code>cargo --version</code></pre>
<h3>2. Build Leo from Source Code</h3>
<pre><code># Download the source code
<TabItem value="cargo">
<h3>1. Install Cargo</h3>
<p>The easiest way to install Cargo is to install the latest stable release of Rust: <a href="https://bit.ly/start-rust">bit.ly/start-rust</a></p>
<h3>2. Install Leo</h3>
<pre><code>cargo install leo-lang</code></pre>
<p>This will generate the executable at <code>~/.cargo/bin/leo</code>.</p>
</TabItem>
<TabItem value="prebuilt">
<p>Download and install Leo with the official pre-built binaries.</p>
<h3>For MacOS (Apple Silicon)</h3>
<ul>
<li><a href="https://github.com/ProvableHQ/leo/releases/latest/download/leo.zip"><strong>Download Leo for Apple Silicon (MacOS)</strong></a></li>
<li>This will download a <code>.zip</code> file containing a <strong>Unix Executable File</strong>.</li>
</ul>
<h4>Installation:</h4>
<ol>
<li>Extract the <code>.zip</code> file.</li>
<li>Open a terminal and navigate to the extracted directory.</li>
<li>Run <code>chmod +x leo</code> to make the file executable.</li>
<li>Move <code>leo</code> to <code>/usr/local/bin</code> to use it system-wide.</li>
<pre><code>mv leo /usr/local/bin</code></pre>
<li>Run <code>leo --version</code> to confirm installation.</li>
</ol>
<h3>For Other Platforms</h3>
<ul>
<li><a href="https://github.com/ProvableHQ/leo/releases"><strong>Browse all Leo releases</strong></a></li>
</ul>
</TabItem>
<TabItem value="source">
<h2>Install from Source</h2>
<p>To use the latest Leo features, install the Leo source code from GitHub.</p>
<h3>1. Install the Prerequisites</h3>
<ul>
<li><strong>Install Git:</strong> <a href="https://bit.ly/start-git">bit.ly/start-git</a></li>
<li><strong>Install Rust:</strong> <a href="https://bit.ly/start-rust">bit.ly/start-rust</a></li>
</ul>
<h4>Verify Installation</h4>
<pre><code>git --version</code></pre>
<pre><code>cargo --version</code></pre>
<h3>2. Build Leo from Source Code</h3>
<pre><code># Download the source code
git clone https://github.com/ProvableHQ/leo
cd leo
# Build and install
cargo install --path .</code></pre>
<p>This will generate the executable at <code>~/.cargo/bin/leo</code>.</p>
<h4>To use Leo, run:</h4>
<pre><code>leo</code></pre>
</TabItem>
<p>This will generate the executable at <code>~/.cargo/bin/leo</code>.</p>
<h4>To use Leo, run:</h4>
<pre><code>leo</code></pre>
</TabItem>
</Tabs>

-----
Expand Down
28 changes: 28 additions & 0 deletions documentation/language/00_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,31 @@ id: overview
title: The Leo Language Reference
sidebar_label: Overview
---

### Statically Typed

Leo is a **statically typed language**, which means we must know the type of each variable before executing a circuit.

### Explicit Types Required

There is no `undefined` or `null` value in Leo. When assigning a new variable, **the type of the value must be
explicitly stated**.

<!-- The exception to this rule is when a new variable inherits its type from a previous variable. -->

### Pass by Value

Expressions in Leo are always **passed by value**, which means their values are always copied when they are used as
function inputs or in right sides of assignments.

## Deprecated Syntax

#### Increment and Decrement

`increment()` and `decrement()` functions are deprecated as of Leo v1.7.0.
Please use the [`Mapping::set()`](#set) function instead.

#### Finalize

`finalize` and the associated programming model is deprecated as of Leo v2.0.0.
Please use an [`async function`](#async-function) instead.
Loading

0 comments on commit bebcaee

Please sign in to comment.