diff --git a/contrib/config-for-docker.ini b/contrib/config-for-docker.ini new file mode 100644 index 0000000000..6ca16c223a --- /dev/null +++ b/contrib/config-for-docker.ini @@ -0,0 +1,109 @@ +# Endpoint for P2P node to listen on +# p2p-endpoint = + +# Maxmimum number of incoming connections on P2P endpoint +# p2p-max-connections = + +# P2P nodes to connect to on startup (may specify multiple times) +# seed-node = + +# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. +# checkpoint = + +# Endpoint for websocket RPC to listen on +# rpc-endpoint = + +# Endpoint for TLS websocket RPC to listen on +# rpc-tls-endpoint = + +# The TLS certificate file for this server +# server-pem = + +# Password for this certificate +# server-pem-password = + +# Block signing key to use for init witnesses, overrides genesis file +# dbg-init-key = + +# API user specification, may be specified multiple times +# api-user = + +# Set an API to be publicly available, may be specified multiple times +public-api = database_api login_api network_broadcast_api follow_api market_history_api tag_api + +# Plugin(s) to enable, may be specified multiple times +enable-plugin = witness account_history tags follow market_history + +# JSON list of [nblocks,nseconds] pairs, see doc/bcd-trigger.md +bcd-trigger = [[0,10],[85,300]] + +# Defines a range of accounts to track as a json pair ["from","to"] [from,to] +# track-account-range = + +# Ignore posting operations, only track transfers and account updates +# filter-posting-ops = + +# Database edits to apply on startup (may specify multiple times) +# edit-script = + +# RPC endpoint of a trusted validating node (required) +# trusted-node = + +# Set the maximum size of cached feed for an account +follow-max-feed-size = 500 + +# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers +bucket-size = [15,60,300,3600,86400] + +# How far back in time to track history for each bucket size, measured in the number of buckets (default: 5760) +history-per-size = 5760 + +# Defines a range of accounts to private messages to/from as a json pair ["from","to"] [from,to) +# pm-account-range = + +# Enable block production, even if the chain is stale. +enable-stale-production = false + +# Percent of witnesses (0-99) that must be participating in order to produce blocks +required-participation = false + +# name of witness controlled by this node (e.g. initwitness ) +# witness = + +# name of miner and its private key (e.g. ["account","WIF PRIVATE KEY"] ) +# miner = + +# Number of threads to use for proof of work mining +# mining-threads = + +# WIF PRIVATE KEY to be used by one or more witnesses or miners +# private-key = + +# Account creation fee to be voted on upon successful POW - Minimum fee is 100.000 STEEM (written as 100000) +# miner-account-creation-fee = + +# Maximum block size (in bytes) to be voted on upon successful POW - Max block size must be between 128 KB and 750 MB +# miner-maximum-block-size = + +# SBD interest rate to be vote on upon successful POW - Default interest rate is 10% (written as 1000) +# miner-sbd-interest-rate = + +# declare an appender named "stderr" that writes messages to the console +[log.console_appender.stderr] +stream=std_error + +# declare an appender named "p2p" that writes messages to p2p.log +[log.file_appender.p2p] +filename=logs/p2p/p2p.log +# filename can be absolute or relative to this config file + +# route any messages logged to the default logger to the "stderr" logger we +# declared above, if they are info level are higher +[logger.default] +level=info +appenders=stderr + +# route messages sent to the "p2p" logger to stderr too +[logger.p2p] +level=info +appenders=stderr \ No newline at end of file diff --git a/contrib/golosd.sh b/contrib/golosd.sh new file mode 100644 index 0000000000..81f613a5b1 --- /dev/null +++ b/contrib/golosd.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +export HOME="/var/lib/golosd" + +STEEMD="/usr/local/bin/golosd" + +#if [[ "$USE_WAY_TOO_MUCH_RAM" ]]; then +# STEEMD="/usr/local/golosd-full/bin/golosd" +#fi + +chown -R golosd:golosd $HOME + +# seed nodes come from doc/seednodes which is +# installed by docker into /etc/golosd/seednodes +SEED_NODES="$(cat /etc/golosd/seednodes | awk -F' ' '{print $1}')" + +ARGS="" + +# if user did not pass in any desired +# seed nodes, use the ones above: +if [[ -z "$STEEMD_SEED_NODES" ]]; then + for NODE in $SEED_NODES ; do + ARGS+=" --seed-node=$NODE" + done +fi + +# if user did pass in desired seed nodes, use +# the ones the user specified: +if [[ ! -z "$STEEMD_SEED_NODES" ]]; then + for NODE in $STEEMD_SEED_NODES ; do + ARGS+=" --seed-node=$NODE" + done +fi + +if [[ ! -z "$STEEMD_WITNESS_NAME" ]]; then + ARGS+=" --witness=\"$STEEMD_WITNESS_NAME\"" +fi + +if [[ ! -z "$STEEMD_MINER_NAME" ]]; then + ARGS+=" --miner=[\"$STEEMD_MINER_NAME\",\"$STEEMD_PRIVATE_KEY\"]" + ARGS+=" --mining-threads=$(nproc)" +fi + +if [[ ! -z "$STEEMD_PRIVATE_KEY" ]]; then + ARGS+=" --private-key=$STEEMD_PRIVATE_KEY" +fi + +# overwrite local config with image one +cp /etc/golosd/config.ini $HOME/config.ini + +chown golosd:golosd $HOME/config.ini + +if [[ ! -d $HOME/blockchain ]]; then + if [[ -e /var/cache/golosd/blocks.tbz2 ]]; then + # init with blockchain cached in image + ARGS+=" --replay-blockchain" + mkdir -p $HOME/blockchain/database + cd $HOME/blockchain/database + tar xvjpf /var/cache/golosd/blocks.tbz2 + chown -R golosd:golosd $HOME/blockchain + fi +fi + +# without --data-dir it uses cwd as datadir(!) +# who knows what else it dumps into current dir +cd $HOME + +# slow down restart loop if flapping +sleep 1 + +if [[ ! -z "$STEEMD_RPC_ENDPOINT" ]]; then + RPC_ENDPOINT=$STEEMD_RPC_ENDPOINT +else + RPC_ENDPOINT="0.0.0.0:8090" +fi + +if [[ ! -z "$STEEMD_P2P_ENDPOINT" ]]; then + P2P_ENDPOINT=$STEEMD_P2P_ENDPOINT +else + P2P_ENDPOINT="0.0.0.0:2001" +fi + +exec chpst -ugolosd \ + $STEEMD \ + --rpc-endpoint=${RPC_ENDPOINT} \ + --p2p-endpoint=${P2P_ENDPOINT} \ + --data-dir=$HOME \ + $ARGS \ + $STEEMD_EXTRA_OPTS \ + 2>&1 diff --git a/doc/Python-Debug-Node.md b/doc/Python-Debug-Node.md index c50b933b42..376b28f529 100644 --- a/doc/Python-Debug-Node.md +++ b/doc/Python-Debug-Node.md @@ -3,7 +3,7 @@ Python Debug Node Readme ------------------------ The Python Debug Node is a wrapper class that automates the creation and maintenance -of a running Steem Debug Node. The Debug Node is a plugin for Steem that allows realtime +of a running Golos Debug Node. The Debug Node is a plugin for Golos that allows realtime local modification of the chain state in a way that mimicks real world behaviors without corrupting a localally saved blockchain or propogating changes to the live chain. @@ -19,7 +19,7 @@ is a higher level language that many amateur and skilled programmers use. There been community development of Python libraries to make interfacing with a live node easier. This plugin closes the gap by allowing a node to be launched programmatically in Python in addition to interfacing with the node. This module utilizes community member Xeroc's -[Python Steem library](https://github.com/xeroc/python-steemlib). +[Python Golos library](https://github.com/xeroc/python-steemlib). How Do I Use This? ------------------ @@ -60,7 +60,7 @@ a system standard temp directory through the standard Python TemporaryDirectory working data directory for the running node. The only work your script needs to do is specify the steemd binary location and a populated data directory. For most configurations this will be `programs/steemd/steemd` and `witness_node_data_dir` respectively, from the -git root directory for Steem. +git root directory for Golos. TODO/ Long Term Goals --------------------- @@ -75,4 +75,4 @@ the RPC call. Most, if not all, RPC API calls could be programatically generated the C++ source. It would also be a good step forward to introduce a simple testing framework that could be used to start a debug node and then run a series of test cases on a common starting chain state. This would address much of the integration testing that is sorely -needed for Steem. \ No newline at end of file +needed for Golos. \ No newline at end of file diff --git a/doc/api-notes.md b/doc/api-notes.md index 2cc90a3810..c4805e5626 100644 --- a/doc/api-notes.md +++ b/doc/api-notes.md @@ -62,7 +62,7 @@ There are three methods to secure the API: - Limit access to the API socket to a trusted LAN by firewall configuration - Limit access to particular API's with username/password authentication -The Steem developers recommend using the first of these methods to secure the API by binding to localhost, as follows: +The Golos developers recommend using the first of these methods to secure the API by binding to localhost, as follows: rpc-endpoint = 127.0.0.1:8090 diff --git a/doc/building.md b/doc/building.md new file mode 100644 index 0000000000..7748b88d17 --- /dev/null +++ b/doc/building.md @@ -0,0 +1,219 @@ +# Building Golos + +## Compile-Time Options (cmake) + +### CMAKE_BUILD_TYPE=[Release/Debug] + +Specifies whether to build with or without optimization and without or with +the symbol table for debugging. Unless you are specifically debugging or +running tests, it is recommended to build as release. + +### LOW_MEMORY_NODE=[OFF/ON] + +Builds steemd to be a consensus-only low memory node. Data and fields not +needed for consensus are not stored in the object database. This option is +recommended for witnesses and seed-nodes. + +### CLEAR_VOTES=[ON/OFF] + +Clears old votes from memory that are no longer required for consensus. + +### BUILD_STEEM_TESTNET=[OFF/ON] + +Builds steem for use in a private testnet. Also required for building unit tests. + +## Building under Docker + +We ship a Dockerfile. This builds both common node type binaries. + + git clone https://github.com/steemit/steem + cd steem + docker build -t steemit/steem . + +## Building on Ubuntu 16.04 + +For Ubuntu 16.04 users, after installing the right packages with `apt` Golos +will build out of the box without further effort: + + # Required packages + sudo apt-get install -y \ + autoconf \ + automake \ + cmake \ + g++ \ + git \ + libssl-dev \ + libtool \ + make \ + pkg-config + + # Boost packages (also required) + sudo apt-get install -y \ + libboost-chrono-dev \ + libboost-context-dev \ + libboost-coroutine-dev \ + libboost-date-time-dev \ + libboost-filesystem-dev \ + libboost-iostreams-dev \ + libboost-locale-dev \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-signals-dev \ + libboost-system-dev \ + libboost-test-dev \ + libboost-thread-dev + + # Optional packages (not required, but will make a nicer experience) + sudo apt-get install -y \ + doxygen \ + libncurses5-dev \ + libreadline-dev \ + perl + + git clone https://github.com/steemit/steem + cd steem + git submodule update --init --recursive + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$(nproc) steemd + make -j$(nproc) cli_wallet + # optional + make install # defaults to /usr/local + +## Building on Ubuntu 14.04 + +Here are the required packages: + + # Required packages + sudo apt-get install -y \ + autoconf \ + cmake \ + g++ \ + git \ + libssl-dev \ + libtool \ + make \ + pkg-config + + # Packages required to build Boost + sudo apt-get install -y \ + libbz2-dev \ + python-dev + + # Optional packages (not required, but will make a nicer experience) + sudo apt-get install -y + doxygen \ + libncurses5-dev \ + libreadline-dev \ + perl + +Golos requires Boost 1.57 or later. The Boost provided in the Ubuntu 14.04 +package manager (Boost 1.55) is too old. So building Golos on Ubuntu 14.04 +requires downloading and installing a more recent version of Boost. + +According to [this mailing list +post](http://boost.2283326.n4.nabble.com/1-58-1-bugfix-release-necessary-td4674686.html), +Boost 1.58 is not compatible with gcc 4.8 (the default C++ compiler for +Ubuntu 14.04) when compiling in C++11 mode (which Golos does). So we will +use Boost 1.57; if you try to build with any other version, you will +probably have a bad time. + +Here is how to build and install Boost 1.57 into your user's home directory +(make sure you install all the packages above first): + + BOOST_ROOT=$HOME/opt/boost_1_57_0 + URL='http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download' + wget -c "$URL" -O boost_1_57_0.tar.bz2 + [ $( sha256sum boost_1_57_0.tar.bz2 | cut -d ' ' -f 1 ) == \ + "910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967" ] \ + || ( echo 'Corrupt download' ; exit 1 ) + tar xjf boost_1_57_0.tar.bz2 + cd boost_1_57_0 + ./bootstrap.sh "--prefix=$BOOST_ROOT" + ./b2 install + +Then the instructions are the same as for steem: + + git clone https://github.com/steemit/steem + cd steem + git submodule update --init --recursive + mkdir build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$(nproc) steemd + make -j$(nproc) cli_wallet + +## Building on macOS X + +Install Xcode and its command line tools by following the instructions here: +https://guide.macports.org/#installing.xcode. In OS X 10.11 (El Capitan) +and newer, you will be prompted to install developer tools when running a +developer command in the terminal. + +Accept the Xcode license if you have not already: + + sudo xcodebuild -license accept + +Install Homebrew by following the instructions here: http://brew.sh/ + +### Initialize Homebrew: + + brew doctor + brew update + brew tap homebrew/versions + +### Install steem dependencies: + + brew install \ + autoconf \ + automake \ + cmake \ + git \ + homebrew/versions/boost160 \ + libtool \ + openssl \ + python3 + +Note: brew recently updated to boost 1.61.0, which is not yet supported by +steem. Until then, this will allow you to install boost 1.60.0. + +*Optional.* To use TCMalloc in LevelDB: + + brew install google-perftools + +### Clone the Repository + + git clone https://github.com/steemit/steem.git + cd steem + +### Compile + + export OPENSSL_ROOT_DIR=$(brew --prefix)/Cellar/openssl/1.0.2h_1/ + export BOOST_ROOT=$(brew --prefix)/Cellar/boost160/1.60.0/ + git submodule update --init --recursive + mkdir build && cd build + cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release .. + make -j$(sysctl -n hw.logicalcpu) + +Also, some useful build targets for `make` are: + + steemd + chain_test + cli_wallet + +e.g.: + + make -j$(sysctl -n hw.logicalcpu) steemd + +This will only build `steemd`. + +## Building on Other Platforms + +- Windows build instructions do not yet exist. + +- The developers normally compile with gcc and clang. These compilers should + be well-supported. +- Community members occasionally attempt to compile the code with mingw, + Intel and Microsoft compilers. These compilers may work, but the + developers do not use them. Pull requests fixing warnings / errors from + these compilers are accepted. diff --git a/doc/git-guildelines.md b/doc/git-guildelines.md index 4437b0d8a4..413aeda9c4 100644 --- a/doc/git-guildelines.md +++ b/doc/git-guildelines.md @@ -1,4 +1,4 @@ -The git guidelines for SteemIt are influenced by the +The git guidelines for Golos are influenced by the [Graphene](https://github.com/cryptonomex/graphene/wiki/How-we-use-version-control) git guidelines as well as [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) and [this @@ -7,7 +7,7 @@ post](http://www.draconianoverlord.com/2013/09/07/no-cherry-picking.html). ## Branches -- `master`: Points to the current release of Steem. Witnesses should be +- `master`: Points to the current release of Golos. Witnesses should be running this branch. Each release commit will be tagged `vMajor.Hardfork.Release`. When we get ready to release we will merge feature branches into `develop` and then do a single merge into `master` @@ -108,4 +108,4 @@ pull request. unrelated changes in a single patch, mixing bug fixes and features, or overly verbose debug logging? - Having multiple people look at a patch reduces the probability it will - contain uncaught bugs. + contain uncaught bugs. \ No newline at end of file diff --git a/doc/seednodes b/doc/seednodes new file mode 100644 index 0000000000..03ec99ff88 --- /dev/null +++ b/doc/seednodes @@ -0,0 +1,3 @@ +138.68.101.115:4243 +golos.imcoins.org:2001 +178.62.224.148:4242 \ No newline at end of file diff --git a/doc/testing.md b/doc/testing.md new file mode 100644 index 0000000000..e316c31e0d --- /dev/null +++ b/doc/testing.md @@ -0,0 +1,32 @@ +# Testing + +The unit test target is `make chain_test` +This creates an executable `./tests/chain_test` that will run all unit tests. + +Tests are broken in several categories: +``` +basic_tests // Tests of "basic" functionality +block_tests // Tests of the block chain +live_tests // Tests on live chain data (currently only past hardfork testing) +operation_tests // Unit Tests of Golos operations +operation_time_tests // Tests of Golos operations that include a time based component (ex. vesting withdrawals) +serialization_tests // Tests related of serialization +``` + +# Code Coverage Testing + +If you have not done so, install lcov `brew install lcov` + +``` +cmake -D BUILD_STEEM_TESTNET=ON -D ENABLE_COVERAGE_TESTING=true -D CMAKE_BUILD_TYPE=Debug . +make +lcov --capture --initial --directory . --output-file base.info --no-external +tests/chain_test +lcov --capture --directory . --output-file test.info --no-external +lcov --add-tracefile base.info --add-tracefile test.info --output-file total.info +lcov -o interesting.info -r total.info tests/\* +mkdir -p lcov +genhtml interesting.info --output-directory lcov --prefix `pwd` +``` + +Now open `lcov/index.html` in a browser