Go TypeScript Assembly C HTML Shell Other
Clone or download
Latest commit 85b8fca Jul 22, 2018
Permalink
Failed to load latest commit information.
.github Create pull_request_template.md Mar 17, 2018
ci-scripts Add integration-test-disable-gui.sh Jul 20, 2018
cmd Bump to v0.24.0 Jul 6, 2018
docker/images Merge pull request #1719 from simelo/stdevNorge_t1530_docker_use_skyc… Jul 22, 2018
docs [lib] refs #992 - Regenerate API docs after documenting TODO items Apr 12, 2018
electron Splash screen Jul 17, 2018
include [lib] refs #992 refs #1537 - Correct seed value after fixing bug in b… May 30, 2018
lib/cgo [lib] refs #1632 - TestSecKeyHex : Do not free memory that will be di… Jun 11, 2018
src Merge pull request #1702 from mahansky/txs_details Jul 22, 2018
template change coin directory check Jun 7, 2018
vendor move devconfig to skycoin package Jun 7, 2018
.Doxyfile Bump to v0.24.0 Jul 6, 2018
.appveyor.yml bad merge consequences fixed Dec 15, 2017
.gitignore Merge remote-tracking branch 'skycoin/develop' into olemis_t992_libsk… May 22, 2018
.travis.yml [ci] refs #1632 - Do not upgrade gcc\@ 6 formula Jun 7, 2018
CHANGELOG.md Add go1.10 to changelog Jul 20, 2018
Gopkg.lock move devconfig to skycoin package Jun 7, 2018
Gopkg.toml Use github.com/NYTimes/gziphandler May 12, 2018
INSTALLATION.md Remove support for go1.9 May 21, 2018
INTEGRATION.md Refer to POST /wallet/transaction in INTEGRATION.md May 25, 2018
Makefile Add integration-test-enable-seed-api and integration-test-disable-gui… Jul 20, 2018
README.md Update README Live Integration Tests section to start live node with … Jul 20, 2018
docker_launcher.sh [docker] [skycoin] refs #1190 Adds docker launcher. Apr 11, 2018
fiber.toml Bump to v0.24.0 Jul 6, 2018
gz-c.asc Add release signature notes Mar 23, 2018
peers.txt Update peers.txt May 7, 2018
run-live-integration-test-node.sh Add warning to save seed before encryption Apr 22, 2018
run-with-rpc.sh Refactor db verification May 10, 2018
run.sh run.sh don't enable versioned api May 16, 2018

README.md

skycoin logo

Skycoin

Build Status GoDoc Go Report Card

Skycoin is a next-generation cryptocurrency.

Skycoin improves on Bitcoin in too many ways to be addressed here.

Skycoin is a small part of OP Redecentralize and OP Darknet Plan.

Links

Table of Contents

Changelog

CHANGELOG.md

Installation

Skycoin supports go1.10+.

Go 1.10+ Installation and Setup

Golang 1.10+ Installation/Setup

Go get skycoin

go get github.com/skycoin/skycoin/...

This will download github.com/skycoin/skycoin to $GOPATH/src/github.com/skycoin/skycoin.

You can also clone the repo directly with git clone https://github.com/skycoin/skycoin, but it must be cloned to this path: $GOPATH/src/github.com/skycoin/skycoin.

Run Skycoin from the command line

cd $GOPATH/src/github.com/skycoin/skycoin
make run

Show Skycoin node options

cd $GOPATH/src/github.com/skycoin/skycoin
make run-help

Run Skycoin with options

Example:

cd $GOPATH/src/github.com/skycoin/skycoin
make ARGS="--launch-browser=false -data-dir=/custom/path" run

Docker image

This is the quickest way to start using Skycoin using Docker.

$ docker volume create skycoin-data
$ docker volume create skycoin-wallet
$ docker run -ti --rm \
    -v skycoin-data:/data/.skycoin \
    -v skycoin-wallet:/wallet \
    -p 6000:6000 \
    -p 6420:6420 \
    skycoin/skycoin

This image has a skycoin user for the skycoin daemon to run, with UID and GID 10000. When you mount the volumes, the container will change their owner, so you must be aware that if you are mounting an existing host folder any content you have there will be own by 10000.

The container will run with some default options, but you can change them by just appending flags at the end of the docker run command. The following example will show you the available options.

docker run --rm skycoin/skycoin -help

Access the dashboard: http://localhost:6420.

Access the API: http://localhost:6420/version.

Building your own images

Building your own images.

Development image

The skycoin/skycoindev-cli docker image is provided in order to make easy to start developing Skycoin. It comes with the compiler, linters, debugger and the vim editor among other tools.

API Documentation

REST API

REST API.

JSON-RPC 2.0 API

Deprecated, avoid using this

JSON-RPC 2.0 README.

Skycoin command line interface

CLI command API.

Integrating Skycoin with your application

Skycoin Integration Documentation

Contributing a node to the network

Add your node's ip:port to the peers.txt file. This file will be periodically uploaded to https://downloads.skycoin.net/blockchain/peers.txt and used to seed client with peers.

Note: Do not add Skywire nodes to peers.txt. Only add Skycoin nodes with high uptime and a static IP address (such as a Skycoin node hosted on a VPS).

URI Specification

Skycoin URIs obey the same rules as specified in Bitcoin's BIP21. They use the same fields, except with the addition of an optional hours parameter, specifying the coin hours.

Example Skycoin URIs:

  • skycoin:2hYbwYudg34AjkJJCRVRcMeqSWHUixjkfwY
  • skycoin:2hYbwYudg34AjkJJCRVRcMeqSWHUixjkfwY?amount=123.456&hours=70
  • skycoin:2hYbwYudg34AjkJJCRVRcMeqSWHUixjkfwY?amount=123.456&hours=70&label=friend&message=Birthday%20Gift

Development

We have two branches: master and develop.

develop is the default branch and will have the latest code.

master will always be equal to the current stable release on the website, and should correspond with the latest release tag.

Modules

  • api - REST API interface
  • api/webrpc - JSON-RPC 2.0 API [deprecated]
  • cipher - cryptographic library
  • cli - CLI library
  • coin - blockchain data structures
  • daemon - top-level application manager, combining all components (networking, database, wallets)
  • daemon/gnet - networking library
  • daemon/pex - peer management
  • visor - top-level blockchain database layer
  • visor/blockdb - low-level blockchain database layer
  • visor/historydb - low-level blockchain database layer for historical blockchain metadata
  • wallet - wallet file management

Client libraries

Skycoin implements client libraries which export core functionality for usage from other programming languages.

For further details run make docs to generate documetation and read the corresponding README and API references.

Running Tests

make test

Running Integration Tests

There are integration tests for the CLI and HTTP API interfaces. They have two run modes, "stable" and "live.

The stable integration tests will use a skycoin daemon whose blockchain is synced to a specific point and has networking disabled so that the internal state does not change.

The live integration tests should be run against a synced or syncing node with networking enabled.

Stable Integration Tests

make integration-test-stable

or

./ci-scripts/integration-test-stable.sh -v -w

The -w option, run wallet integrations tests.

The -v option, show verbose logs.

Live Integration Tests

The live integration tests run against a live runnning skycoin node, so before running the test, we need to start a skycoin node. Since the cli integration test requires the rpc interface enabled, we should start node with rpc-interface:

./run.sh -launch-browser=false -rpc-interface

After the skycoin node is up, run the following command to start the live tests:

./ci-scripts/integration-test.live.sh -v

The above command will run all tests except the wallet related tests. To run wallet tests, we need to manually specify a wallet file, and it must have at least 2 coins and 256 coinhours, it also must have been loaded by the node.

We can specify the wallet by setting two environment variables: WALLET_DIR and WALLET_NAME. The WALLET_DIR represents the absolute path of the wallet directory, and WALLET_NAME represents the wallet file name.

Note: WALLET_DIR is only used by the CLI integration tests. The GUI integration tests use the node's configured wallet directory, which can be controlled with -wallet-dir when running the node.

If the wallet is encrypted, also set WALLET_PASSWORD.

export WALLET_DIR="$HOME/.skycoin/wallets"
export WALLET_NAME="$valid_wallet_filename"
export WALLET_PASSWORD="$wallet_password"

Then run the tests with the following command:

make integration-test-live

or

./ci-scripts/integration-test-live.sh -v -w

Debugging Integration Tests

Run specific test case:

It's annoying and a waste of time to run all tests to see if the test we real care is working correctly. There's an option: -r, which can be used to run specific test case. For exampe: if we only want to test TestStableAddressBalance and see the result, we can run:

./ci-scripts/integration-test-stable.sh -v -r TestStableAddressBalance

Update golden files in integration testdata

Golden files are expected data responses from the CLI or HTTP API saved to disk. When the tests are run, their output is compared to the golden files.

To update golden files, use the -u option:

./ci-scripts/integration-test-live.sh -v -u
./ci-scripts/integration-test-stable.sh -v -u

We can also update a specific test case's golden file with the -r option.

Formatting

All .go source files should be formatted goimports. You can do this with:

make format

Code Linting

Install prerequisites:

make install-linters

Run linters:

make lint

Dependency Management

Dependencies are managed with dep.

To install dep:

go get -u github.com/golang/dep

dep vendors all dependencies into the repo.

If you change the dependencies, you should update them as needed with dep ensure.

Use dep help for instructions on vendoring a specific version of a dependency, or updating them.

When updating or initializing, dep will find the latest version of a dependency that will compile.

Examples:

Initialize all dependencies:

dep init

Update all dependencies:

dep ensure -update -v

Add a single dependency (latest version):

dep ensure github.com/foo/bar

Add a single dependency (more specific version), or downgrade an existing dependency:

dep ensure github.com/foo/bar@tag

Configuration Modes

There are 4 configuration modes in which you can run a skycoin node:

  • Development Desktop Daemon
  • Server Daemon
  • Electron Desktop Client
  • Standalone Desktop Client

Development Desktop Daemon Mode

This mode is configured via run.sh

$ ./run.sh

Server Daemon Mode

The default settings for a skycoin node are chosen for Server Daemon, which is typically run from source. This mode is usually preferred to be run with security options, though -disable-csrf is normal for server daemon mode, it is left enabled by default.

$ go run cmd/skycoin/skycoin.go

Electron Desktop Client Mode

This mode configures itself via electron-main.js

Standalone Desktop Client Mode

This mode is configured by compiling with STANDALONE_CLIENT build tag. The configuration is handled in cmd/skycoin/skycoin.go

Wallet GUI Development

The compiled wallet source should be checked in to the repo, so that others do not need to install node to run the software.

Instructions for doing this:

Wallet GUI Development README

Releases

  1. If the master branch has commits that are not in develop (e.g. due to a hotfix applied to master), merge master into develop
  2. Compile the src/gui/static/dist/ to make sure that it is up to date (see Wallet GUI Development README)
  3. Update all version strings in the repo (grep for them) to the new version
  4. Update CHANGELOG.md: move the "unreleased" changes to the version and add the date
  5. Merge these changes to develop
  6. Follow the steps in pre-release testing
  7. Make a PR merging develop into master
  8. Review the PR and merge it
  9. Tag the master branch with the version number. Version tags start with v, e.g. v0.20.0. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with git tag -as v0.20.0 $COMMIT_ID, but Github will not recognize it as a "release".
  10. Make sure that the client runs properly from the master branch
  11. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the create release builds instructions.

If there are problems discovered after merging to master, start over, and increment the 3rd version number. For example, v0.20.0 becomes v0.20.1, for minor fixes.

Pre-release testing

Performs these actions before releasing:

  • make check
  • make integration-test-live (see live integration tests) both with an unencrypted and encrypted wallet.
  • go run cmd/cli/cli.go checkdb against a synced node
  • On all OSes, make sure that the client runs properly from the command line (./run.sh)
  • Build the releases and make sure that the Electron client runs properly on Windows, Linux and macOS.
    • Use a clean data directory with no wallets or database to sync from scratch and verify the wallet setup wizard.
    • Load a test wallet with nonzero balance from seed to confirm wallet loading works
    • Send coins to another wallet to confirm spending works
    • Restart the client, confirm that it reloads properly

Creating release builds

Create Release builds.

Release signing

Releases are signed with this PGP key:

0x5801631BD27C7874

The fingerprint for this key is:

pub   ed25519 2017-09-01 [SC] [expires: 2023-03-18]
      10A7 22B7 6F2F FE7B D238  0222 5801 631B D27C 7874
uid                      GZ-C SKYCOIN <token@protonmail.com>
sub   cv25519 2017-09-01 [E] [expires: 2023-03-18]

Keybase.io account: https://keybase.io/gzc

Follow the Tor Project's instructions for verifying signatures.

If you can't or don't want to import the keys from a keyserver, the signing key is available in the repo: gz-c.asc.

Releases and their signatures can be found on the releases page.

Instructions for generating a PGP key, publishing it, signing the tags and binaries: https://gist.github.com/gz-c/de3f9c43343b2f1a27c640fe529b067c