Skip to content

About

Duniter v2 based on Substrate framework. Contributions only on our gitlab: https://git.duniter.org/nodes/rust/duniter-v2s

Topics

Resources

Contributing

Stars

17 stars

Watchers

8 watching

Forks

Latest commit

 

History

902 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duniter v2s

🆙 A rewriting of Duniter v1 in the Substrate framework.

⚠️ Duniter-v2s is under active development.

Gtest provides the runtime used to test wallets and indexers. It shares its business logic with G1.

logov2

Documentation

Multiple documentation sources are available depending on the level of detail you need.

Internal documentation TOC

Use

Run a local gtest node

Build and start a temporary chain:

scripts/run-local-chain.sh --runtime gtest

See the runtime guide for the shared implementation and test modes.

Create your local blockchain

It can be useful to deploy your local blockchain, for instance to have a controlled environment to develop/test an application that interacts with the blockchain.

docker run -it -p9944:9944 duniter/duniter-gtest:latest

Or use the docker-compose.yml at the root of this repository.

Control when your local blockchain should produce blocks

By default, your local blockchain produces a new block every 6 seconds, which is not practical in some cases.

You can decide when to produce blocks with the cli option --sealing which has two modes:

  • --sealing=instant: produce a block immediately upon receiving a transaction into the transaction pool
  • --sealing=manual: produce a block upon receiving an RPC request (method engine_createBlock).

Shell autocompletion

See autocompletion to generate shell autocompletion for duniter commands.

Contribute

If you are beginner in Rust and need a well guided tutorial, follow the beginner walkthrough.

Before any contribution, please read carefully the CONTRIBUTING file and our git conventions.

Setup your dev environment

First, complete the basic setup instructions.

Build

NOTE: You must first follow the instructions in the Setup section.

Use the following command to build the node without launching it:

cargo build

Run

Use Rust's native cargo command to build and launch the node:

cargo run -- --dev

This deploys a local blockchain with test accounts (Alice, Bob, etc) in the genesis using the default runtime (gtest).

To run a local chain with another runtime:

# gtest local chain, gt_local aliases gtest_local; sudo uses //Alice (ed25519 by default)
cargo run -p duniter --no-default-features --features gtest -- \
  --chain gt_local --validator --alice --unsafe-force-node-key-generation --sealing manual --tmp

# gtest local chain with 2 authorities (Alice and Bob)
# generate Alice's deterministic p2p key once
cargo run -p duniter --no-default-features --features gtest -- \
  key generate-node-key --file /tmp/gtest_local2_alice.nodekey
# inspect the corresponding peer ID
cargo run -p duniter --no-default-features --features gtest -- \
  key inspect-node-key --file /tmp/gtest_local2_alice.nodekey

cargo run -p duniter --no-default-features --features gtest -- \
  --chain gtest_local2 --validator --alice --unsafe-force-node-key-generation \
  --node-key-file /tmp/gtest_local2_alice.nodekey \
  --listen-addr /ip4/127.0.0.1/tcp/30333 --tmp
# the peer ID printed by `key inspect-node-key` is Alice's stable peer ID:
# <ALICE_PEER_ID>
cargo run -p duniter --no-default-features --features gtest -- \
  --chain gtest_local2 --validator --bob --unsafe-force-node-key-generation \
  --port 30334 --rpc-port 9945 --prometheus-port 9616 \
  --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/<ALICE_PEER_ID> --tmp

# same setup with the dedicated helper script
scripts/run-gtest-local2.sh alice-peer-id
scripts/run-gtest-local2.sh alice
scripts/run-gtest-local2.sh bob --alice-peer-id <ALICE_PEER_ID>

# g1 local chain
cargo run -p duniter --no-default-features --features g1 -- \
  --chain g1_local --validator --unsafe-force-node-key-generation --sealing manual --tmp

You can also use the helper script (it includes these options by default):

scripts/run-local-chain.sh --runtime gtest

Open https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944 to watch and interact with your node.

Start the development chain with detailed logging:

RUST_LOG=debug RUST_BACKTRACE=1 ./target/debug/duniter -lruntime=debug --dev

License

See LICENSE

CopyLeft 2021-2023 Axiom-Team

Some parts borrowed from Polkadot (Parity Technologies (UK) Ltd.)

Duniter-v2S is free software: you can redistribute it and/or modify
it under the terms of the **GNU Affero General Public License** as published by
the Free Software Foundation, **version 3** of the License.

Duniter-v2S is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.

About

Duniter v2 based on Substrate framework. Contributions only on our gitlab: https://git.duniter.org/nodes/rust/duniter-v2s

Topics

Resources

Contributing

Stars

17 stars

Watchers

8 watching

Forks

Used by

Contributors

Languages