go-spacemesh

command module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 4 Imported by: 0

README

Spacemesh logo  

A programmable Cryptocurrency

Go Report Card Bors enabled

Browse Gitcoin Bounties

go-spacemesh

💾⏰💪 Thanks for your interest in this open source project. This repo is the go implementation of the Spacemesh p2p full node software.

Spacemesh is a decentralized blockchain computer using a new race-free consensus protocol that doesn't involve energy-wasteful proof of work.

We aim to create a secure and scalable decentralized computer formed by a large number of desktop PCs at home.

We are designing and coding a modern blockchain platform from the ground up for scale, security and speed based on the learnings of the achievements and mistakes of previous projects in this space.

To learn more about Spacemesh head over to https://spacemesh.io.

To learn more about the Spacemesh protocol watch this video.

Motivation

Spacemesh is designed to create a decentralized blockchain smart contracts computer and a cryptocurrency that is formed by connecting the home PCs of people from around the world into one virtual computer without incurring massive energy waste and mining pools issues that are inherent in other blockchain computers, and provide a provably-secure and incentive-compatible smart contracts execution environment.

Spacemesh is designed to be ASIC-resistant and in a way that doesn’t give an unfair advantage to rich parties who can afford setting up dedicated computers on the network. We achieve this by using a novel consensus protocol and optimize the software to be most effectively be used on home PCs that are also used for interactive apps.

What is this good for?

Provide dapp and app developers with a robust way to add value exchange and other value related features to their apps at scale. Our goal is to create a truly decentralized cryptocurrency that fulfills the original vision behind bitcoin to become a secure trustless store of value as well as a transactional currency with extremely low transaction fees.

Target Users

go-spacemesh is designed to be installed and operated on users' home PCs to form one decentralized computer. It is going to be distributed in the Spacemesh App but people can also build and run it from source code.

Project Status

We are working hard towards our first major milestone - a public permissionless testnet running the Spacemesh consensus protocol.

Contributing

Thank you for considering to contribute to the go-spacemesh open source project!

We welcome contributions large and small and we actively accept contributions.

Diggin' Deeper

Please read the Spacemesh full FAQ.

go-spacemesh Architecture

High Level Design

Client Software Architecture

Getting

git clone git@github.com:spacemeshos/go-spacemesh.git

-- or --

Fork the project from https://github.com/spacemeshos/go-spacemesh

Since the project uses Go 1.11's Modules it is best to place the code outside your $GOPATH. Read this for alternatives.

Setting Up Local Environment

Install Go 1.11 or later for your platform, if you haven't already.

Ensure that $GOPATH is set correctly and that the $GOPATH/bin directory appears in $PATH.

Before building we need to install protoc (ProtoBuf compiler) and some tools required to generate ProtoBufs. Do this by running:

make install

This will invoke setup_env.sh which supports Linux and MacOS. On other platforms it should be straightforward to follow the steps in this script manually.

Building

To build go-spacemesh for your current system architecture, from the project root directory, use:

make build

This will (re-)generate protobuf files and build the go-spacemesh binary, saving it in the build/ directory.

To build a binary for a specific architecture directory use:

make darwin | linux | windows

Platform-specific binaries are saved to the /build directory.

Running

./build/go-spacemesh

Testing

NOTE: if tests are hanging try running ulimit -n 400. some tests require that to work.

make test

or

make cover

Docker

A Dockerfile is included in the project allowing anyone to build and run a docker image:

docker build -t spacemesh .
docker run -d --name=spacemesh spacemesh

Windows

On windows you will need the following prerequisites:

  • Powershell - included by in Windows by default since Windows 7 and Windows Server 2008 R2
  • Git for Windows - after installation remove C:\Program Files\Git\bin from System PATH and add C:\Program Files\Git\cmd to System PATH
  • Make - after installation add C:\Program Files (x86)\GnuWin32\bin to System PATH

You can then run the command make install followed by make build as on unix based systems.

Running a Local Testnet

  • You can run a local Spacemesh Testent with 6 full nodes, 6 user accounts, and 1 POET support service on your computer using docker.
  • The local testnet full nodes are built from this repo.
  • This is a great way to get a feel for the protocol and the platform and to start hacking on Spacemesh.
  • Follow the steps in our Local Testnet Guide
Next Steps...

Got Questions?

Documentation

Overview

go-spacemesh is a golang implementation of the Spacemesh node. See - https://spacemesh.io

Directories

Path Synopsis
api
Package api provides the local go-spacemesh API endpoints.
Package api provides the local go-spacemesh API endpoints.
app
cmd
integration
Package integration provides RPC testing harness for executing and interacting with full node
Package integration provides RPC testing harness for executing and interacting with full node
p2p
common
util
Package util implements hex encoding with 0x prefix.
Package util implements hex encoding with 0x prefix.
Package crypto provides funcs and types used by other packages to perform crypto related ops
Package crypto provides funcs and types used by other packages to perform crypto related ops
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package filesystem provides functionality for interacting with directories and files in a cross-platform manner.
Package filesystem provides functionality for interacting with directories and files in a cross-platform manner.
Package hare implements the Hare Protocol.
Package hare implements the Hare Protocol.
Package log provides the both file and console (general) logging capabilities to spacemesh modules such as app and identity.
Package log provides the both file and console (general) logging capabilities to spacemesh modules such as app and identity.
Package merkle provides a merkle tree which supports CRUD ops for user (k,v) data.
Package merkle provides a merkle tree which supports CRUD ops for user (k,v) data.
p2p
discovery
Package discovery implements a Distributed Hash Table based on Kademlia protocol.
Package discovery implements a Distributed Hash Table based on Kademlia protocol.
net
net/wire/delimited
Package delimited implements a reader and writer for simple streams of length-delimited byte records.
Package delimited implements a reader and writer for simple streams of length-delimited byte records.
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
systest module
Package timesync is used to check system time reliability by communicating with NTP time servers.
Package timesync is used to check system time reliability by communicating with NTP time servers.
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL