Skip to content

Latest commit

 

History

History
191 lines (150 loc) · 5.58 KB

README.md

File metadata and controls

191 lines (150 loc) · 5.58 KB

NEBYTE

Nebula (Early Alpha Release v1.0.0)

Maintainer Made with Rust License

Nebula is a blockchain-based system featuring wallet management, transaction processing, a consensus engine with staking, neuron-based governance, modular canister execution, and dynamic node registration. It is a personal, non-commercial learning project inspired by ICP's architecture and is not intended for production use.

Table of Contents

Features

  • Wallet Management: Create and manage wallets with secure keys.
  • Transaction Processing: Build, sign, and submit transactions.
  • Consensus Engine: Validator selection, block production, and ledger management.
  • Governance: Neuron-based proposals and weighted voting.
  • Nervous System: Neuron creation, locking, and stake delegation.
  • Staking: Secure staking and unstaking of tokens via canisters.
  • Canisters: Modular execution of on-chain functions.
  • Node Registry: Dynamic node registration and configuration via a registry.

Whitepaper

Whitepaper Link

Nebula - Whitepaper.pdf

Installation

Prerequisites

  • Rust (latest stable) + Nightly
  • Cargo

Clone the Repository

git clone https://github.com/rustyspottedcatt/nebula.git
cd nebula

Build the Project

cargo build --release

Run the Application

For example, to run a node called node1:

cargo run node1

Configuration

Nebula uses a configuration file (config.toml) to set parameters for nodes and network settings.

config.toml

[node1]
name = "NebulaNode1"
port = 30333
initial_balance = 1000
db_path = "data/nodes/nebula_storage_node1"
data_center_owner = "Owner A"
fiber_state = "Operational"
location = "Location A"
node_provider = "Provider A"
status = "active"
node_provider_id = "provider-id-001"
node_operator_id = "operator-id-001"
subnet_id = "subnet-001"
ip_address = "127.0.0.1"

Example Production Usage:

[node1]
name = "NebulaNode1"
port = 30333
initial_balance = 1000
db_path = "data/nodes/nebula_storage_node1"
data_center_owner = "Owner A"
fiber_state = "Operational"
location = "Location A"
node_provider = "Provider A"
status = "active"
node_provider_id = "provider-id-001"
node_operator_id = "operator-id-001"
subnet_id = "subnet-001"
ip_address = "127.0.0.1"

[node2]
name = "NebulaNode2"
port = 30334
initial_balance = 1000
db_path = "data/nodes/nebula_storage_node2"
data_center_owner = "Owner B"
fiber_state = "Operational"
location = "Location B"
node_provider = "Provider B"
status = "active"
node_provider_id = "provider-id-002"
node_operator_id = "operator-id-002"
subnet_id = "subnet-002"
ip_address = "127.0.0.1"

[network]
bootstrap_nodes = ["127.0.0.1:30333", "127.0.0.1:30334"]

Usage

Wallet Management

use crate::core::api::v1::wallet::create_wallet;
let wallet = create_wallet(db.clone());
println!("Wallet created: {}", wallet.address);

Transaction Processing (Using Canisters)

use crate::core::canister::canister::{Canister, CanisterFunctionPayload};
let mut canister = Canister::new("transaction_canister".to_string(), sender_address.clone(), db.clone());
let result = canister.execute_function(CanisterFunctionPayload::Transfer { amount: 50, sender: sender_address, receiver: receiver_address });
println!("Transaction result: {:?}", result);

Staking (Using Canisters)

let mut canister = Canister::new("staking_canister".to_string(), sender_address.clone(), db.clone());
let result = canister.execute_function(CanisterFunctionPayload::Stake { neuron_id: 12345, amount: 500 });
println!("Staking Result: {:?}", result);

Unstaking (Using Canisters)

let result = canister.execute_function(CanisterFunctionPayload::Unstake { neuron_id: 12345, amount: 200 });
println!("Unstaking Result: {:?}", result);

Node Registry

use crate::core::node::{NodeRegistry, Node};
let node_registry = NodeRegistry::new(db.clone());
let node = Node {
    data_center_owner: "Owner A".to_string(),
    fiber_state: "Operational".to_string(),
    dc_id: "node1".to_string(),
    location: "Location A".to_string(),
    node_provider: "Provider A".to_string(),
    status: "active".to_string(),
    node_provider_id: "provider-id-001".to_string(),
    node_operator_id: "operator-id-001".to_string(),
    subnet_id: "subnet-001".to_string(),
    ip_address: "127.0.0.1".to_string(),
};
node_registry.register_node(node);

License

Distributed under the GNU AGPLv3 license.