Crate phronesis

source ·
Expand description




§Reference implementation of PhronAI

Discord chat Telegram Group Follow on Twitter Follow on Medium

§About PhronAI

PhronAI revolutionizes blockchain technology by integrating AI capabilities directly into the foundational Layer 0. This approach enhances traditional principles of decentralization, security, and scalability. AI algorithms enable dynamic consensus, predictive security, and adaptive scalability, allowing the network to respond efficiently to real-time conditions.

PhronAI’s AI-based Layer 1 advances smart contract execution through machine learning, optimizing contract performance, predicting vulnerabilities, and adjusting gas fees dynamically. This leads to more efficient and secure transaction processing.

Key innovations include Adaptive AI Staking (AAIS) and Node - Block-Sharing (NBS), which improve node rewards and Layer 1 bootstrapping. An AI arbiter in governance voting addresses user voting power issues. Through its advanced design and architecture, PhronAI showcases the transformative impact of AI on blockchain technology.

§Getting Started

Depending on your operating system and Rust version, there might be additional packages required to compile this node. Check the Install instructions for your platform for the most common dependencies. Alternatively, you can use one of the alternative installation options.

§Build

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

cargo build --release

§Multi-Node Local Testnet

You can start a local testnet with multiple validator nodes using the ./scripts/run_nodes.sh script. This script will build the node and then use it to launch a local testnet with six validator nodes and a single RPC node.

§Docuemntation

Documentation can be generated using the following command, and is regularly deployed to the gh-pages branch of the repository:

./scripts/docs.sh

§Manual Deployment

The following steps are required to deploy the node manually, if you do not want to use the provided scripts.

  • Build the node binary cargo build --release --features=short_session
  • Bootstrap the chain to provide a genesis state and a set of committee accounts:
./target/release/phronesis bootstrap-chain --account-ids "f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac,C8742A5fBb4e5db67c50d326Ee7F7b846A842642,3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0,798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"\
 --chain-type local \
 --base-path run-nodes-local/ > chainspec-local.json

We are going to use 4 committee member at the genesis.

  • Bootstrap an RPC node to provide a public interface to the chain:
./target/release/phronesis bootstrap-node --base-path run-nodes-local/ --account-id "C0F0f4ab324C46e55D02D0033343B4Be8A55532d" --chain-type local > /dev/null
  • Generate a bootnode p2p multiaddress to be used by the validator (and RPC) nodes:
./target/release/phronesis key inspect-node-key --file run-nodes-local/0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d/p2p_secret
  • Start the RPC node:
./target/release/phronesis --validator \
    --public-validator-addresses "127.0.0.1:30343" \
    --chain chainspec-local.json \
    --base-path ./run-nodes-local/0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d/ \
    --name RPC \
    --rpc-port 9933 \
    --port 30333 \
    --validator-port 30343 \
    --node-key-file "./run-nodes-local/0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d/p2p_secret" \
    --rpc-cors=all \
    --pool-limit 1024 \
    --db-cache 1024 \
    --runtime-cache-size 2 \
    --max-runtime-instances 8 \
    --enable-log-reloading \
    --detailed-log-output \
    --bootnodes /dns4/localhost/tcp/30333/p2p/{bootnode_p2p_multiaddress}
  • Start the validator nodes:
1:
./target/release/phronesis --validator \
    --public-validator-addresses "127.0.0.1:30344" \
    --chain chainspec-local.json \
    --base-path ./run-nodes-local/0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac/ \
    --name node-1 \
    --rpc-port 9934 \
    --port 30334 \
    --validator-port 30344 \
    --node-key-file "./run-nodes-local/0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac/p2p_secret" \
    --rpc-cors=all \
    --pool-limit 1024 \
    --db-cache 1024 \
    --runtime-cache-size 2 \
    --max-runtime-instances 8 \
    --enable-log-reloading \
    --detailed-log-output \
    --bootnodes /dns4/localhost/tcp/30333/p2p/{bootnode_p2p_multiaddress}


2:

/target/release/phronesis --validator \
    --public-validator-addresses "127.0.0.1:30345" \
    --chain chainspec-local.json \
    --base-path ./run-nodes-local/0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0/ \
    --name node-2 \
    --rpc-port 9935 \
    --port 30335 \
    --validator-port 30345 \
    --node-key-file "./run-nodes-local/0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0/p2p_secret" \
    --rpc-cors=all \
    --pool-limit 1024 \
    --db-cache 1024 \
    --runtime-cache-size 2 \
    --max-runtime-instances 8 \
    --enable-log-reloading \
    --detailed-log-output \
    --bootnodes /dns4/localhost/tcp/30333/p2p/{bootnode_p2p_multiaddress}

3:

./target/release/phronesis --validator \
    --public-validator-addresses "127.0.0.1:30346" \
    --chain chainspec-local.json \
    --base-path ./run-nodes-local/0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc/ \
    --name node-3 \
    --rpc-port 9936 \
    --port 30336 \
    --validator-port 30346 \
    --node-key-file "./run-nodes-local/0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc/p2p_secret" \
    --rpc-cors=all \
    --pool-limit 1024 \
    --db-cache 1024 \
    --runtime-cache-size 2 \
    --max-runtime-instances 8 \
    --enable-log-reloading \
    --detailed-log-output \
    --bootnodes /dns4/localhost/tcp/30333/p2p/{bootnode_p2p_multiaddress}

4:

./target/release/phronesis --validator \
    --public-validator-addresses "127.0.0.1:30347" \
    --chain chainspec-local.json \
    --base-path ./run-nodes-local/0xC8742A5fBb4e5db67c50d326Ee7F7b846A842642/ \
    --name node-4 \
    --rpc-port 9937 \
    --port 30337 \
    --validator-port 30347 \
    --node-key-file "./run-nodes-local/0xC8742A5fBb4e5db67c50d326Ee7F7b846A842642/p2p_secret" \
    --rpc-cors=all \
    --pool-limit 1024 \
    --db-cache 1024 \
    --runtime-cache-size 2 \
    --max-runtime-instances 8 \
    --enable-log-reloading \
    --detailed-log-output \
    --bootnodes /dns4/localhost/tcp/30333/p2p/{bootnode_p2p_multiaddress}

§EVM Account testnet

dd7073324b34a21e2b585d2a71717e5b9368d0f6367b5c366e64c8446d20ab8e

Modules§

  • chain_spec 🔒
  • cli 🔒
  • command 🔒
  • phron_cli 🔒
  • rpc 🔒
    A collection of node-specific RPC methods. Substrate provides the sc-rpc crate, which defines the core RPC layer used by Substrate nodes. This file extends those RPC definitions with capabilities that are specific to this project’s runtime configuration.
  • service 🔒
    Service and ServiceFactory implementation. Specialized wrapper over substrate service.

Structs§

Enums§

Functions§

Type Aliases§