Coder Social home page Coder Social logo

sbnair / subspace-core-rust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from subspace/subspace-core-rust

0.0 1.0 0.0 12.07 MB

A simple blockchain based on proofs-of-replication for the Subspace Network, implemented in pure Rust.

Rust 99.63% Dockerfile 0.37%

subspace-core-rust's Introduction

Subspace Core Rust

A simple blockchain based on proofs-of-replication for the Subspace Network, implemented in pure Rust.

Read the specifications (wip) for more details.

Install

If you have not previously installed the gmp_mpfr_sys crate, follow these instructions.

RocksDB on Linux needs LLVM/Clang:

sudo apt-get install llvm clang
git clone https://github.com/subspace/subspace-core-rust.git
cd subspace-core-rust
cargo build --release

Run Tests

cargo test

Run Benches

cargo bench

Benches single block encode/decode time and full piece encode/decode time for each prime size.

Run Node

RUST_LOG=[level] cargo run -- run node-type

RUST_LOG=info cargo run -- run gateway

RUST_LOG=info cargo run -- run peer

Environment variables

SUBSPACE_DIR

SUBSPACE_DIR can be used to specify alternative default location for plot to be created in

Each node needs a different directory for testing -- example

export SUBSPACE_DIR=~/Desktop/plots/subspace/peer0

RUN_WS_RPC

RUN_WS_RPC=1 will cause RPC server to be started on port 8880.

https://www.npmjs.com/package/wscat can be used to test RPC:

wscat -c 127.0.0.1:8880

Supported RPC commands:

> {"method":"get_node_id","params":[],"id":1,"jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":"32d4bcea26b8b2fa9182f7b23abe6a0b53ce32684a8176b085da9d8cdea9bef3","id":1}
> {"method":"subscribe_blocks","id":2,"jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":1,"id":2}
> {"method":"unsubscribe_blocks","params":[1],"id":3,"jsonrpc":"2.0"}
< {"method":"unsubscribe_blocks","params":[1],"id":3,"jsonrpc":"2.0"}

Cleanup

Remove config.json, plot.bin, plot-map and plot-tags at the location where client stores filed (printed during startup).

Building and running Docker image:

docker build -t subspace-core-rust -f Dockerfile .
docker run --rm -it --init subspace-core-rust

Building and running without Docker image:

To build an app run:

cargo build --release

Which will produce a binary that can be copied to one of the directories in PATH, for example:

sudo cp target/release/subspace /usr/local/bin/subspace

Then run a node:

subspace run gateway

Or as peer:

subspace run peer

Or as farmer:

subspace run farmer

Status

  1. Sloth based proof-of-replication
  2. Disk plotter
  3. Evaluation Loop
  4. Ledger
  5. TCP Gossip Network
  6. Terminal Console
  7. Manages Forks
  8. Basic tx scheme
  9. Erasure code state
  10. Sync state chain

Testing Only

Create a 2GB RAM Disk (mac)

diskutil erasevolume HFS+ “RAMDisk” hdiutil attach -nomount ram://4194304

subspace-core-rust's People

Contributors

nazar-pc avatar rg3l3dr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.