Skip to content

Commit

Permalink
Merge branch 'master' into ms/issue-2814
Browse files Browse the repository at this point in the history
  • Loading branch information
mqxf committed Nov 12, 2023
2 parents ac0c15e + 9cf1258 commit c0eed33
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 47 deletions.
96 changes: 49 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
</a>
</p>

<h4 align="center">
Gear is a Substrate-based smart-contract platform allowing anyone to run dApp in a few minutes.
</h4>
<h3 align="center">
Gear Protocol is a Substrate-based solution for developers, enabling anyone to run a dApp in just a few minutes.
</h3>

#

<div align="center">

[![CI][c1]][c2]
Expand All @@ -35,19 +35,19 @@ Gear is a Substrate-based smart-contract platform allowing anyone to run dApp in
[l2]: https://github.com/gear-tech/gear/blob/master/LICENSE
</div>

<p align="center">Hit the <a href="https://github.com/gear-tech/gear">:star:</a> button to keep up with our daily progress!</p>
<p align="center">Hit the <a href="https://github.com/gear-tech/gear">:star:</a> button to keep up with daily protocol's development progress!</p>

# Getting Started

1. :open_hands: The easiest way to get started with Gear is by using the demo environment at [https://idea.gear-tech.io](https://idea.gear-tech.io).
1. :open_hands: The easiest way to get started with Gear Protocol is by using the demo environment at [https://idea.gear-tech.io](https://idea.gear-tech.io).

2. :wrench: Follow the instructions from ["Getting started in 5 minutes"](https://wiki.gear-tech.io/docs/getting-started-in-5-minutes/) to compile the Rust test smart contract to Wasm. :running: Upload and run smart contract in Vara Network Testnet via [Gear Idea](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara-network.io), send a message to a program, check how it is going.
2. :wrench: Follow the instructions from ["Getting started in 5 minutes"](https://wiki.gear-tech.io/docs/getting-started-in-5-minutes/) to compile the Rust test program to Wasm. :running: Upload and run the program on the Vara Network Testnet via [Gear Idea](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara-network.io), send a message to a program, check how it is going.

3. :scroll: Write your own smart contract or choose one from the available comprehensive [examples](https://github.com/gear-foundation/dapps) for a convenient and swift onboarding process.
3. :scroll: Write your own program or use one from the comprehensive [examples library](https://github.com/gear-foundation/dapps) as a basis for a convenient and swift onboarding process.

4. :computer: Download and run your Gear node locally or create your own multi-node local testnet.

5. :dolphin: Deep dive to the [Smart Contracts section](https://wiki.gear-tech.io/docs/developing-contracts/introduction) of the Gear Wiki for more details about how to implement and run your dApp in Gear.
5. :dolphin: Deep dive to the [Examples section](https://wiki.gear-tech.io/docs/developing-contracts/introduction) of the Gear Wiki for more details about how to implement and run your dApp with Gear.

## Run Gear Node

Expand All @@ -66,108 +66,110 @@ Gear node can run in a single Dev Net mode or you can create a Multi-Node local
- **Linux x64**: [gear-nightly-x86_64-unknown-linux-gnu.tar.xz](https://get.gear.rs/gear-nightly-x86_64-unknown-linux-gnu.tar.xz)
- **Windows x64**: [gear-nightly-x86_64-pc-windows-msvc.zip](https://get.gear.rs/gear-nightly-x86_64-pc-windows-msvc.zip)

2. Run Gear node without special arguments to get a node connected to the testnet:
2. Run Gear node without special arguments to get a node connected to the test network:

```bash
gear
```

3. One may run a local node in development mode for testing purposes. This node will not be connected to any external network. Use `--dev` argument for running the node locally and storing the state in temporary storage:
3. Connect to the Vara network:

```bash
gear --chain=vara
```

4. One may run a local node in development mode for testing purposes. This node will not be connected to any external network. Use `--dev` argument for running the node locally and storing the state in temporary storage:

```bash
gear --dev
```

4. Get more info about usage details, flags, available options and subcommands:
5. Get more info about usage details, flags, available options and subcommands:

```bash
gear --help
```

## Implement and run your own blockchain application

1. Visit the [Gear Wiki](https://wiki.gear-tech.io/docs/examples/prerequisites) to explore dApp examples in action and gain a deeper understanding of their functionalities. Write your own smart contract or take one from the available templates. Adapt a template in accordance with your business needs.
1. Visit the [Gear Wiki](https://wiki.gear-tech.io/docs/examples/prerequisites) to explore dApp examples in action and gain a deeper understanding of their functionalities. Write your own program or take one from the available templates. Adapt a template in accordance with your business needs.

2. Test your smart contract off-chain, test it on-chain using a local node, then upload to Gear-powered network via [Gear Idea](https://idea.gear-tech.io/).
2. Test your program off-chain, test it on-chain using a local node, then upload to Gear-powered network via [Gear Idea](https://idea.gear-tech.io/).

3. Implement frontend applications that interact with your smart contracts using [JS API](https://github.com/gear-tech/gear-js/tree/main/api). React application examples are available [here](https://github.com/gear-foundation/dapps/tree/master/frontend).
3. Implement frontend application that interacts with your program using [JS API](https://github.com/gear-tech/gear-js/tree/main/api). React application examples are available [here](https://github.com/gear-foundation/dapps/tree/master/frontend).

# Gear components
# Gear Protocol components

* [core](https://github.com/gear-tech/gear/tree/master/core) - Gear engine for distributed computing core components.
* [core](https://github.com/gear-tech/gear/tree/master/core) - engine for distributed computing core components.

* [node](https://github.com/gear-tech/gear/tree/master/node) - Gear substrate-based node, ready for hacking :rocket:.
* [node](https://github.com/gear-tech/gear/tree/master/node) - substrate-based node, ready for hacking :rocket:.

* [gstd](https://github.com/gear-tech/gear/tree/master/gstd) - Standard library for Gear smart contracts.
* [gstd](https://github.com/gear-tech/gear/tree/master/gstd) - standard library for implementing programs with Gear Protocol.

* [gear-js](https://github.com/gear-tech/gear-js/tree/main/api) - JSON-RPC API of Gear backend.
* [gtest](https://github.com/gear-tech/gear/tree/master/gtest) - fast and lightweight tool for debugging program logic.

* [gclient](https://github.com/gear-tech/gear/tree/master/gclient) - a tool for testing programs with a real blockchain network.

* [examples](https://github.com/gear-foundation/dapps) - Smart contract examples.
* [gear-js](https://github.com/gear-tech/gear-js/tree/main/api) - JSON-RPC API of Gear backend.

Go to https://docs.gear.rs to dive into the documentation on Gear crates.
Go to https://docs.gear.rs to dive into the documentation on Gear Protocol crates.

# What does Gear do?
# What does Gear Protocol do?

<p align="center">
<img src="images/rust.png" height="64"><br>Gear provides the easiest and most cost-effective way <br>to run WebAssembly programs (smart-contracts) compiled from <br>many popular languages, such as Rust, C/C++ and more.
<img src="images/rust.png" height="64"><br>Gear Protocol provides the easiest and most cost-effective way <br>to run Wasm programs compiled from <br>many popular languages, such as Rust, C/C++ and more.
</p>
<p align="center">
<img src="images/api.png" height="64"><br>Gear ensures very minimal, intuitive, and sufficient API <br>for running both newly written and existing programs <br>on multiple networks without the need to rewrite them.
<img src="images/api.png" height="64"><br>It ensures very minimal, intuitive, and sufficient API <br>for running both newly written and existing programs <br>on multiple Gear-powered networks without the need to rewrite them.
</p>
<p align="center">
<img src="images/state.png" height="64"><br>Smart Contracts are stored in the blockchain’s state <br>and are invoked preserving their state upon request.
<img src="images/state.png" height="64"><br>Programs are stored in the blockchain’s state <br>and are invoked preserving their state upon request.
</p>
<p align="center">
<img src="images/apps.png" height="64"><br>Gear facilitates a seamless transition to Web3, <br>enabling the operation of dApps, microservices, middleware, and open APIs.
<img src="images/apps.png" height="64"><br>Gear Protocol facilitates a seamless transition to Web3, <br>enabling the operation of dApps, microservices, middleware, and open APIs.
</p>

### :fire: Key features

- Programs run in Wasm VM (near-native code execution speed)
- **Unique** :crown: : Parallelizable architecture (even greater speed)
- **Unique** :crown: : Actor model for message-passing communications - secure, effective, clear
- dApp in minutes using Gear libraries
- **Unique** :crown: : Continued messaging automation, payless transactions, and other features enable the implementation of truly on-chain user-friendly dApps.
- **Unique** :crown: : dApp in minutes using Gear Protocol's libraries
- Based on Substrate
### Main capabilities
Gear enables anyone to create and run any custom-logic dApp and is a go-to solution for the following types of applications:
- **Run dApps** that support business logic of any project in the **decentralized Gear network** (such as the [Vara Network](https://vara-network.io/)). Upload programs to the network and interact with them.
- Being a **Polkadot parachain**, Gear establishes cross-chain communications between other blockchains, allowing anyone to run a dApp in the Polkadot network in a very **cost-less** manner.
- Join Substrate-supported blockchains in any other platform outside Polkadot.
- A standalone instance running microservices, middleware, open API and more
- Gear Protocol enables anyone to create and run a custom-logic **decentralized programs**.
- Programs can support business logic of any other projects running in the **Gear-powered network** (such as the [Vara Network](https://vara-network.io/)) and interact with them.
- Establish cross-chain communications between other Substrate-supported blockchains, allowing anyone to run a dApp in the Dotsama ecosystem in a very **cost-less** manner.
- A Gear node can run as a standalone instance running microservices, middleware, open API and more.
# Why?
# Why?
The blockchain technology launched a rapid transition from centralized, server-based internet (Web2) to decentralized, distributed one (Web3).
Web3 introduces a new type of decentralized applications (dApps) that enable the existence of DeFi, DEX, Decentralized marketplaces, NFTs, Creators and Social Tokens.
Web3 introduces a new type of applications (dApps) that enable the existence of decentralized Gaming, DeFi, DEX, Decentralized marketplaces, NFTs, Creators and Social Tokens.
Smart Contract is an equivalent of a microservice which is stored on the blockchain network and is the essential building block of a decentralized application.
Programs running on the blockchain network can serve as the equivalent of microservices, which are the essential building blocks of decentralized applications.
Modern blockchains solve many issues of the older blockchain networks, such as:
- Lack of scalability, low transaction speed, high transaction costs
- Domain-specific development language (high barrier to entry)
- Complex and inefficient native consensus protocols
- Absence of intercommunication tools
But still have room for improvements due to:
- Fixated, rigid native consensus protocols
But the room for improvements remains related to:
- Optimisation of the user experience when using Web3 applications
- Lack of interoperability with other networks
To resolve the interoperability issue, Parity technologies focused on creating a technology that connects every other blockchain:
- Polkadot - a blockchain of blockchains. Provides a “relay chain” (the primary blockchain) that enables “parachains” (functional blockchains) to be deployed on top of it. All parachains are interconnected, creating a massive network of multifunctional blockchain services.
- Substrate - a modular framework that allows to create custom-built blockchains with consensus mechanism, core functionality and security out of the box.

Building a blockchain with Substrate allows it to be deployed on any compatible relay chain such as Polkadot and Kusama. Substrate serves as a layer of communication between the relay chain and the parachain.

# How does it work?
The internal flow of Gear:
The internal flow of Gear Protocol:
<img src="images/internal_flow.jpg" alt="Snow" style="width:100%;">
Refer to the <a href="https://github.com/gear-tech/gear-technical/blob/master/TECHNICAL.pdf">technical paper</a> for some insights about how Gear works internally.
Refer to the <a href="https://github.com/gear-tech/gear-technical/blob/master/TECHNICAL.pdf">technical paper</a> for some insights about how it works internally.
# Performance
Expand All @@ -180,7 +182,7 @@ Here are some features in progress or planned: https://github.com/gear-tech/gear
# License
Gear is licensed under [GPL v3.0 with a classpath linking exception](LICENSE).
Gear Protocol is licensed under [GPL v3.0 with a classpath linking exception](LICENSE).
##
Expand Down
2 changes: 2 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

#[macro_use]
extern crate gear_common_codegen;
Expand Down
2 changes: 2 additions & 0 deletions core-errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#![no_std]
#![warn(missing_docs)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions core-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#![warn(missing_docs)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#![warn(missing_docs)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions galloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#![no_std]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

// until https://github.com/alexcrichton/dlmalloc-rs/pull/26 is merged
#[cfg(not(windows))]
Expand Down
1 change: 1 addition & 0 deletions gclient/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
#![warn(missing_docs)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

mod api;
mod utils;
Expand Down
1 change: 1 addition & 0 deletions gcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#![warn(missing_docs)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]
#![doc(test(attr(deny(warnings), allow(unused_variables, unused_assignments))))]

extern crate alloc;
Expand Down
1 change: 1 addition & 0 deletions gmeta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
#![no_std]
#![warn(missing_docs)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

extern crate alloc;

Expand Down
3 changes: 3 additions & 0 deletions gsdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

//! Gear api
pub use crate::{
api::Api,
Expand Down
1 change: 1 addition & 0 deletions gstd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
#![cfg_attr(target_arch = "wasm32", feature(alloc_error_handler))]
#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]
#![doc(test(attr(deny(warnings), allow(unused_variables, unused_assignments))))]

extern crate alloc;
Expand Down
2 changes: 2 additions & 0 deletions gtest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
//! assert_eq!(prog.balance(), 1000);
//! ```
#![deny(missing_docs)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

mod error;
mod log;
Expand Down
Binary file modified images/internal_flow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/title-grey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lazy-pages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
//! It's not necessary behavior, but more simple and safe.
#![allow(clippy::items_after_test_module)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use common::{LazyPagesExecutionContext, LazyPagesRuntimeContext};
use gear_core::pages::{PageDynSize, PageNumber, PageSizeNo, WasmPage};
Expand Down
2 changes: 2 additions & 0 deletions pallets/gas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
//! The Gear Gas Pallet doesn't depend on the `GenesisConfig`.
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use common::{
storage::{MapStorage, ValueStorage},
Expand Down
2 changes: 2 additions & 0 deletions pallets/gear-messenger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
//! length overflow (see Gear Payment Pallet).
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

// Runtime mock for running tests.
#[cfg(test)]
Expand Down
2 changes: 2 additions & 0 deletions pallets/gear-program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
//! The Gear Program Pallet doesn't depend on the `GenesisConfig`.
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use sp_std::{convert::TryInto, prelude::*};

Expand Down
2 changes: 2 additions & 0 deletions pallets/gear-scheduler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//! # Gear Scheduler Pallet
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

// Runtime mock for running tests.
#[cfg(test)]
Expand Down
2 changes: 2 additions & 0 deletions pallets/gear/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

pub use pallet_gear::{manager::HandleKind, GasInfo};
use sp_core::H256;
Expand Down
2 changes: 2 additions & 0 deletions pallets/gear/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#![allow(clippy::too_many_arguments)]
#![allow(where_clauses_object_safety)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use gear_common::Origin;
use gear_core::ids::{CodeId, MessageId, ProgramId};
Expand Down
2 changes: 2 additions & 0 deletions pallets/gear/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "runtime-benchmarks", recursion_limit = "1024")]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

extern crate alloc;

Expand Down
2 changes: 2 additions & 0 deletions pallets/payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use common::{storage::*, ExtractCall};
use frame_support::{
Expand Down
4 changes: 4 additions & 0 deletions utils/wasm-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(feature = "strict", deny(warnings))]
#![doc(html_logo_url = "https://docs.gear.rs/logo.svg")]
#![doc(html_favicon_url = "https://gear-tech.io/favicons/favicon.ico")]

use crate::{cargo_command::CargoCommand, cargo_toolchain::Toolchain, wasm_project::WasmProject};
use anyhow::{Context, Result};
use gmeta::{Metadata, MetadataRepr};
Expand Down

0 comments on commit c0eed33

Please sign in to comment.