P2P Network to verify authorship & ownership, store & deliver proofs.

Overview

Anagolay Network Node

Anagolay is a next-generation framework for ownerships, copyrights and digital licenses. πŸš€

Local Development

The installation assumes you are running Debian 10. This will install all the needed deps.

# OPTIONAL -- install this only if you are missing the system dependencies
sudo ./scripts/01-install-system-dependencies.sh

# MANDATORY -- this sets up the toolchains and rust
./scripts/02-setup-toolchain.sh

# MANDATORY -- Installs the additional packages for better Developer Experience (DX)
./scripts/03-install-cargo-packages.sh

# OPTIONAL [HIGHLY RECOMMENDED]-- For better DX while developing the project + some goodies like cargo-cache
./scripts/99-install-dev-cargo-packages.sh

# Initialize the git hooks described in the rusty-hooks.toml
rusty-hook init

Speeding up your build times with cachepot and local driver

Before continuing check that your RUSTC_WRAPPER is not set by running this command:

echo $RUSTC_WRAPPER

If the output is something than blank line run this:

unset RUSTC_WRAPPER

Now we can start installing it and setting it up. Follow the code snippet to get it installed:

# Install the cachepot
cargo install --git https://github.com/paritytech/cachepot

After that's done open your .zshrc or .bashrc and add following at the end of the file:

# this will pick up the location of the installation
export CACHEPOT_DIR="$HOME/.cache/cachepot"

# recommended location for the caches
export RUSTC_WRAPPER="$HOME/.cargo/bin/cachepot"

# reload your shell

## plain old sourcing
source ~/.zshrc
#or
source  ~/.bashrc

# if you are using the zsh4humans ignore sourcing above and execute this
exec zsh

To test that we have correctly installed the cachepot we need to compile the project.

cargo make check && cachepot -s

If everything is ok, you should see statistics about your cache.

Testing, building and available commands

We are using the cargo-make crate to automate scripts and make them easier to maintain and execute. All scripts are semantically named and cargo top level commands are the same.

Here is the list of currently available tasks which you can run by cargo make TASK_NAME:

Task name description
fmt Formats the code using the cargo fmt
fmt-check Checks the code using the cargo fmt -- --check
check Check a anagolay node and all of its dependencies for errors.
clean Remove generated artifacts, namely anagolay.
build Compile the Anagolay runtime in debug mode. Accepts any valid build arguments.
build-release Compile the Anagolay runtime in release mode. Accepts any valid build arguments.
build-release-benchmarks Compile the Anagolay runtime in release mode with feature flag for benchmarks.
test Execute unit and integration tests of a anagolay node. Accepts any valid cargo test arguments.
test-benchmarking Execute unit and integration tests of a anagolay node with flags enabled for testing benchmarks.
chain-dev-purge Purge the local chain database for debug build.
chain-dev-start Starts the chain in dev mode with sane default flags.
ci-flow Experimental ci-flow which runs the checks in single run instead many.

VsCode

For your convenience we provide the settings, recommended extensions and devcontainer. Feel free to use it and report any issues you face.

Security and code quality

To create the Anagolay node you need to have latest version of the base image anagolay/rust-ci which you can get it from DockerHub

Scanning for the vulnerabilities using builtin Docker scan:

docker scan --file Dockerfile --exclude-base anagolay/node:0.2.1-dev

Audit the code using the Cargo Audit:

# check the security
cargo audit

Build Code coverage:

cargo tarpaulin --output-dir coverage --out html

Trivy docker conatiner scaning

docker pull aquasec/trivy:0.16.0
docker run --rm -v /tmp/trivy/:/root/.cache/ aquasec/trivy:0.16.0  anagolay/node:0.2.1-dev

Creating the docker images

Building the Rust-CI base image. This image is used as a CI image on gitlab and as a base builder image for the anagolay node. To change the version edit the .env file variable RUST_IMAGE_VERSION.

This is quite big image :

anagolay/rust-ci       0.1.0                9724ca9f4474   3 minutes ago    3.09GB
anagolay/rust-ci       latest               9724ca9f4474   3 minutes ago    3.09GB

TODO: pick up the correct version from runtime/Cargo.toml

docker-compose -f rust-ci-docker-compose.yml build
docker-compose -f rust-ci-docker-compose.yml push

To build the Anagolay Node you should:

  1. have the latest base image
  2. change the correct version in .env file
  3. run the script
# build it
docker-compose build node

# push it
docker-compose push node

Running in dev mode

cargo make chain-dev-start

Testing

To test the full suite run cargo make test

Benchmarking

To generate pallet weights run from the root of the project. Use the folder name for the pallet. It will add the an_ prefix to it. This script will compile the node for you and run the benchmarks.

# TEMPLATE  ./scripts/run-benchmarks.sh CHAIN PALLET $RUN_WITH_BUILD[true << default |false]

# PoE
./scripts/run-benchmarks.sh dev poe false # this will not build it it will only run it

# Rules
./scripts/run-benchmarks.sh dev rules # this will build it and run it

# Operations
./scripts/run-benchmarks.sh dev operations


# All pallets and all extrinsics with the release build
./scripts/run-all-benchmarks.sh dev

# All pallets and all extrinsics without the release build
./scripts/run-all-benchmarks.sh dev false

NOTES

Failing cachepot

One of the fastest ways is to unset RUSTC_WRAPPER and run the commands again. If you are doing cargo make build, and you unset the RUSTC_WRAPPER then the command should finish normally, but it will take longer time.

https://github.com/scs/substrate-api-client/blob/master/test_no_std/Cargo.toml

find . -name "\*.sh" -exec chmod +x {} \;

export COMPOSE_DOCKER_CLI_BUILD=0 && export DOCKER_BUILD=0 && export DOCKER_BUILDKIT=0 export COMPOSE_DOCKER_CLI_BUILD=1 && export DOCKER_BUILD=1 && export DOCKER_BUILDKIT=1

Update the *.sh in scripts to be executable. Do this after you use the chmod +x ./script.sh

git ls-files -z scripts/*.sh | xargs -0 git update-index --chmod=+x
You might also like...
Thaler's Proofs, Args, and ZK Implemented in Rust using arkworks
Thaler's Proofs, Args, and ZK Implemented in Rust using arkworks

rthaler β€’ Dr. Thaler's book Proofs, Args, and ZK implemented in rust using the arkworks cryptographic rust toolset. Various Zero Knowledge Protocols a

Safeguard your financial privacy with zero-knowledge proofs.

Spinner The Spinner project (https://spinner.cash) takes a privacy first approach to protect users crypto assets. It is a layer-2 protocol built on th

STARK - SNARK recursive zero knowledge proofs, combinaison of the Winterfell library and the Circom language

STARK - SNARK recursive proofs The point of this library is to combine the SNARK and STARK computation arguments of knowledge, namely the Winterfell l

Rust based Virtual Machine on Avalanche that implements Bulletproof ZK Proofs.

BulletproofVM Rust based Virtual Machine on Avalanche that implements Bulletproof ZK Proofs. Zero-Knowledge Virtual Machine This is a virtual machine

Common protocol for generating ZK proofs for blocks on different blockchains.

Proof Protocol Decoder A flexible protocol that clients (eg. full nodes) can use to easily generate block proofs for different chains. Specification I

The Zero Knowledge Whitelist Tool is a powerful utility for managing an address whitelist using Zero-Knowledge (ZK) proofs.
The Zero Knowledge Whitelist Tool is a powerful utility for managing an address whitelist using Zero-Knowledge (ZK) proofs.

zk_whitelist: A Zero Knowledge Whitelist Tool The Zero Knowledge Whitelist Tool is a powerful utility for managing an address whitelist using Zero-Kno

A sparse merkle tree lib focused on efficient on-chain proofs. Enforces ordering within the merkle tree.

sparse-merkle-tree The merkle tree functions are located in sparse.ak. Currently the supported functionality is: Verifying a new root with an added me

A fully p2p cli chat utility written in rust.

P2P Chat Client This is a simple demonstration of a peer to peer chat client, written entirely in rust utilising the libp2p library. Demo On two seper

NAT Traversal techniques for p2p communication

P2P NAT-Traversal Crate Documentation Linux/OSX/Windows The goal of this crate is to provide a robust and crypto-secure NAT traversal for peer to peer

Comments
  • Bump lz4-sys from 1.9.3 to 1.9.4

    Bump lz4-sys from 1.9.3 to 1.9.4

    Bumps lz4-sys from 1.9.3 to 1.9.4.

    Changelog

    Sourced from lz4-sys's changelog.

    1.24.0:

    • Update to lz4 1.9.4 (lz4-sys 1.9.4) - this fixes CVE-2021-3520, which was a security vulnerability in the core lz4 library
    • export the include directory of lz4 from build.rs

    1.23.3 (March 5, 2022):

    • Update lz4 to 1.9.3
    • Add [de]compress_to_buffer to block API to allow reusing buffers (#16)
    • Windows static lib support
    • Support favor_dec_speed
    • Misc small fixes

    1.23.2:

    • Update lz4 to 1.9.2
    • Remove dependency on skeptic (replace with build-dependency docmatic for README testing)
    • Move to Rust 2018 edition

    1.23.0:

    • Update lz4 to v1.8.2
    • Add lz4 block mode api

    1.22.0:

    • Update lz4 to v1.8.0
    • Remove lz4 redundant dependency to gcc #22 (thanks to Xidorn Quan)

    1.21.1:

    • Fix always rebuild issue #21

    1.21.0:

    • Fix smallest 11-byte stream decoding (thanks to Niklas HambΓΌchen)
    • Update lz4 to v1.7.5

    1.20.0:

    • Split out separate sys package #16 (thanks to Thijs Cadier)

    1.19.173:

    • Update lz4 to v1.7.3

    1.19.131:

    • Update dependencies for correct work with change build environmet via rustup override

    1.18.131:

    • Implemented Send for Encoder/Decoder #15 (thanks to Maxime Lenoir)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump thread_local from 1.1.3 to 1.1.4

    Bump thread_local from 1.1.3 to 1.1.4

    Bumps thread_local from 1.1.3 to 1.1.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump regex from 1.5.4 to 1.5.5

    Bump regex from 1.5.4 to 1.5.5

    Bumps regex from 1.5.4 to 1.5.5.

    Changelog

    Sourced from regex's changelog.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump zeroize_derive from 1.1.0 to 1.3.2

    Bump zeroize_derive from 1.1.0 to 1.3.2

    Bumps zeroize_derive from 1.1.0 to 1.3.2.

    Changelog

    Sourced from zeroize_derive's changelog.

    Changelog

    All notable changes to this project will be documented in this file.

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    1.5.5 (2022-04-30)

    Added

    • Impl Zeroize for std::ffi::CString (#759)
    • AsRef<T> and AsMut<T> impls for Zeroizing (#761)

    #759: RustCrypto/utils#759 #761: RustCrypto/utils#761

    1.5.4 (2022-03-16)

    Added

    • Nightly-only upport for zeroizing ARM64 SIMD registers (#749)

    #749: RustCrypto/utils#749

    1.5.3 (2022-02-25)

    Fixed

    • Deriving ZeroizeOnDrop on DerefMut (#739)

    #739: RustCrypto/utils#739

    1.5.2 (2022-01-31) [YANKED]

    Fixed

    • Ambiguous method for AssertZeroizeOnDrop (#725)

    #725: RustCrypto/utils#725

    1.5.1 (2022-01-27) [YANKED]

    Fixed

    • Double mut on AssertZeroizeOnDrop (#719)

    #719: RustCrypto/utils#719

    1.5.0 (2022-01-14) [YANKED]

    Added

    • Zeroize impls for PhantomData, PhantomPinned, and tuples with 0-10 elements (#660)
    • #[zeroize(bound = "T: MyTrait")] (#663)
    • ZeroizeOnDrop trait and custom derive (#699, #700, #703)

    #660: RustCrypto/utils#660 #663: RustCrypto/utils#663 #699: RustCrypto/utils#699 #700: RustCrypto/utils#700 #703: RustCrypto/utils#703

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Owner
Anagolay Network
Anagolay is a next-generation framework for ownerships, copyrights and digital licenses. πŸš€
Anagolay Network
A multiplexed p2p network framework that supports custom protocols

Tentacle Overview This is a minimal implementation for a multiplexed p2p network based on yamux that supports mounting custom protocols. Architecture

漂桁 188 Dec 19, 2022
Biddi Network enables custom p2p swaps in Solana ocean 🌊.

Peer to peer, decentralized protocol which allow direct swaps between 2 network participants for custom tokens without liquidity pools on Solana blockchain.

Biddi Network 2 Nov 1, 2022
Low-level Bitcoin P2P Network Client

Peerlink What is Peerlink? Peerlink is a low-level network client for the Bitcoin P2P network written in Rust. It uses a nonblocking reactor to accept

Alfred Hodler 6 Dec 23, 2022
Zei is a library that provide tools to create and verify public transaction with confidential data.

#Zei: Findora's Cryptographic Library Zei is a library that provide tools to create and verify public transaction with confidential data. Support: Bas

Findora Foundation 0 Oct 23, 2022
Generates Solidity code to verify EIP-712 style signatures

eip712 Generates Solidity code to verify EIP-712 style signatures. Usage First, create an abstract contract implementing the functionality you want: /

Sam Wilson 11 Dec 22, 2022
Noir implementation of RSA-verify

noir-rsa This repository contains an implementation of a RSA signature verify for the Noir language. Currently supports pkcs1v15 + sha256 and exponent

Set Labs 5 Jul 22, 2023
ZKP fork for rust-secp256k1, adds wrappers for range proofs, pedersen commitments, etc

rust-secp256k1 rust-secp256k1 is a wrapper around libsecp256k1, a C library by Peter Wuille for producing ECDSA signatures using the SECG curve secp25

null 53 Dec 19, 2022
Bulletproofs and Bulletproofs+ Rust implementation for Aggregated Range Proofs over multiple elliptic curves

Bulletproofs This library implements Bulletproofs+ and Bulletproofs aggregated range proofs with multi-exponent verification. The library supports mul

[ZenGo X] 62 Dec 13, 2022
Noir is a domain specific language for zero knowledge proofs

The Noir Programming Language Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving sy

null 404 Jan 1, 2023
The Light Protocol program verifies zkSNARK proofs to enable anonymous transactions on Solana.

Light Protocol DISCLAIMER: THIS SOFTWARE IS NOT AUDITED. Do not use in production! Tests cd ./program && cargo test-bpf deposit_should_succeed cd ./pr

null 36 Dec 17, 2022