├── .gitignore ├── .gitmodules ├── .travis.yml ├── CMakeLists.txt ├── Dockerfile ├── Doxyfile ├── LICENSE.md ├── README.md ├── deploy ├── config ├── deploy-key.enc ├── deploy.sh ├── docs-deploy.sh └── set-ssh.sh ├── documentation ├── api_notes.md ├── building.md ├── debug_node_plugin.md ├── doxygen │ ├── DoxygenLayout.xml │ ├── customdoxygen.css │ ├── footer.html │ ├── header.html │ └── images │ │ └── golos.svg ├── git_guildelines.md ├── plugin.md ├── python_debug_node.md └── testing.md ├── libraries ├── CMakeLists.txt ├── api │ ├── CMakeLists.txt │ ├── account_api_object.cpp │ ├── block_objects.cpp │ ├── chain_api_properties.cpp │ ├── discussion_helper.cpp │ ├── include │ │ └── golos │ │ │ └── api │ │ │ ├── account_api_object.hpp │ │ │ ├── account_vote.hpp │ │ │ ├── block_objects.hpp │ │ │ ├── chain_api_properties.hpp │ │ │ ├── comment_api_object.hpp │ │ │ ├── discussion.hpp │ │ │ ├── discussion_helper.hpp │ │ │ ├── reblog_entry.hpp │ │ │ ├── vote_state.hpp │ │ │ └── witness_api_object.hpp │ └── witness_api_object.cpp ├── chain │ ├── CMakeLists.txt │ ├── block_log.cpp │ ├── chain_properties_evaluators.cpp │ ├── curation_info.cpp │ ├── database.cpp │ ├── database_proposal_object.cpp │ ├── fork_database.cpp │ ├── hardfork.d │ │ ├── 0-preamble.hf │ │ ├── 0_1.hf │ │ ├── 0_10.hf │ │ ├── 0_11.hf │ │ ├── 0_12.hf │ │ ├── 0_13.hf │ │ ├── 0_14.hf │ │ ├── 0_15.hf │ │ ├── 0_16.hf │ │ ├── 0_17.hf │ │ ├── 0_18.hf │ │ ├── 0_19.hf │ │ ├── 0_2.hf │ │ ├── 0_20.hf │ │ ├── 0_21.hf │ │ ├── 0_3.hf │ │ ├── 0_4.hf │ │ ├── 0_5.hf │ │ ├── 0_6.hf │ │ ├── 0_7.hf │ │ ├── 0_8.hf │ │ └── 0_9.hf │ ├── include │ │ └── golos │ │ │ └── chain │ │ │ ├── account_object.hpp │ │ │ ├── block_log.hpp │ │ │ ├── block_summary_object.hpp │ │ │ ├── comment_object.hpp │ │ │ ├── compound.hpp │ │ │ ├── curation_info.hpp │ │ │ ├── custom_operation_interpreter.hpp │ │ │ ├── database.hpp │ │ │ ├── database_exceptions.hpp │ │ │ ├── db_with.hpp │ │ │ ├── evaluator.hpp │ │ │ ├── evaluator_registry.hpp │ │ │ ├── fork_database.hpp │ │ │ ├── generic_custom_operation_interpreter.hpp │ │ │ ├── global_property_object.hpp │ │ │ ├── immutable_chain_parameters.hpp │ │ │ ├── index.hpp │ │ │ ├── node_property_object.hpp │ │ │ ├── operation_notification.hpp │ │ │ ├── proposal_object.hpp │ │ │ ├── shared_authority.hpp │ │ │ ├── shared_db_merkle.hpp │ │ │ ├── snapshot_state.hpp │ │ │ ├── steem_evaluator.hpp │ │ │ ├── steem_object_types.hpp │ │ │ ├── steem_objects.hpp │ │ │ ├── transaction_object.hpp │ │ │ └── witness_objects.hpp │ ├── proposal_evaluator.cpp │ ├── proposal_object.cpp │ ├── shared_authority.cpp │ ├── steem_evaluator.cpp │ ├── steem_objects.cpp │ └── transaction_object.cpp ├── network │ ├── CMakeLists.txt │ ├── core_messages.cpp │ ├── include │ │ └── golos │ │ │ └── network │ │ │ ├── config.hpp │ │ │ ├── core_messages.hpp │ │ │ ├── exceptions.hpp │ │ │ ├── message.hpp │ │ │ ├── message_oriented_connection.hpp │ │ │ ├── node.hpp │ │ │ ├── peer_connection.hpp │ │ │ ├── peer_database.hpp │ │ │ └── stcp_socket.hpp │ ├── message_oriented_connection.cpp │ ├── node.cpp │ ├── peer_connection.cpp │ ├── peer_database.cpp │ └── stcp_socket.cpp ├── protocol │ ├── CMakeLists.txt │ ├── asset.cpp │ ├── authority.cpp │ ├── block.cpp │ ├── get_config.cpp │ ├── include │ │ └── golos │ │ │ └── protocol │ │ │ ├── README.md │ │ │ ├── asset.hpp │ │ │ ├── authority.hpp │ │ │ ├── base.hpp │ │ │ ├── block.hpp │ │ │ ├── block_header.hpp │ │ │ ├── config.hpp │ │ │ ├── exceptions.hpp │ │ │ ├── get_config.hpp │ │ │ ├── operation_util.hpp │ │ │ ├── operation_util_impl.hpp │ │ │ ├── operations.hpp │ │ │ ├── proposal_operations.hpp │ │ │ ├── protocol.hpp │ │ │ ├── reward_curve.hpp │ │ │ ├── sign_state.hpp │ │ │ ├── steem_operations.hpp │ │ │ ├── steem_virtual_operations.hpp │ │ │ ├── transaction.hpp │ │ │ ├── types.hpp │ │ │ ├── validate_helper.hpp │ │ │ └── version.hpp │ ├── operation_util_impl.cpp │ ├── operations.cpp │ ├── proposal_operations.cpp │ ├── sign_state.cpp │ ├── steem_operations.cpp │ ├── transaction.cpp │ ├── types.cpp │ └── version.cpp ├── time │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── time │ │ │ └── time.hpp │ └── time.cpp ├── utilities │ ├── CMakeLists.txt │ ├── git_revision.cpp.in │ ├── include │ │ └── graphene │ │ │ └── utilities │ │ │ ├── git_revision.hpp │ │ │ ├── key_conversion.hpp │ │ │ ├── padding_ostream.hpp │ │ │ ├── string_escape.hpp │ │ │ ├── tempdir.hpp │ │ │ └── words.hpp │ ├── key_conversion.cpp │ ├── string_escape.cpp │ ├── tempdir.cpp │ └── words.cpp └── wallet │ ├── CMakeLists.txt │ ├── Doxyfile.in │ ├── api_documentation_standin.cpp │ ├── generate_api_documentation.pl │ ├── include │ └── golos │ │ └── wallet │ │ ├── api_documentation.hpp │ │ ├── reflect_util.hpp │ │ ├── remote_node_api.hpp │ │ ├── time_converter.hpp │ │ └── wallet.hpp │ └── wallet.cpp ├── plugins ├── CMakeLists.txt ├── account_by_key │ ├── CMakeLists.txt │ ├── account_by_key_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── account_by_key │ │ ├── account_by_key_objects.hpp │ │ └── account_by_key_plugin.hpp ├── account_history │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── account_history │ │ │ ├── history_object.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── account_notes │ ├── CMakeLists.txt │ ├── account_notes_evaluators.cpp │ ├── account_notes_operations.cpp │ ├── account_notes_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── account_notes │ │ ├── account_notes_api_objects.hpp │ │ ├── account_notes_evaluators.hpp │ │ ├── account_notes_objects.hpp │ │ ├── account_notes_operations.hpp │ │ └── account_notes_plugin.hpp ├── auth_util │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── auth_util │ │ │ └── plugin.hpp │ └── plugin.cpp ├── block_info │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── block_info │ │ │ ├── block_info.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── chain │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── chain │ │ │ └── plugin.hpp │ ├── plugin.cpp │ ├── serialize_state.cpp │ └── serialize_state.hpp ├── database_api │ ├── CMakeLists.txt │ ├── api.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── database_api │ │ │ ├── api_objects │ │ │ ├── account_recovery_request_api_object.hpp │ │ │ ├── owner_authority_history_api_object.hpp │ │ │ ├── proposal_api_object.hpp │ │ │ └── savings_withdraw_api_object.hpp │ │ │ ├── forward.hpp │ │ │ ├── plugin.hpp │ │ │ └── state.hpp │ └── proposal_api_object.cpp ├── debug_node │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── debug_node │ │ │ └── plugin.hpp │ └── plugin.cpp ├── follow │ ├── CMakeLists.txt │ ├── follow_evaluators.cpp │ ├── follow_operations.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── follow │ │ │ ├── follow_api_object.hpp │ │ │ ├── follow_evaluators.hpp │ │ │ ├── follow_forward.hpp │ │ │ ├── follow_objects.hpp │ │ │ ├── follow_operations.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── json_rpc │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── json_rpc │ │ │ ├── api_helper.hpp │ │ │ ├── plugin.hpp │ │ │ └── utility.hpp │ └── plugin.cpp ├── market_history │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── market_history │ │ │ ├── market_history_objects.hpp │ │ │ └── market_history_plugin.hpp │ └── market_history_plugin.cpp ├── mongo_db │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── mongo_db │ │ │ ├── mongo_db_operations.hpp │ │ │ ├── mongo_db_plugin.hpp │ │ │ ├── mongo_db_state.hpp │ │ │ ├── mongo_db_types.hpp │ │ │ └── mongo_db_writer.hpp │ ├── mongo_db_operations.cpp │ ├── mongo_db_plugin.cpp │ ├── mongo_db_state.cpp │ ├── mongo_db_types.cpp │ └── mongo_db_writer.cpp ├── network_broadcast_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── network_broadcast_api │ │ │ └── network_broadcast_api_plugin.hpp │ └── network_broadcast_api.cpp ├── operation_dump │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── operation_dump │ │ │ ├── operation_dump_container.hpp │ │ │ ├── operation_dump_plugin.hpp │ │ │ └── operation_dump_visitor.hpp │ └── operation_dump_plugin.cpp ├── operation_history │ ├── CMakeLists.txt │ ├── applied_operation.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── operation_history │ │ │ ├── applied_operation.hpp │ │ │ ├── history_object.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── p2p │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── p2p │ │ │ └── p2p_plugin.hpp │ └── p2p_plugin.cpp ├── private_message │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── private_message │ │ │ ├── private_message_api_objects.hpp │ │ │ ├── private_message_evaluators.hpp │ │ │ ├── private_message_exceptions.hpp │ │ │ ├── private_message_objects.hpp │ │ │ ├── private_message_operations.hpp │ │ │ └── private_message_plugin.hpp │ ├── private_message_api_objects.cpp │ ├── private_message_operations.cpp │ └── private_message_plugin.cpp ├── raw_block │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── raw_block │ │ │ └── plugin.hpp │ └── plugin.cpp ├── social_network │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── social_network │ │ │ ├── social_network.hpp │ │ │ └── social_network_types.hpp │ └── social_network.cpp ├── statsd │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── statsd │ │ │ ├── plugin.hpp │ │ │ ├── runtime_bucket_object.hpp │ │ │ └── statistics_sender.hpp │ ├── plugin.cpp │ └── statistics_sender.cpp ├── tags │ ├── CMakeLists.txt │ ├── discussion_query.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── tags │ │ │ ├── discussion_query.hpp │ │ │ ├── plugin.hpp │ │ │ ├── tag_api_object.hpp │ │ │ ├── tag_visitor.hpp │ │ │ ├── tags_object.hpp │ │ │ └── tags_sort.hpp │ ├── plugin.cpp │ └── tag_visitor.cpp ├── test_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── test_api │ │ │ └── test_api_plugin.hpp │ └── test_api_plugin.cpp ├── webserver │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── webserver │ │ │ └── webserver_plugin.hpp │ └── webserver_plugin.cpp ├── witness │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── witness │ │ │ └── witness.hpp │ └── witness.cpp └── witness_api │ ├── CMakeLists.txt │ ├── include │ └── golos │ │ └── plugins │ │ └── witness_api │ │ ├── api_objects │ │ └── feed_history_api_object.hpp │ │ └── plugin.hpp │ └── plugin.cpp ├── programs ├── CMakeLists.txt ├── build_helpers │ ├── CMakeLists.txt │ ├── cat-parts.cpp │ ├── cat_parts.py │ ├── check_reflect.py │ └── configure_build.py ├── cli_wallet │ ├── CMakeLists.txt │ └── main.cpp ├── golosd │ ├── CMakeLists.txt │ └── main.cpp ├── js_operation_serializer │ ├── CMakeLists.txt │ └── main.cpp ├── size_checker │ ├── CMakeLists.txt │ └── main.cpp └── util │ ├── CMakeLists.txt │ ├── get_dev_key.cpp │ ├── inflation_model.cpp │ ├── inflation_plot.py │ ├── newplugin.py │ ├── pretty_schema.py │ ├── saltpass.py │ ├── schema_test.cpp │ ├── sign_digest.cpp │ ├── sign_transaction.cpp │ ├── test_block_log.cpp │ └── test_shared_mem.cpp ├── python_scripts ├── setup.py ├── steemdebugnode │ ├── __init__.py │ ├── debugnode.py │ └── private_testnet.py └── tests │ ├── debug_hardforks.py │ └── test_payouts.py ├── share └── golosd │ ├── config │ ├── config.ini │ ├── config_debug.ini │ ├── config_debug_mongo.ini │ ├── config_mongo.ini │ ├── config_stock_exchange.ini │ └── config_witness.ini │ ├── docker │ ├── Dockerfile-mongo │ ├── Dockerfile-small │ ├── Dockerfile-test │ ├── Dockerfile-testnet │ └── Dockerfile-testnet-mongo │ ├── golosd.sh │ ├── golosdctl │ ├── seednodes │ ├── seednodes_empty │ └── snapshot5392323.json ├── tests ├── CMakeLists.txt ├── README.md ├── common │ ├── comment_reward.hpp │ ├── database_fixture.cpp │ ├── database_fixture.hpp │ └── helpers.hpp ├── generate_empty_blocks │ └── CMakeLists.txt ├── plugin_tests │ ├── account_history.cpp │ ├── account_notes.cpp │ ├── chain.cpp │ ├── follow.cpp │ ├── json_rpc.cpp │ ├── main.cpp │ ├── market_history.cpp │ ├── operation_history.cpp │ ├── plugin_ops.cpp │ └── private_message.cpp └── tests │ ├── basic_tests.cpp │ ├── block_tests.cpp │ ├── hf17_tests.cpp │ ├── live_tests.cpp │ ├── main.cpp │ ├── operation_tests.cpp │ ├── operation_time_tests.cpp │ ├── proposal_tests.cpp │ ├── serialization_tests.cpp │ └── transit_tests.cpp └── thirdparty └── CMakeLists.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.so 3 | *.dylib 4 | *.sw* 5 | 6 | *.cmake 7 | CMakeCache.txt 8 | CMakeFiles 9 | Makefile 10 | compile_commands.json 11 | moc_* 12 | *.moc 13 | hardfork.hpp 14 | 15 | lcov 16 | 17 | libraries/utilities/git_revision.cpp 18 | 19 | libraries/wallet/Doxyfile 20 | libraries/wallet/api_documentation.cpp 21 | libraries/wallet/doxygen 22 | 23 | programs/cli_wallet/cli_wallet 24 | programs/js_operation_serializer/js_operation_serializer 25 | programs/golosd/golosd 26 | programs/golosd/test 27 | programs/delayed_node 28 | programs/build_helpers/cat-parts 29 | programs/size_checker/size_checker 30 | programs/util/get_dev_key 31 | programs/util/inflation_model 32 | 33 | tests/app_test 34 | tests/chain_bench 35 | tests/chain_test 36 | tests/plugin_test 37 | tests/intense_test 38 | tests/performance_test 39 | 40 | wallet.json 41 | witness_node_data_dir 42 | 43 | *.wallet 44 | 45 | documentation/doxygen/html 46 | documentation/doxygen/xml 47 | documentation/doxygen/latex 48 | 49 | *.pyc 50 | *.pyo 51 | *.egg-info/ 52 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "thirdparty/fc"] 2 | path = thirdparty/fc 3 | url = https://github.com/GolosChain/fc.git 4 | branch = 16.5 5 | [submodule "thirdparty/chainbase"] 6 | path = thirdparty/chainbase 7 | url = https://github.com/GolosChain/chainbase.git 8 | [submodule "thirdparty/appbase"] 9 | path = thirdparty/appbase 10 | url = https://github.com/GolosChain/appbase.git 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | language: cpp 4 | 5 | services: 6 | - docker 7 | 8 | before_install: 9 | - echo "$TRAVIS_TAG" 10 | - echo "$TRAVIS_BRANCH" 11 | 12 | env: 13 | - DOCKERFILE=Dockerfile DOCKERNAME="" 14 | - DOCKERFILE=share/golosd/docker/Dockerfile-test DOCKERNAME="-test" 15 | - DOCKERFILE=share/golosd/docker/Dockerfile-testnet DOCKERNAME="-testnet" 16 | - DOCKERFILE=share/golosd/docker/Dockerfile-mongo DOCKERNAME="-mongo" 17 | 18 | matrix: 19 | fast_finish: true 20 | 21 | script: 22 | - if [ "$TRAVIS_BRANCH" == "master" ]; then 23 | export DOCKERNAME="latest""$DOCKERNAME"; 24 | export EXPORTNAME="$DOCKERNAME"; 25 | elif [ -n "$TRAVIS_TAG" ]; then 26 | export DOCKERNAME="$TRAVIS_TAG""$DOCKERNAME"; 27 | export EXPORTNAME="$DOCKERNAME"; 28 | elif [ "$DOCKERNAME" == "-testnet" ] || [ "$DOCKERNAME" == "-test" ]; then 29 | export DOCKERNAME=develop"$DOCKERNAME"; 30 | else 31 | export DOCKERNAME=""; 32 | fi 33 | - echo "$DOCKERFILE" 34 | - echo "$DOCKERNAME" 35 | - if [ -n "$DOCKERNAME" ]; then 36 | docker build -t goloschain/golos:"$DOCKERNAME" -f "$DOCKERFILE" .; 37 | fi 38 | 39 | after_success: 40 | - echo "$EXPORTNAME" 41 | - docker images 42 | - if [ -n "$EXPORTNAME" ]; then 43 | docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; 44 | docker push goloschain/golos:"$EXPORTNAME"; 45 | fi 46 | - if [ "$TRAVIS_BRANCH" == "master" -a "$EXPORTNAME" == "latest" ]; then 47 | bash deploy/deploy.sh; 48 | fi 49 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Golos Core, and contributors. 2 | 3 | The following license applies to code contained within this repository that 4 | is created by Golos Core. Other copyright holders have licensed dependencies 5 | such as Graphene, FC, and Boost under their own individual licenses. 6 | 7 | The MIT License 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introducing Golos (beta) 2 | 3 | [![Build Status](https://travis-ci.org/GolosChain/golos.svg?branch=master)](https://travis-ci.org/GolosChain/golos) 4 | 5 | Golos is an experimental Proof of Work blockchain with an unproven consensus 6 | algorithm. 7 | 8 | # No Support & No Warranty 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 15 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 16 | IN THE SOFTWARE. 17 | 18 | # Code is Documentation 19 | 20 | Rather than attempt to describe the rules of the blockchain, it is up to 21 | each individual to inspect the code to understand the consensus rules. 22 | 23 | # Quickstart 24 | 25 | Just want to get up and running quickly? Try deploying a prebuilt dockerized container. 26 | 27 | ``` 28 | sudo docker run -d \ 29 | -p 4243:4243 \ 30 | -p 8090:8090 \ 31 | -p 8091:8091 \ 32 | --name golos-default goloschain/golos:latest 33 | ``` 34 | 35 | To attach to the golosd you should use the cli_wallet: 36 | ``` 37 | sudo docker exec -ti golos-default \ 38 | /usr/local/bin/cli_wallet \ 39 | --server-rpc-endpoint="ws://127.0.0.1:8091" 40 | ``` 41 | 42 | # Building 43 | 44 | See the [build instruction](https://github.com/GolosChain/golos/wiki/Build-instruction), which contains 45 | more information about configuring, building and running of docker containers. 46 | 47 | # Testing 48 | 49 | ``` 50 | git clone https://github.com/GolosChain/golos.git 51 | cd golos 52 | sudo docker rm local/golos-test 53 | sudo docker build -t local/golos-test -f share/golosd/docker/Dockerfile-test . 54 | ``` 55 | 56 | # Seed Nodes 57 | 58 | A list of some seed nodes to get you started can be found in 59 | [share/golosd/seednodes](share/golosd/seednodes). 60 | 61 | This same file is baked into the docker images and can be overridden by 62 | setting `STEEMD_SEED_NODES` in the container environment at `docker run` 63 | time to a whitespace delimited list of seed nodes (with port). 64 | -------------------------------------------------------------------------------- /deploy/config: -------------------------------------------------------------------------------- 1 | Host developers.golos.io 2 | User deploy 3 | IdentityFile ~/.ssh/id_rsa 4 | StrictHostKeyChecking no 5 | PasswordAuthentication no 6 | CheckHostIP no 7 | 8 | -------------------------------------------------------------------------------- /deploy/deploy-key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GolosChain/golos/fd80ef717057951de57aa677cd18ae5989163f80/deploy/deploy-key.enc -------------------------------------------------------------------------------- /deploy/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ $TRAVIS_BRANCH == "master" ]; then 6 | 7 | deploy/set-ssh.sh 8 | deploy/docs-deploy.sh --yes 9 | 10 | else 11 | echo "Nothing to deploy, since the current branch is not master." 12 | fi 13 | 14 | -------------------------------------------------------------------------------- /deploy/docs-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # blockchain 6 | 7 | git clone https://github.com/GolosChain/golos 8 | 9 | cd golos/ 10 | 11 | doxygen 12 | 13 | cd .. 14 | 15 | mkdir data 16 | mkdir data/doc 17 | 18 | cp -r golos/documentation/doxygen/html/* data/doc 19 | cd data/doc 20 | ln -s annotated.html blockchain.html 21 | cd ../.. 22 | 23 | 24 | # client 25 | 26 | git clone -b gh-pages --single-branch https://github.com/GolosChain/tolstoy gh-pages 27 | mv gh-pages/index.html gh-pages/client.html 28 | rm -rf gh-pages/.git/ 29 | rm gh-pages/{CNAME,README.md} 30 | cp -r gh-pages/* data/doc 31 | 32 | # testnet & doc 33 | 34 | git clone https://bitbucket.org/goloschainru/developers 35 | rm -rf developers/.git/ 36 | 37 | mv developers/testnet/index.html developers/testnet/testnet.html 38 | cp -r developers/testnet/* data/doc 39 | 40 | rm -rf developers/testnet/ 41 | cp -r developers/* data 42 | 43 | cd data 44 | 45 | git init 46 | 47 | # non-interactive mode 48 | 49 | if [ $1 == "--yes" ]; then 50 | VAR_DEPLOY="yes" 51 | else 52 | echo "---------------------------------------------------------------" 53 | echo -n "Deploy to developers.golos.io? (type \"yes\" or \"no\"): " 54 | read VAR_DEPLOY 55 | fi 56 | 57 | 58 | if [ $VAR_DEPLOY == "yes" ]; then 59 | 60 | git remote add deploy "deploy@developers.golos.io:/www" 61 | git config user.name "Docs_autodeploy" 62 | git config user.email "goloschain@gmail.com" 63 | 64 | git add . 65 | git commit -m "Deploy" 66 | git push --force deploy master 67 | 68 | fi 69 | -------------------------------------------------------------------------------- /deploy/set-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -n $TRAVIS_BRANCH ]; then 6 | 7 | cd deploy/ 8 | 9 | openssl aes-256-cbc -K $encrypted_key -iv $encrypted_iv -in deploy-key.enc -out deploy-key -d 10 | 11 | rm deploy-key.enc 12 | 13 | chmod 600 deploy-key 14 | mv deploy-key ~/.ssh/id_rsa 15 | 16 | chmod 600 config 17 | mv config ~/.ssh/config 18 | 19 | cd .. 20 | 21 | else 22 | 23 | echo "Only for Travis-CI !!!" 24 | 25 | fi 26 | 27 | -------------------------------------------------------------------------------- /documentation/doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /documentation/doxygen/images/golos.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /documentation/plugin.md: -------------------------------------------------------------------------------- 1 | 2 | How plugins work 3 | ---------------- 4 | 5 | All plugins in the `libraries/plugins` directory are iterated over by `CMakeLists.txt` and placed in a CMake environment variable `STEEMIT_INTERNAL_PLUGINS`, which is used to create a runtime-accessible list of available plugins used by the argument parsing. 6 | 7 | Similarly, `external_plugins` is set aside for third-party plugins. Just drop plugin code into `external_plugins` directory, `make steemd`, and the new plugin will be available. 8 | 9 | There is a plugin in `example_plugins` called `hello_api` which is a working example of adding a custom API call. 10 | 11 | Registering plugins 12 | ------------------- 13 | 14 | - Plugins are enabled with the `enable-plugin` config file option. 15 | - When specifying plugins, you should specify `witness` and `account_history` in addition to the new plugins. 16 | - Some plugins may keep records in the database (currently only `account_history` does). If you change whether such a plugin is disabled/enabled, you should also replay the chain. Detecting this situation and automatically replaying when needed will be implemented in a future release. 17 | - If you want to make API's available publicly, you must use the `public-api` option. 18 | - When specifying public API's, you should specify `database_api` and `login_api` in addition to the new plugins. 19 | - The `api-user` option allows for password protected access to an API. 20 | 21 | Autogenerating code 22 | ------------------- 23 | 24 | A skeleton structure containing much of the boilerplate of creating a new plugin with an API can be autogenerated by running `programs/util/newplugin.py`. 25 | 26 | - Register signal handlers in `plugin_startup()` (if needed) 27 | - Add methods to `myplugin_api` class and reflect them in `FC_API` declaration 28 | -------------------------------------------------------------------------------- /documentation/testing.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | The unit test target is `make chain_test` 4 | This creates an executable `./tests/chain_test` that will run all unit tests. 5 | 6 | Tests are broken in several categories: 7 | ``` 8 | basic_tests // Tests of "basic" functionality 9 | block_tests // Tests of the block chain 10 | live_tests // Tests on live chain data (currently only past hardfork testing) 11 | operation_tests // Unit Tests of Golos operations 12 | operation_time_tests // Tests of Golos operations that include a time based component (ex. vesting withdrawals) 13 | serialization_tests // Tests related of serialization 14 | ``` 15 | 16 | ## Configuration (draft) 17 | 18 | Some config options: 19 | * `log_level` — allows setting the log level. Available values: `all`, `success`, `test_suite`, `message`, `warning`, . `error`, `cpp_exception`, `system_error`, `fatal_error`, `nothing`. Sample usage: `--log-level=test_suite` 20 | * `report_level` — allows setting the level of detailization for the testing results report. Available values: `no`, `confirm`, `short`, `detailed`. Sample usage: `--report_level=detailed` 21 | * `run_test` — specifies which test units to run. You can specify individual test (separated with comma) or test cases. Sample usage: `--run_test=operation_tests/delegation` 22 | 23 | For more info about runtime config check [Boost.Tests documentation](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/utf/user-guide/runtime-config/reference.html). 24 | 25 | 26 | # Code Coverage Testing 27 | 28 | If you have not done so, install lcov `brew install lcov` 29 | 30 | ``` 31 | cmake -D BUILD_GOLOS_TESTNET=ON -D ENABLE_COVERAGE_TESTING=true -D CMAKE_BUILD_TYPE=Debug . 32 | make 33 | lcov --capture --initial --directory . --output-file base.info --no-external 34 | tests/chain_test 35 | lcov --capture --directory . --output-file test.info --no-external 36 | lcov --add-tracefile base.info --add-tracefile test.info --output-file total.info 37 | lcov -o interesting.info -r total.info tests/\* 38 | mkdir -p lcov 39 | genhtml interesting.info --output-directory lcov --prefix `pwd` 40 | ``` 41 | 42 | Now open `lcov/index.html` in a browser 43 | -------------------------------------------------------------------------------- /libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(api) 2 | add_subdirectory(chain) 3 | add_subdirectory(protocol) 4 | add_subdirectory(network) 5 | add_subdirectory(time) 6 | add_subdirectory(utilities) 7 | add_subdirectory(wallet) 8 | -------------------------------------------------------------------------------- /libraries/api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/api/account_api_object.hpp 5 | include/golos/api/comment_api_object.hpp 6 | include/golos/api/chain_api_properties.hpp 7 | include/golos/api/witness_api_object.hpp 8 | include/golos/api/discussion.hpp 9 | include/golos/api/vote_state.hpp 10 | include/golos/api/account_vote.hpp 11 | include/golos/api/discussion_helper.hpp 12 | include/golos/api/block_objects.hpp 13 | ) 14 | 15 | list(APPEND CURRENT_TARGET_SOURCES 16 | account_api_object.cpp 17 | discussion_helper.cpp 18 | chain_api_properties.cpp 19 | witness_api_object.cpp 20 | block_objects.cpp 21 | ) 22 | 23 | if(BUILD_SHARED_LIBRARIES) 24 | add_library(golos_${CURRENT_TARGET} SHARED 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | else() 29 | add_library(golos_${CURRENT_TARGET} STATIC 30 | ${CURRENT_TARGET_HEADERS} 31 | ${CURRENT_TARGET_SOURCES} 32 | ) 33 | endif() 34 | 35 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 36 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 37 | 38 | target_link_libraries( 39 | golos_${CURRENT_TARGET} 40 | golos_chain 41 | golos_protocol 42 | graphene_utilities 43 | fc 44 | ) 45 | 46 | target_include_directories(golos_${CURRENT_TARGET} 47 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 48 | 49 | install(TARGETS 50 | golos_${CURRENT_TARGET} 51 | 52 | RUNTIME DESTINATION bin 53 | LIBRARY DESTINATION lib 54 | ARCHIVE DESTINATION lib 55 | ) -------------------------------------------------------------------------------- /libraries/api/block_objects.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | 5 | block_operation::block_operation() = default; 6 | 7 | annotated_signed_block::annotated_signed_block() = default; 8 | 9 | annotated_signed_block::annotated_signed_block(const signed_block& block) 10 | : signed_block(block) { 11 | block_id = id(); 12 | signing_key = signee(); 13 | transaction_ids.reserve(transactions.size()); 14 | for (const signed_transaction& tx : transactions) { 15 | transaction_ids.push_back(tx.id()); 16 | } 17 | } 18 | 19 | annotated_signed_block::annotated_signed_block(const signed_block& block, const block_operations& ops) 20 | : annotated_signed_block(block) { 21 | _virtual_operations = ops; 22 | } 23 | 24 | } } // golos::api -------------------------------------------------------------------------------- /libraries/api/chain_api_properties.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | 5 | chain_api_properties::chain_api_properties( 6 | const chain_properties& src, 7 | const database& db 8 | ) : account_creation_fee(src.account_creation_fee), 9 | maximum_block_size(src.maximum_block_size), 10 | sbd_interest_rate(src.sbd_interest_rate) 11 | { 12 | if (db.has_hardfork(STEEMIT_HARDFORK_0_18__673)) { 13 | create_account_min_golos_fee = src.create_account_min_golos_fee; 14 | create_account_min_delegation = src.create_account_min_delegation; 15 | create_account_delegation_time = src.create_account_delegation_time; 16 | min_delegation = src.min_delegation; 17 | } 18 | if (db.has_hardfork(STEEMIT_HARDFORK_0_19)) { 19 | max_referral_interest_rate = src.max_referral_interest_rate; 20 | max_referral_term_sec = src.max_referral_term_sec; 21 | min_referral_break_fee = src.min_referral_break_fee; 22 | max_referral_break_fee = src.max_referral_break_fee; 23 | posts_window = src.posts_window; 24 | posts_per_window = src.posts_per_window; 25 | comments_window = src.comments_window; 26 | comments_per_window = src.comments_per_window; 27 | votes_window = src.votes_window; 28 | votes_per_window = src.votes_per_window; 29 | auction_window_size = src.auction_window_size; 30 | max_delegated_vesting_interest_rate = src.max_delegated_vesting_interest_rate; 31 | custom_ops_bandwidth_multiplier = src.custom_ops_bandwidth_multiplier; 32 | min_curation_percent = src.min_curation_percent; 33 | max_curation_percent = src.max_curation_percent; 34 | curation_reward_curve = src.curation_reward_curve; 35 | allow_distribute_auction_reward = src.allow_distribute_auction_reward; 36 | allow_return_auction_reward_to_fund = src.allow_return_auction_reward_to_fund; 37 | } 38 | } 39 | 40 | } } // golos::api 41 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/account_vote.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace api { 7 | 8 | struct account_vote { 9 | std::string authorperm; 10 | uint64_t weight = 0; 11 | int64_t rshares = 0; 12 | int16_t percent = 0; 13 | fc::time_point_sec time; 14 | }; 15 | 16 | } } // golos::api 17 | 18 | 19 | 20 | FC_REFLECT((golos::api::account_vote), (authorperm)(weight)(rshares)(percent)(time)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/block_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace golos { namespace api { 10 | 11 | using namespace golos::protocol; 12 | using golos::chain::operation_notification; 13 | 14 | // block_operation used in block_applied_callback to represent virtual operations. 15 | // default operation type have no position info (trx, op_in_trx) 16 | struct block_operation { 17 | 18 | block_operation(); 19 | 20 | block_operation(const operation_notification& o) : 21 | trx_in_block(o.trx_in_block), 22 | op_in_trx(o.op_in_trx), 23 | virtual_op(o.virtual_op), 24 | op(o.op) {}; 25 | 26 | uint32_t trx_in_block = 0; 27 | uint16_t op_in_trx = 0; 28 | uint32_t virtual_op = 0; 29 | operation op; 30 | }; 31 | 32 | using block_operations = std::vector; 33 | 34 | struct annotated_signed_block : public signed_block { 35 | 36 | annotated_signed_block(); 37 | 38 | annotated_signed_block(const signed_block& block); 39 | 40 | annotated_signed_block(const signed_block& block, const block_operations& ops); 41 | 42 | annotated_signed_block(const annotated_signed_block& block) = default; 43 | 44 | block_id_type block_id; 45 | public_key_type signing_key; 46 | vector transaction_ids; 47 | 48 | // name field starting with _ coz it's not directly related to block 49 | optional _virtual_operations; 50 | }; 51 | 52 | } } // golos::api 53 | 54 | 55 | FC_REFLECT((golos::api::block_operation), 56 | (trx_in_block)(op_in_trx)(virtual_op)(op)) 57 | FC_REFLECT_DERIVED((golos::api::annotated_signed_block), ((golos::chain::signed_block)), 58 | (block_id)(signing_key)(transaction_ids)(_virtual_operations)) 59 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/discussion_helper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace api { 8 | struct comment_metadata { 9 | std::set tags; 10 | std::string language; 11 | }; 12 | 13 | class discussion_helper { 14 | public: 15 | discussion_helper() = delete; 16 | discussion_helper( 17 | golos::chain::database& db, 18 | std::function&)> fill_reputation, 19 | std::function fill_promoted, 20 | std::function fill_comment_info 21 | ); 22 | ~discussion_helper(); 23 | 24 | std::vector select_active_votes( 25 | const std::string& author, const std::string& permlink, uint32_t limit, uint32_t offset 26 | ) const; 27 | 28 | discussion create_discussion(const std::string& author) const; 29 | 30 | discussion create_discussion(const comment_object& o) const; 31 | 32 | discussion get_discussion(const comment_object& c, uint32_t vote_limit, uint32_t offset) const; 33 | 34 | comment_api_object create_comment_api_object(const comment_object& o) const; 35 | 36 | void fill_discussion(discussion&, const comment_object&, uint32_t vote_limit, uint32_t offset) const; 37 | 38 | void fill_comment_api_object(const comment_object& o, comment_api_object& d) const; 39 | 40 | 41 | private: 42 | struct impl; 43 | std::unique_ptr pimpl; 44 | }; 45 | 46 | } } // golos::api 47 | 48 | FC_REFLECT((golos::api::comment_metadata), (tags)(language)) 49 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/reblog_entry.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace api { 6 | 7 | struct reblog_entry { 8 | account_name_type author; 9 | std::string title; 10 | std::string body; 11 | std::string json_metadata; 12 | 13 | reblog_entry() = default; 14 | 15 | reblog_entry(const account_name_type& author_, const std::string& title_, const std::string& body_, 16 | const std::string& json_metadata_) 17 | : author(author_), title(title_), body(body_), json_metadata(json_metadata_) { 18 | } 19 | }; 20 | 21 | } } // golos::api 22 | 23 | FC_REFLECT((golos::api::reblog_entry), (author)(title)(body)(json_metadata)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/vote_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace golos { namespace api { 6 | using golos::protocol::share_type; 7 | struct vote_state { 8 | string voter; 9 | uint64_t weight = 0; 10 | int64_t rshares = 0; 11 | int16_t percent = 0; 12 | fc::optional reputation; 13 | time_point_sec time; 14 | }; 15 | 16 | } } // golos::api 17 | 18 | 19 | FC_REFLECT((golos::api::vote_state), (voter)(weight)(rshares)(percent)(reputation)(time)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/witness_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace api { 8 | using namespace golos::chain; 9 | 10 | struct witness_api_object { 11 | witness_api_object(const witness_object &w, const database& db); 12 | 13 | witness_api_object() = default; 14 | 15 | witness_object::id_type id; 16 | account_name_type owner; 17 | time_point_sec created; 18 | std::string url; 19 | uint32_t total_missed; 20 | uint64_t last_aslot; 21 | uint64_t last_confirmed_block_num; 22 | uint64_t pow_worker; 23 | public_key_type signing_key; 24 | api::chain_api_properties props; 25 | price sbd_exchange_rate; 26 | time_point_sec last_sbd_exchange_update; 27 | share_type votes; 28 | fc::uint128_t virtual_last_update; 29 | fc::uint128_t virtual_position; 30 | fc::uint128_t virtual_scheduled_time; 31 | digest_type last_work; 32 | version running_version; 33 | hardfork_version hardfork_version_vote; 34 | time_point_sec hardfork_time_vote; 35 | time_point_sec transit_to_cyberway_vote = STEEMIT_GENESIS_TIME; 36 | }; 37 | 38 | } } // golos::api 39 | 40 | 41 | FC_REFLECT( 42 | (golos::api::witness_api_object), 43 | (id)(owner)(created)(url)(votes)(virtual_last_update)(virtual_position)(virtual_scheduled_time) 44 | (total_missed)(last_aslot)(last_confirmed_block_num)(pow_worker)(signing_key)(props) 45 | (sbd_exchange_rate)(last_sbd_exchange_update)(last_work)(running_version)(hardfork_version_vote) 46 | (hardfork_time_vote)(transit_to_cyberway_vote)) -------------------------------------------------------------------------------- /libraries/api/witness_api_object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | witness_api_object::witness_api_object(const witness_object &w, const database& db) 5 | : id(w.id), owner(w.owner), created(w.created), 6 | url(to_string(w.url)), total_missed(w.total_missed), last_aslot(w.last_aslot), 7 | last_confirmed_block_num(w.last_confirmed_block_num), pow_worker(w.pow_worker), 8 | signing_key(w.signing_key), props(w.props, db), sbd_exchange_rate(w.sbd_exchange_rate), 9 | last_sbd_exchange_update(w.last_sbd_exchange_update), votes(w.votes), 10 | virtual_last_update(w.virtual_last_update), virtual_position(w.virtual_position), 11 | virtual_scheduled_time(w.virtual_scheduled_time), last_work(w.last_work), 12 | running_version(w.running_version), hardfork_version_vote(w.hardfork_version_vote), 13 | hardfork_time_vote(w.hardfork_time_vote), transit_to_cyberway_vote(w.transit_to_cyberway_vote) { 14 | } 15 | } } // golos::api -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0-preamble.hf: -------------------------------------------------------------------------------- 1 | /***************************************** 2 | * * 3 | * This file is automatically generated. * 4 | * To create new hardfork, please modify * 5 | * the .hf files in hardfork.d instead * 6 | * of modifying this file. * 7 | * * 8 | *****************************************/ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | namespace golos { 16 | namespace chain { 17 | 18 | class hardfork_property_object 19 | : public object { 20 | public: 21 | template 22 | hardfork_property_object(Constructor &&c, allocator a) 23 | :processed_hardforks(a.get_segment_manager()) { 24 | c(*this); 25 | } 26 | 27 | id_type id; 28 | 29 | boost::interprocess::vector > processed_hardforks; 30 | uint32_t last_hardfork = 0; 31 | protocol::hardfork_version current_hardfork_version; 32 | protocol::hardfork_version next_hardfork; 33 | fc::time_point_sec next_hardfork_time; 34 | }; 35 | 36 | typedef multi_index_container < 37 | hardfork_property_object, 38 | indexed_by< 39 | ordered_unique < member < 40 | hardfork_property_object, hardfork_property_object::id_type, &hardfork_property_object::id>> 41 | >, 42 | allocator 43 | > 44 | hardfork_property_index; 45 | 46 | } 47 | } // namespace golos::chain 48 | 49 | FC_REFLECT((golos::chain::hardfork_property_object), 50 | (id)(processed_hardforks)(last_hardfork)(current_hardfork_version) 51 | (next_hardfork)(next_hardfork_time)) 52 | CHAINBASE_SET_INDEX_TYPE( golos::chain::hardfork_property_object, golos::chain::hardfork_property_index) 53 | 54 | #define STEEMIT_NUM_HARDFORKS 21 55 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_1.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_1 2 | #define STEEMIT_HARDFORK_0_1 1 3 | #define STEEMIT_HARDFORK_0_1_TIME 1476788420 4 | #define STEEMIT_HARDFORK_0_1_VERSION hardfork_version( 0, 1 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_10.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_10 2 | #define STEEMIT_HARDFORK_0_10 10 3 | #define STEEMIT_HARDFORK_0_10__141 STEEMIT_HARDFORK_0_10 4 | #define STEEMIT_HARDFORK_0_10__149 STEEMIT_HARDFORK_0_10 5 | 6 | #define STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10 fc::seconds(60*30) /// 30 min 7 | #define STEEMIT_HARDFORK_0_10_TIME 1476788600 //2016-07-15T12:00:00 UTC 8 | #define STEEMIT_HARDFORK_0_10_VERSION hardfork_version( 0, 10 ) 9 | #endif 10 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_11.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_11 2 | #define STEEMIT_HARDFORK_0_11 11 3 | #define STEEMIT_HARDFORK_0_11__169 STEEMIT_HARDFORK_0_11 4 | 5 | #define STEEMIT_HARDFORK_0_11_TIME 1476788620 // 2016-07-17T15:00:00 UTC (11:00:00 EDT) 6 | #define STEEMIT_HARDFORK_0_11_VERSION hardfork_version( 0, 11 ) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_12.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_12 2 | #define STEEMIT_HARDFORK_0_12 12 3 | #define STEEMIT_HARDFORK_0_12__176 (STEEMIT_HARDFORK_0_12) 4 | #define STEEMIT_HARDFORK_0_12__177 (STEEMIT_HARDFORK_0_12) 5 | #define STEEMIT_HARDFORK_0_12__178 (STEEMIT_HARDFORK_0_12) 6 | #define STEEMIT_HARDFORK_0_12__179 (STEEMIT_HARDFORK_0_12) 7 | 8 | #define STEEMIT_HARDFORK_0_12_TIME 1476788640 9 | #define STEEMIT_HARDFORK_0_12_VERSION hardfork_version( 0, 12 ) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_13.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_13 2 | #define STEEMIT_HARDFORK_0_13 13 3 | #define STEEMIT_HARDFORK_0_13__248 (STEEMIT_HARDFORK_0_13) 4 | #define STEEMIT_HARDFORK_0_13__256 (STEEMIT_HARDFORK_0_13) 5 | #define STEEMIT_HARDFORK_0_13__257 (STEEMIT_HARDFORK_0_13) 6 | 7 | #define STEEMIT_HARDFORK_0_13_TIME 1476788660 8 | #define STEEMIT_HARDFORK_0_13_VERSION hardfork_version( 0, 13 ) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_14.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_14 2 | #define STEEMIT_HARDFORK_0_14 14 3 | #define STEEMIT_HARDFORK_0_14__324 (STEEMIT_HARDFORK_0_14) 4 | 5 | #define STEEMIT_HARDFORK_0_14__143 (STEEMIT_HARDFORK_0_14) 6 | #define STEEMIT_HARDFORK_0_14__230 (STEEMIT_HARDFORK_0_14) 7 | #define STEEMIT_HARDFORK_0_14__239 (STEEMIT_HARDFORK_0_14) 8 | #define STEEMIT_HARDFORK_0_14__259 (STEEMIT_HARDFORK_0_14) 9 | #define STEEMIT_HARDFORK_0_14__278 (STEEMIT_HARDFORK_0_14) 10 | #define STEEMIT_HARDFORK_0_14__306 (STEEMIT_HARDFORK_0_14) 11 | #define STEEMIT_HARDFORK_0_14__307 (STEEMIT_HARDFORK_0_14) 12 | #define STEEMIT_HARDFORK_0_14__317 (STEEMIT_HARDFORK_0_14) 13 | #define STEEMIT_HARDFORK_0_14__327 (STEEMIT_HARDFORK_0_14) 14 | #define STEEMIT_HARDFORK_0_14__240 (STEEMIT_HARDFORK_0_14) 15 | #define STEEMIT_HARDFORK_0_14__410 (STEEMIT_HARDFORK_0_14) 16 | 17 | #define STEEMIT_HARDFORK_0_14_TIME 1476788680 18 | 19 | #define STEEMIT_HARDFORK_0_14_VERSION hardfork_version( 0, 14 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_15.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_15 2 | #define STEEMIT_HARDFORK_0_15 15 3 | #define STEEMIT_HARDFORK_0_15__465 (STEEMIT_HARDFORK_0_15) 4 | 5 | #ifdef STEEMIT_BUILD_TESTNET 6 | #define STEEMIT_HARDFORK_0_15_TIME 1488196780 7 | #else 8 | #define STEEMIT_HARDFORK_0_15_TIME 1488369000 9 | #endif 10 | 11 | #define STEEMIT_HARDFORK_0_15_VERSION hardfork_version( 0, 15 ) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_17.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_17 2 | #define STEEMIT_HARDFORK_0_17 17 3 | #define STEEMIT_HARDFORK_0_17__430 (STEEMIT_HARDFORK_0_17) // Remove comment depth limit 4 | #define STEEMIT_HARDFORK_0_17__431 (STEEMIT_HARDFORK_0_17) // Single cachout window 5 | #define STEEMIT_HARDFORK_0_17__432 (STEEMIT_HARDFORK_0_17) // Comment reward beneficiaries 6 | #define STEEMIT_HARDFORK_0_17__433 (STEEMIT_HARDFORK_0_17) // Linear reward curve 7 | 8 | #ifdef STEEMIT_BUILD_TESTNET 9 | #define STEEMIT_HARDFORK_0_17_TIME 1519894800 // 1 mar 2018 12:00:00 MSK 10 | #else 11 | #define STEEMIT_HARDFORK_0_17_TIME 1522832400 // 4 apr 2018 12:00:00 MSK 12 | #endif 13 | 14 | #define STEEMIT_HARDFORK_0_17_VERSION hardfork_version( 0, 17 ) 15 | 16 | #define STEEMIT_HF_17_NUM_POSTS (50000) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_18.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_18 2 | #define STEEMIT_HARDFORK_0_18 18 3 | #define STEEMIT_HARDFORK_0_18__196 (STEEMIT_HARDFORK_0_18) // Split json_metadata from account object 4 | #define STEEMIT_HARDFORK_0_18__220 (STEEMIT_HARDFORK_0_18) // Witness price feed expire 5 | #define STEEMIT_HARDFORK_0_18__535 (STEEMIT_HARDFORK_0_18) // Golos Power delegation 6 | #define STEEMIT_HARDFORK_0_18__536 (STEEMIT_HARDFORK_0_18) // Comments should be editable forever 7 | #define STEEMIT_HARDFORK_0_18__542 (STEEMIT_HARDFORK_0_18) // Proposal transactions 8 | #define STEEMIT_HARDFORK_0_18__673 (STEEMIT_HARDFORK_0_18) // Votable delegation params 9 | 10 | #ifdef STEEMIT_BUILD_TESTNET 11 | #define STEEMIT_HARDFORK_0_18_TIME 1523869200 // 16 apr 2018 12:00:00 MSK 12 | #else 13 | #define STEEMIT_HARDFORK_0_18_TIME 1529485200 // 20 jun 2018 12:00:00 MSK 14 | #endif 15 | 16 | #define STEEMIT_HARDFORK_0_18_VERSION hardfork_version( 0, 18 ) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_19.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_19 2 | #define STEEMIT_HARDFORK_0_19 19 3 | #define STEEMIT_HARDFORK_0_19__898 (STEEMIT_HARDFORK_0_19) // Add votable auction window size 4 | #define STEEMIT_HARDFORK_0_19__295 (STEEMIT_HARDFORK_0_19) // Referral program implemented 5 | #define STEEMIT_HARDFORK_0_19__533_1002 (STEEMIT_HARDFORK_0_19) // Leaky algorithm for comment, vote and post bandwidth 6 | #define STEEMIT_HARDFORK_0_19__756 (STEEMIT_HARDFORK_0_19) // Vesting shares delegation with interest 7 | #define STEEMIT_HARDFORK_0_19__971 (STEEMIT_HARDFORK_0_19) // Withdraw vests to another account resests on account recover 8 | #define STEEMIT_HARDFORK_0_19__924 (STEEMIT_HARDFORK_0_19) // Bandwidth for custom_json operations 9 | #define STEEMIT_HARDFORK_0_19__952 (STEEMIT_HARDFORK_0_19) // Stop the GBG emission if its count is more than 10% 10 | #define STEEMIT_HARDFORK_0_19__324 (STEEMIT_HARDFORK_0_19) // Add curation rewards percent setting by post author 11 | #define STEEMIT_HARDFORK_0_19__677 (STEEMIT_HARDFORK_0_19) // Allow to select curation reward curve 12 | 13 | #ifdef STEEMIT_BUILD_TESTNET 14 | #define STEEMIT_HARDFORK_0_19_TIME 1534755600 // 20 aug 2018 12:00:00 MSK 15 | #else 16 | #define STEEMIT_HARDFORK_0_19_TIME 1544778000 // 14 dec 2018 12:00:00 MSK 17 | #endif 18 | 19 | #define STEEMIT_HARDFORK_0_19_VERSION hardfork_version( 0, 19 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_2.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_2 2 | #define STEEMIT_HARDFORK_0_2 2 3 | #define STEEMIT_HARDFORK_0_2_TIME 1476788440 4 | #define STEEMIT_HARDFORK_0_2_VERSION hardfork_version( 0, 2 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_20.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_20 2 | #define STEEMIT_HARDFORK_0_20 20 3 | #define STEEMIT_HARDFORK_0_20__1074 (STEEMIT_HARDFORK_0_20) // Blockchain stopped due to negative payment of curator reward 4 | #define STEEMIT_HARDFORK_0_20__1075 (STEEMIT_HARDFORK_0_20) // Author can change curation percent after voting on post 5 | 6 | #ifdef STEEMIT_BUILD_TESTNET 7 | #define STEEMIT_HARDFORK_0_20_TIME 1547701200 // 17 jan 2019 12:00:00 MSK 8 | #else 9 | #define STEEMIT_HARDFORK_0_20_TIME 1547787600 // 18 jan 2019 12:00:00 MSK 10 | #endif 11 | 12 | #define STEEMIT_HARDFORK_0_20_VERSION hardfork_version( 0, 20 ) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_21.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_21 2 | #define STEEMIT_HARDFORK_0_21 21 3 | 4 | #define STEEMIT_HARDFORK_0_21__1348 (STEEMIT_HARDFORK_0_21) // Transit to CyberWay 5 | 6 | 7 | #ifdef STEEMIT_BUILD_TESTNET 8 | #define STEEMIT_HARDFORK_0_21_TIME 1563613200 // 20 jul 2019 12:00:00 MSK 9 | #else 10 | #define STEEMIT_HARDFORK_0_21_TIME 1565859600 // 15 aug 2019 12:00:00 MSK 11 | #endif 12 | 13 | #define STEEMIT_HARDFORK_0_21_VERSION hardfork_version( 0, 21 ) 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_3.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_3 2 | #define STEEMIT_HARDFORK_0_3 3 3 | #define STEEMIT_HARDFORK_0_3_TIME 1476788460 4 | #define STEEMIT_HARDFORK_0_3_VERSION hardfork_version( 0, 3 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_4.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_4 2 | #define STEEMIT_HARDFORK_0_4 4 3 | #define STEEMIT_HARDFORK_0_4_TIME 1476788480 4 | #define STEEMIT_HARDFORK_0_4_VERSION hardfork_version( 0, 4 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_5.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_5 2 | #define STEEMIT_HARDFORK_0_5 5 3 | #define STEEMIT_HARDFORK_0_5__22 ( STEEMIT_HARDFORK_0_5 ) 4 | #define STEEMIT_HARDFORK_0_5__54 ( STEEMIT_HARDFORK_0_5 ) 5 | #define STEEMIT_HARDFORK_0_5__55 ( STEEMIT_HARDFORK_0_5 ) 6 | #define STEEMIT_HARDFORK_0_5__56 ( STEEMIT_HARDFORK_0_5 ) 7 | #define STEEMIT_HARDFORK_0_5__57 ( STEEMIT_HARDFORK_0_5 ) 8 | #define STEEMIT_HARDFORK_0_5__59 ( STEEMIT_HARDFORK_0_5 ) 9 | #define STEEMIT_HARDFORK_0_5__62 ( STEEMIT_HARDFORK_0_5 ) 10 | #define STEEMIT_HARDFORK_0_5_TIME 1476788500 11 | #define STEEMIT_HARDFORK_0_5_VERSION hardfork_version( 0, 5 ) 12 | #endif 13 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_6.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_6 2 | #define STEEMIT_HARDFORK_0_6 6 3 | #define STEEMIT_HARDFORK_0_6__74 STEEMIT_HARDFORK_0_6 4 | #define STEEMIT_HARDFORK_0_6__78 STEEMIT_HARDFORK_0_6 5 | #define STEEMIT_HARDFORK_0_6__80 STEEMIT_HARDFORK_0_6 6 | #define STEEMIT_HARDFORK_0_6__101 STEEMIT_HARDFORK_0_6 7 | #define STEEMIT_HARDFORK_0_6__104 STEEMIT_HARDFORK_0_6 8 | #define STEEMIT_HARDFORK_0_6__112 STEEMIT_HARDFORK_0_6 9 | #define STEEMIT_HARDFORK_0_6__113 STEEMIT_HARDFORK_0_6 10 | #define STEEMIT_HARDFORK_0_6__114 STEEMIT_HARDFORK_0_6 11 | #define STEEMIT_HARDFORK_0_6__127 STEEMIT_HARDFORK_0_6 12 | 13 | #define STEEMIT_HARDFORK_0_6_TIME 1476788520 14 | #define STEEMIT_HARDFORK_0_6_REVERSE_AUCTION_TIME (1476788510) 15 | #define STEEMIT_HARDFORK_0_6_VERSION hardfork_version( 0, 6 ) 16 | #endif 17 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_7.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_7 2 | #define STEEMIT_HARDFORK_0_7 7 3 | #define STEEMIT_HARDFORK_0_7__117 STEEMIT_HARDFORK_0_7 4 | 5 | #define STEEMIT_HARDFORK_0_7_TIME 1476788540 6 | #define STEEMIT_HARDFORK_0_7_VERSION hardfork_version( 0, 7 ) 7 | #endif 8 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_8.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_8 2 | #define STEEMIT_HARDFORK_0_8 8 3 | #define STEEMIT_HARDFORK_0_8__116 STEEMIT_HARDFORK_0_8 4 | 5 | #define STEEMIT_HARDFORK_0_8_TIME 1476788560 6 | #define STEEMIT_HARDFORK_0_8_VERSION hardfork_version( 0, 8 ) 7 | #endif 8 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_9.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_9 2 | #define STEEMIT_HARDFORK_0_9 9 3 | #define STEEMIT_HARDFORK_0_9__141 STEEMIT_HARDFORK_0_9 4 | 5 | #define STEEMIT_HARDFORK_0_9_TIME 1476788580 6 | #define STEEMIT_HARDFORK_0_9_VERSION hardfork_version( 0, 9 ) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/block_summary_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | using golos::protocol::block_id_type; 9 | 10 | /** 11 | * @brief tracks minimal information about past blocks to implement TaPOS 12 | * @ingroup object 13 | * 14 | * When attempting to calculate the validity of a transaction we need to 15 | * lookup a past block and check its block hash and the time it occurred 16 | * so we can calculate whether the current transaction is valid and at 17 | * what time it should expire. 18 | */ 19 | class block_summary_object 20 | : public object { 21 | public: 22 | template 23 | block_summary_object(Constructor &&c, allocator a) { 24 | c(*this); 25 | } 26 | 27 | block_summary_object() { 28 | }; 29 | 30 | id_type id; 31 | block_id_type block_id; 32 | }; 33 | 34 | typedef multi_index_container < 35 | block_summary_object, 36 | indexed_by< 37 | ordered_unique < tag < by_id>, 38 | member> 39 | >, 40 | allocator 41 | > 42 | block_summary_index; 43 | 44 | } 45 | } // golos::chain 46 | 47 | FC_REFLECT((golos::chain::block_summary_object), (id)(block_id)) 48 | CHAINBASE_SET_INDEX_TYPE(golos::chain::block_summary_object, golos::chain::block_summary_index) 49 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/curation_info.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | struct comment_vote_info { 9 | const comment_vote_object* vote = nullptr; 10 | uint64_t weight = 0; ///< defines the score this vote receives, used by vote payout calc. 0 if a negative vote or changed votes. 11 | }; // struct comment_vote_info 12 | 13 | struct comment_curation_info { 14 | const comment_object& comment; 15 | 16 | std::vector vote_list; 17 | 18 | uint64_t total_vote_weight = 0; ///< The total weight of voting rewards, used to calculate pro-rata share of curation payouts 19 | uint64_t auction_window_weight = 0; ///< The weight of auction window without weight of voters 20 | uint64_t votes_in_auction_window_weight = 0; ///< The weight of votes in auction window 21 | uint64_t votes_after_auction_window_weight = 0; 22 | protocol::curation_curve curve = protocol::curation_curve::detect; 23 | 24 | comment_curation_info(comment_curation_info&&) = default; 25 | comment_curation_info(const comment_curation_info&) = delete; 26 | 27 | comment_curation_info(database& db, const comment_object&, bool); 28 | }; // struct comment_curation_info 29 | 30 | } } // namespace golos::chain -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/custom_operation_interpreter.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace schema { 8 | struct abstract_schema; 9 | } 10 | } 11 | 12 | namespace golos { 13 | namespace protocol { 14 | struct custom_json_operation; 15 | } 16 | } 17 | 18 | namespace golos { 19 | namespace chain { 20 | 21 | class custom_operation_interpreter { 22 | public: 23 | virtual void apply(const protocol::custom_json_operation &op) = 0; 24 | 25 | virtual void apply(const protocol::custom_binary_operation &op) = 0; 26 | }; 27 | 28 | } 29 | } // golos::chain 30 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/evaluator_registry.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | template 9 | class evaluator_registry { 10 | public: 11 | evaluator_registry(database &d) 12 | : _db(d) { 13 | for (int i = 0; i < OperationType::count(); i++) { 14 | _op_evaluators.emplace_back(); 15 | } 16 | } 17 | 18 | template 19 | void register_evaluator(Args... args) { 20 | _op_evaluators[OperationType::template tag::value].reset(new EvaluatorType(_db, args...)); 21 | } 22 | 23 | evaluator &get_evaluator(const OperationType &op) { 24 | int i_which = op.which(); 25 | uint64_t u_which = uint64_t(i_which); 26 | if (i_which < 0) 27 | assert("Negative operation tag" && false); 28 | if (u_which >= _op_evaluators.size()) 29 | assert("No registered evaluator for this operation" && 30 | false); 31 | unique_ptr> &eval = _op_evaluators[u_which]; 32 | if (!eval) 33 | assert("No registered evaluator for this operation" && 34 | false); 35 | return *eval; 36 | } 37 | 38 | std::vector>> _op_evaluators; 39 | database &_db; 40 | }; 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/immutable_chain_parameters.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { 10 | namespace chain { 11 | 12 | struct immutable_chain_parameters { 13 | uint16_t min_committee_member_count = STEEMIT_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT; 14 | uint16_t min_witness_count = STEEMIT_DEFAULT_MIN_WITNESS_COUNT; 15 | uint32_t num_special_accounts = 0; 16 | uint32_t num_special_assets = 0; 17 | }; 18 | 19 | } 20 | } // golos::chain 21 | 22 | FC_REFLECT((golos::chain::immutable_chain_parameters), 23 | (min_committee_member_count) 24 | (min_witness_count) 25 | (num_special_accounts) 26 | (num_special_assets) 27 | ) 28 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/index.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | template 9 | void _add_index_impl(database &db) { 10 | db.add_index(); 11 | } 12 | 13 | template 14 | void add_core_index(database &db) { 15 | _add_index_impl(db); 16 | } 17 | 18 | template 19 | void add_plugin_index(database &db) { 20 | db._plugin_index_signal.connect([&db]() { _add_index_impl(db); }); 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/node_property_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { 4 | namespace chain { 5 | 6 | /** 7 | * @brief Contains per-node database configuration. 8 | * 9 | * Transactions are evaluated differently based on per-node state. 10 | * Settings here may change based on whether the node is syncing or up-to-date. 11 | * Or whether the node is a witness node. Or if we're processing a 12 | * transaction in a witness-signed block vs. a fresh transaction 13 | * from the p2p network. Or configuration-specified tradeoffs of 14 | * performance/hardfork resilience vs. paranoia. 15 | */ 16 | class node_property_object { 17 | public: 18 | node_property_object() { 19 | } 20 | 21 | ~node_property_object() { 22 | } 23 | 24 | uint32_t skip_flags = 0; 25 | }; 26 | } 27 | } // golos::chain 28 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/operation_notification.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | using protocol::operation; 9 | 10 | struct operation_notification { 11 | operation_notification(const operation &o) : op(o) { 12 | } 13 | 14 | bool stored_in_db = false; 15 | int64_t db_id = 0; 16 | transaction_id_type trx_id; 17 | uint32_t block = 0; 18 | uint32_t trx_in_block = 0; 19 | uint16_t op_in_trx = 0; 20 | uint32_t virtual_op = 0; 21 | const operation& op; 22 | }; 23 | 24 | } } // golos::chain 25 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/shared_db_merkle.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { 4 | namespace chain { 5 | 6 | inline static const map &get_shared_db_merkle() { 7 | static const map shared_db_merkle 8 | { 9 | {3705111, checksum_type("0a8f0fd5450c3706ec8b8cbad795cd0b3679bf35")}, 10 | {3705120, checksum_type("2027edb72b671f7011c8cc4c7a8b59c39b305093")}, 11 | {3713940, checksum_type("bf8a1d516927c506ebdbb7b38bef2e992435435f")}, 12 | {3714132, checksum_type("e8b77773d268b72c8d650337b8cce360bbe64779")}, 13 | {3714567, checksum_type("45af59a8c2d7d4a606151ef5dae03d2dfe13fbdd")}, 14 | {3714588, checksum_type("e64275443bdc82f104ac936486d367af8f6d1584")}, 15 | {4138790, checksum_type("f65a3a788a2ef52406d8ba5705d7288be228403f")}, 16 | {5435426, checksum_type("0b32538b2d22bd3146d54b6e3cb5ae8b9780e8a5")} 17 | }; 18 | 19 | return shared_db_merkle; 20 | } 21 | 22 | } 23 | } //golos::chain 24 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/snapshot_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | struct account_keys { 9 | authority owner_key; 10 | authority active_key; 11 | authority posting_key; 12 | public_key_type memo_key; 13 | }; 14 | 15 | struct account_balances { 16 | vector assets; 17 | }; 18 | 19 | struct snapshot_summary { 20 | asset balance; 21 | asset sbd_balance; 22 | asset total_vesting_shares; 23 | asset total_vesting_fund_steem; 24 | uint32_t accounts_count; 25 | }; 26 | 27 | struct account_summary { 28 | uint32_t id; 29 | string name; 30 | account_keys keys; 31 | share_type posting_rewards; 32 | share_type curation_rewards; 33 | account_balances balances; 34 | string json_metadata; 35 | string proxy; 36 | uint32_t post_count; 37 | string recovery_account; 38 | share_type reputation; 39 | }; 40 | 41 | struct snapshot_state { 42 | fc::time_point_sec timestamp; 43 | uint32_t head_block_num; 44 | block_id_type head_block_id; 45 | chain_id_type chain_id; 46 | snapshot_summary summary; 47 | 48 | vector accounts; 49 | }; 50 | 51 | } 52 | } 53 | 54 | FC_REFLECT((golos::chain::account_keys), (owner_key)(active_key)(posting_key)(memo_key)) 55 | FC_REFLECT((golos::chain::account_balances), (assets)) 56 | FC_REFLECT((golos::chain::snapshot_summary), (balance)(sbd_balance)(total_vesting_shares)(total_vesting_fund_steem)(accounts_count)) 57 | FC_REFLECT((golos::chain::account_summary), (id)(name)(posting_rewards)(curation_rewards)(keys)(balances)(json_metadata)(proxy)(post_count)(recovery_account)(reputation)) 58 | FC_REFLECT((golos::chain::snapshot_state), (timestamp)(head_block_num)(head_block_id)(chain_id)(summary)(accounts)) -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/transaction_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { 10 | namespace chain { 11 | 12 | using golos::protocol::signed_transaction; 13 | 14 | /** 15 | * The purpose of this object is to enable the detection of duplicate transactions. When a transaction is included 16 | * in a block a transaction_object is added. At the end of block processing all transaction_objects that have 17 | * expired can be removed from the index. 18 | */ 19 | class transaction_object 20 | : public object { 21 | transaction_object() = delete; 22 | 23 | public: 24 | template 25 | transaction_object(Constructor &&c, allocator a) 26 | : packed_trx(a) { 27 | c(*this); 28 | } 29 | 30 | id_type id; 31 | 32 | bip::vector> packed_trx; 33 | transaction_id_type trx_id; 34 | time_point_sec expiration; 35 | }; 36 | 37 | struct by_expiration; 38 | struct by_trx_id; 39 | typedef multi_index_container < 40 | transaction_object, 41 | indexed_by< 42 | ordered_unique < tag < 43 | by_id>, member>, 44 | hashed_unique, BOOST_MULTI_INDEX_MEMBER(transaction_object, transaction_id_type, trx_id), std::hash>, 45 | ordered_non_unique , member> 46 | >, 47 | allocator 48 | > 49 | transaction_index; 50 | 51 | } 52 | } // golos::chain 53 | 54 | FC_REFLECT((golos::chain::transaction_object), (id)(packed_trx)(trx_id)(expiration)) 55 | CHAINBASE_SET_INDEX_TYPE(golos::chain::transaction_object, golos::chain::transaction_index) 56 | -------------------------------------------------------------------------------- /libraries/network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET network) 2 | 3 | list(APPEND ${CURRENT_TARGET}_HEADERS 4 | include/golos/network/config.hpp 5 | include/golos/network/core_messages.hpp 6 | include/golos/network/exceptions.hpp 7 | include/golos/network/message.hpp 8 | include/golos/network/message_oriented_connection.hpp 9 | include/golos/network/node.hpp 10 | include/golos/network/peer_connection.hpp 11 | include/golos/network/peer_database.hpp 12 | include/golos/network/stcp_socket.hpp 13 | ) 14 | 15 | list(APPEND ${CURRENT_TARGET}_SOURCES 16 | core_messages.cpp 17 | message_oriented_connection.cpp 18 | node.cpp 19 | peer_connection.cpp 20 | peer_database.cpp 21 | stcp_socket.cpp 22 | ) 23 | 24 | if(BUILD_SHARED_LIBRARIES) 25 | add_library(golos_${CURRENT_TARGET} SHARED 26 | ${${CURRENT_TARGET}_HEADERS} 27 | ${${CURRENT_TARGET}_SOURCES} 28 | ) 29 | else() 30 | add_library(golos_${CURRENT_TARGET} STATIC 31 | ${${CURRENT_TARGET}_HEADERS} 32 | ${${CURRENT_TARGET}_SOURCES} 33 | ) 34 | endif() 35 | 36 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 37 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 38 | 39 | target_link_libraries(golos_${CURRENT_TARGET} PUBLIC fc golos_protocol) 40 | target_include_directories(golos_${CURRENT_TARGET} 41 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 42 | PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../protocol/include" 43 | #PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../version/include" 44 | ) 45 | 46 | if(MSVC) 47 | set_source_files_properties(node.cpp PROPERTIES COMPILE_FLAGS "/bigobj") 48 | endif(MSVC) 49 | 50 | if(USE_PCH) 51 | set_target_properties(golos_${CURRENT_TARGET} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) 52 | cotire(golos::network) 53 | endif(USE_PCH) 54 | 55 | install(TARGETS 56 | golos_${CURRENT_TARGET} 57 | 58 | RUNTIME DESTINATION bin 59 | LIBRARY DESTINATION lib 60 | ARCHIVE DESTINATION lib 61 | ) 62 | install(FILES ${${CURRENT_TARGET}_HEADERS} DESTINATION "include/golos/${CURRENT_TARGET}") 63 | 64 | -------------------------------------------------------------------------------- /libraries/network/include/golos/network/exceptions.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace golos { 30 | namespace network { 31 | // registered in node.cpp 32 | 33 | FC_DECLARE_EXCEPTION(net_exception, 90000, "P2P Networking Exception"); 34 | 35 | FC_DECLARE_DERIVED_EXCEPTION(already_connected_to_requested_peer, golos::network::net_exception, 90003, "already connected to requested peer"); 36 | 37 | FC_DECLARE_DERIVED_EXCEPTION(block_older_than_undo_history, golos::network::net_exception, 90004, "block is older than our undo history allows us to process"); 38 | 39 | FC_DECLARE_DERIVED_EXCEPTION(peer_is_on_an_unreachable_fork, golos::network::net_exception, 90005, "peer is on another fork"); 40 | 41 | FC_DECLARE_DERIVED_EXCEPTION(unlinkable_block_exception, golos::network::net_exception, 90006, "unlinkable block") 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/README.md: -------------------------------------------------------------------------------- 1 | Protocol Definition 2 | -------------------- 3 | 4 | The classes declared in these headers provide the complete definition of the 5 | Vaporware protocol and are organized according to feature. Nothing in this 6 | directory should depend upon anything other than fc or other types defined 7 | in the protocol directory. 8 | 9 | To be more specific, implementation details such as the objects defined in 10 | the object database should not be required here. 11 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/base.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { 10 | namespace protocol { 11 | 12 | struct base_operation { 13 | void get_required_authorities(vector &) const { 14 | } 15 | 16 | void get_required_active_authorities(flat_set &) const { 17 | } 18 | 19 | void get_required_posting_authorities(flat_set &) const { 20 | } 21 | 22 | void get_required_owner_authorities(flat_set &) const { 23 | } 24 | 25 | bool is_virtual() const { 26 | return false; 27 | } 28 | 29 | void validate() const { 30 | } 31 | }; 32 | 33 | struct virtual_operation : public base_operation { 34 | bool is_virtual() const { 35 | return true; 36 | } 37 | 38 | void validate() const { 39 | FC_ASSERT(false, "This is a virtual operation"); 40 | } 41 | }; 42 | 43 | typedef static_variant< 44 | void_t, 45 | version, // Normal witness version reporting, for diagnostics and voting 46 | hardfork_version_vote // Voting for the next hardfork to trigger 47 | > block_header_extensions; 48 | 49 | typedef static_variant< 50 | void_t 51 | > future_extensions; 52 | 53 | typedef flat_set block_header_extensions_type; 54 | typedef flat_set extensions_type; 55 | 56 | 57 | } 58 | } // golos::protocol 59 | 60 | FC_REFLECT_TYPENAME((golos::protocol::block_header_extensions)) 61 | FC_REFLECT_TYPENAME((golos::protocol::future_extensions)) 62 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/block.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace protocol { 7 | 8 | struct signed_block : public signed_block_header { 9 | checksum_type calculate_merkle_root() const; 10 | 11 | vector transactions; 12 | }; 13 | 14 | } } // golos::protocol 15 | 16 | FC_REFLECT_DERIVED((golos::protocol::signed_block), ((golos::protocol::signed_block_header)), (transactions)) 17 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/block_header.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace protocol { 7 | 8 | struct block_header { 9 | digest_type digest() const; 10 | 11 | block_id_type previous; 12 | 13 | uint32_t block_num() const { 14 | return num_from_id(previous) + 1; 15 | } 16 | 17 | fc::time_point_sec timestamp; 18 | string witness; 19 | checksum_type transaction_merkle_root; 20 | block_header_extensions_type extensions; 21 | 22 | static uint32_t num_from_id(const block_id_type &id); 23 | }; 24 | 25 | struct signed_block_header : public block_header { 26 | block_id_type id() const; 27 | 28 | fc::ecc::public_key signee() const; 29 | 30 | void sign(const fc::ecc::private_key &signer); 31 | 32 | bool validate_signee(const fc::ecc::public_key &expected_signee) const; 33 | 34 | signature_type witness_signature; 35 | }; 36 | 37 | 38 | } 39 | } // golos::protocol 40 | 41 | FC_REFLECT((golos::protocol::block_header), (previous)(timestamp)(witness)(transaction_merkle_root)(extensions)) 42 | FC_REFLECT_DERIVED((golos::protocol::signed_block_header), ((golos::protocol::block_header)), (witness_signature)) 43 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/get_config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace protocol { 7 | 8 | fc::variant_object get_config(); 9 | 10 | } 11 | } // golos::protocol 12 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/operation_util.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | // 13 | // Place DECLARE_OPERATION_TYPE in a .hpp file to declare 14 | // functions related to your operation type 15 | // 16 | #define DECLARE_OPERATION_TYPE(OperationType) \ 17 | namespace fc { \ 18 | \ 19 | void to_variant(const OperationType&, fc::variant&); \ 20 | void from_variant(const fc::variant&, OperationType&); \ 21 | \ 22 | } /* fc */ \ 23 | \ 24 | namespace golos { namespace protocol { \ 25 | \ 26 | void operation_validate(const OperationType&); \ 27 | void operation_get_required_authorities( \ 28 | const OperationType& op, \ 29 | flat_set& active, \ 30 | flat_set& owner, \ 31 | flat_set& posting, \ 32 | vector& other); \ 33 | \ 34 | } } /* golos::protocol */ 35 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/protocol.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/reward_curve.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace protocol { 6 | 7 | enum class curation_curve: uint8_t { 8 | bounded, 9 | linear, 10 | square_root, 11 | _size, 12 | detect = 100, ///< get from current settings 13 | }; // enum curation_curve 14 | 15 | } } // namespace golos::protocol 16 | 17 | FC_REFLECT_ENUM(golos::protocol::curation_curve, (detect)(bounded)(linear)(square_root)(_size)) 18 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/sign_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace protocol { 7 | 8 | using authority_getter = std::function< authority (const account_name_type&) > ; 9 | 10 | struct sign_state { 11 | /** returns true if we have a signature for this key or can 12 | * produce a signature for this key, else returns false. 13 | */ 14 | bool signed_by(const public_key_type& k); 15 | 16 | bool check_authority(const account_name_type& id); 17 | 18 | /** 19 | * Checks to see if we have signatures of the active authorites of 20 | * the accounts specified in authority or the keys specified. 21 | */ 22 | bool check_authority(const authority& au, uint32_t depth = 0); 23 | 24 | bool remove_unused_signatures(); 25 | 26 | bool filter_unused_approvals(); 27 | 28 | sign_state( 29 | const flat_set& sigs, 30 | const authority_getter& a, 31 | const flat_set& keys); 32 | 33 | const authority_getter& get_active; 34 | const fc::flat_set& available_keys; 35 | 36 | fc::flat_map provided_signatures; 37 | std::vector unused_signatures; 38 | std::vector used_signatures; 39 | fc::flat_map approved_by; 40 | std::vector unused_approvals; 41 | uint32_t max_recursion = STEEMIT_MAX_SIG_CHECK_DEPTH; 42 | }; 43 | 44 | } } // golos::protocol 45 | -------------------------------------------------------------------------------- /libraries/protocol/operation_util_impl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace fc { 4 | 5 | std::string name_from_type(const std::string &type_name) { 6 | auto start = type_name.find_last_of(':') + 1; 7 | auto end = type_name.find_last_of('_'); 8 | return type_name.substr(start, end - start); 9 | } 10 | 11 | } // fc 12 | -------------------------------------------------------------------------------- /libraries/protocol/operations.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace protocol { 7 | 8 | struct is_market_op_visitor { 9 | typedef bool result_type; 10 | 11 | template 12 | bool operator()(T &&v) const { 13 | return false; 14 | } 15 | 16 | bool operator()(const limit_order_create_operation &) const { 17 | return true; 18 | } 19 | 20 | bool operator()(const limit_order_cancel_operation &) const { 21 | return true; 22 | } 23 | 24 | bool operator()(const transfer_operation &) const { 25 | return true; 26 | } 27 | 28 | bool operator()(const transfer_to_vesting_operation &) const { 29 | return true; 30 | } 31 | }; 32 | 33 | bool is_market_operation(const operation &op) { 34 | return op.visit(is_market_op_visitor()); 35 | } 36 | 37 | struct is_vop_visitor { 38 | typedef bool result_type; 39 | 40 | template 41 | bool operator()(const T &v) const { 42 | return v.is_virtual(); 43 | } 44 | }; 45 | 46 | bool is_virtual_operation(const operation &op) { 47 | return op.visit(is_vop_visitor()); 48 | } 49 | 50 | struct is_custom_json_op_visitor { 51 | typedef bool result_type; 52 | 53 | template 54 | bool operator()(T&& v) const { 55 | return false; 56 | } 57 | 58 | bool operator()(const custom_json_operation&) const { 59 | return true; 60 | } 61 | }; 62 | 63 | bool is_custom_json_operation(const operation& op) { 64 | return op.visit(is_custom_json_op_visitor()); 65 | } 66 | 67 | } 68 | } // golos::protocol 69 | 70 | DEFINE_OPERATION_TYPE(golos::protocol::operation) 71 | -------------------------------------------------------------------------------- /libraries/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/golos/time/*.hpp") 2 | 3 | if(BUILD_SHARED_LIBRARIES) 4 | add_library(graphene_time SHARED 5 | time.cpp 6 | ) 7 | else() 8 | add_library(graphene_time STATIC 9 | time.cpp 10 | ) 11 | endif() 12 | 13 | target_link_libraries(graphene_time fc) 14 | target_include_directories(graphene_time 15 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 16 | 17 | install(TARGETS 18 | graphene_time 19 | 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib 23 | ) 24 | install(FILES ${HEADERS} DESTINATION "include/golos/time") 25 | -------------------------------------------------------------------------------- /libraries/time/include/golos/time/time.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace time { 9 | 10 | typedef fc::signal time_discontinuity_signal_type; 11 | extern time_discontinuity_signal_type time_discontinuity_signal; 12 | 13 | fc::time_point now(); 14 | 15 | void start_simulated_time(const fc::time_point sim_time); 16 | 17 | void advance_simulated_time_to(const fc::time_point sim_time); 18 | 19 | void advance_time(int32_t delta_seconds); 20 | 21 | } 22 | } // golos::time 23 | -------------------------------------------------------------------------------- /libraries/time/time.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace golos { 11 | namespace time { 12 | 13 | static int32_t simulated_time = 0; 14 | static int32_t adjusted_time_sec = 0; 15 | 16 | time_discontinuity_signal_type time_discontinuity_signal; 17 | 18 | fc::time_point now() { 19 | if (simulated_time) { 20 | return fc::time_point() + 21 | fc::seconds(simulated_time + adjusted_time_sec); 22 | } 23 | 24 | return fc::time_point::now() + fc::seconds(adjusted_time_sec); 25 | } 26 | 27 | void start_simulated_time(const fc::time_point sim_time) { 28 | simulated_time = sim_time.sec_since_epoch(); 29 | adjusted_time_sec = 0; 30 | } 31 | 32 | void advance_simulated_time_to(const fc::time_point sim_time) { 33 | simulated_time = sim_time.sec_since_epoch(); 34 | adjusted_time_sec = 0; 35 | } 36 | 37 | void advance_time(int32_t delta_seconds) { 38 | adjusted_time_sec += delta_seconds; 39 | time_discontinuity_signal(); 40 | } 41 | 42 | } 43 | } // golos::time 44 | -------------------------------------------------------------------------------- /libraries/utilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/libraries/fc/GitVersionGen") 2 | include(GetGitRevisionDescription) 3 | get_git_head_revision(GIT_REFSPEC GRAPHENE_GIT_REVISION_SHA) 4 | get_git_unix_timestamp(GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP) 5 | git_describe(GRAPHENE_GIT_REVISION_DESCRIPTION --tags) 6 | if(NOT GRAPHENE_GIT_REVISION_DESCRIPTION) 7 | set(GRAPHENE_GIT_REVISION_DESCRIPTION "unknown") 8 | endif(NOT GRAPHENE_GIT_REVISION_DESCRIPTION) 9 | 10 | file(GLOB HEADERS "include/graphene/utilities/*.hpp") 11 | 12 | set(sources 13 | key_conversion.cpp 14 | string_escape.cpp 15 | tempdir.cpp 16 | words.cpp 17 | ${HEADERS}) 18 | 19 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_revision.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" @ONLY) 20 | list(APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp") 21 | 22 | if(BUILD_SHARED_LIBRARIES) 23 | add_library(graphene_utilities SHARED 24 | ${sources} 25 | ${HEADERS}) 26 | else() 27 | add_library(graphene_utilities STATIC 28 | ${sources} 29 | ${HEADERS}) 30 | endif() 31 | target_link_libraries(graphene_utilities fc) 32 | target_include_directories(graphene_utilities 33 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 34 | if(USE_PCH) 35 | set_target_properties(graphene_utilities PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) 36 | cotire(graphene_utilities) 37 | endif(USE_PCH) 38 | 39 | install(TARGETS 40 | graphene_utilities 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | install(FILES ${HEADERS} DESTINATION "include/graphene/utilities") 47 | -------------------------------------------------------------------------------- /libraries/utilities/git_revision.cpp.in: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define GRAPHENE_GIT_REVISION_SHA "@GRAPHENE_GIT_REVISION_SHA@" 5 | #define GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP @GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP@ 6 | #define GRAPHENE_GIT_REVISION_DESCRIPTION "@GRAPHENE_GIT_REVISION_DESCRIPTION@" 7 | 8 | namespace golos { 9 | namespace utilities { 10 | 11 | const char *const git_revision_sha = GRAPHENE_GIT_REVISION_SHA; 12 | const uint32_t git_revision_unix_timestamp = GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP; 13 | const char *const git_revision_description = GRAPHENE_GIT_REVISION_DESCRIPTION; 14 | 15 | } 16 | } // end namespace golos::utilities 17 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/git_revision.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace golos { 29 | namespace utilities { 30 | 31 | extern const char *const git_revision_sha; 32 | extern const uint32_t git_revision_unix_timestamp; 33 | extern const char *const git_revision_description; 34 | 35 | } 36 | } // end namespace golos::utilities 37 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/key_conversion.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace golos { 31 | namespace utilities { 32 | 33 | std::string key_to_wif(const fc::sha256 &private_secret); 34 | 35 | std::string key_to_wif(const fc::ecc::private_key &key); 36 | 37 | fc::optional wif_to_key(const std::string &wif_key); 38 | 39 | } 40 | } // end namespace golos::utilities 41 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/string_escape.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace golos { 29 | namespace utilities { 30 | 31 | std::string escape_string_for_c_source_code(const std::string &input); 32 | 33 | } 34 | } // end namespace golos::utilities 35 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/tempdir.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace golos { 31 | namespace utilities { 32 | 33 | fc::path temp_directory_path(); 34 | 35 | } 36 | } // golos::utilities 37 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/words.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { 4 | namespace words { 5 | 6 | typedef const char *const_char_ptr; 7 | extern const const_char_ptr word_list[]; 8 | extern const uint32_t word_list_size; 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libraries/utilities/tempdir.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #include 26 | 27 | namespace golos { 28 | namespace utilities { 29 | 30 | fc::path temp_directory_path() { 31 | const char *graphene_tempdir = getenv("GRAPHENE_TEMPDIR"); 32 | if (graphene_tempdir != nullptr) { 33 | return fc::path(graphene_tempdir); 34 | } 35 | return fc::temp_directory_path() / "golos-tmp"; 36 | } 37 | 38 | } 39 | } // golos::utilities 40 | -------------------------------------------------------------------------------- /libraries/wallet/include/golos/wallet/time_converter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace wallet { 6 | 7 | class time_converter { 8 | private: 9 | time_point_sec tps; 10 | public: 11 | time_converter(const std::string& s, const time_point_sec& start_tps, const time_point_sec& default_tps) { 12 | if (s.empty()) { 13 | tps = default_tps; 14 | return; 15 | } 16 | if (s.at(0) == '+') { 17 | tps = start_tps; 18 | tps += std::stoi(s.substr(1)); 19 | return; 20 | } 21 | if (s.at(0) == '-') { 22 | tps = start_tps; 23 | tps -= std::stoi(s.substr(1)); 24 | return; 25 | } 26 | tps = time_point_sec::from_iso_string(s); 27 | if (tps.sec_since_epoch() == 0) { 28 | tps = default_tps; 29 | return; 30 | } 31 | } 32 | 33 | time_point_sec time() { 34 | return tps; 35 | } 36 | }; 37 | 38 | } 39 | } // golos::wallet -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # for each subdirectory containing a CMakeLists.txt, add that subdirectory 2 | set(ENV{STEEMIT_INTERNAL_PLUGINS} "") 3 | file(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *) 4 | foreach(child ${children}) 5 | if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${child}") 6 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${child}/CMakeLists.txt") 7 | add_subdirectory("${child}") 8 | set(ENV{STEEMIT_INTERNAL_PLUGINS} "$ENV{STEEMIT_INTERNAL_PLUGINS};${child}") 9 | endif() 10 | endif() 11 | endforeach() 12 | -------------------------------------------------------------------------------- /plugins/account_by_key/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_by_key) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_by_key/account_by_key_objects.hpp 5 | include/golos/plugins/account_by_key/account_by_key_plugin.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | account_by_key_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::p2p 31 | golos::protocol 32 | golos::network 33 | graphene_utilities 34 | graphene_time 35 | appbase 36 | ) 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) -------------------------------------------------------------------------------- /plugins/account_by_key/include/golos/plugins/account_by_key/account_by_key_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace golos { 11 | namespace plugins { 12 | namespace account_by_key { 13 | 14 | using namespace std; 15 | using namespace golos::chain; 16 | using namespace golos::protocol; 17 | 18 | #ifndef ACCOUNT_BY_KEY_SPACE_ID 19 | #define ACCOUNT_BY_KEY_SPACE_ID 11 20 | #endif 21 | 22 | enum account_by_key_object_types { 23 | key_lookup_object_type = (ACCOUNT_BY_KEY_SPACE_ID << 8) 24 | }; 25 | 26 | class key_lookup_object 27 | : public object { 28 | public: 29 | template 30 | key_lookup_object(Constructor &&c, allocator a) { 31 | c(*this); 32 | } 33 | 34 | id_type id; 35 | 36 | public_key_type key; 37 | account_name_type account; 38 | }; 39 | typedef key_lookup_object::id_type key_lookup_id_type; 40 | 41 | using namespace boost::multi_index; 42 | 43 | struct by_key; 44 | 45 | typedef multi_index_container < 46 | key_lookup_object, 47 | indexed_by< 48 | ordered_unique < tag < 49 | by_id>, member>, 50 | ordered_unique , 51 | composite_key, 53 | member 54 | > 55 | > 56 | >, 57 | allocator 58 | > 59 | key_lookup_index; 60 | 61 | } 62 | } // golos::plugins::account_by_key 63 | } 64 | 65 | FC_REFLECT((golos::plugins::account_by_key::key_lookup_object), (id)(key)(account)) 66 | CHAINBASE_SET_INDEX_TYPE(golos::plugins::account_by_key::key_lookup_object, golos::plugins::account_by_key::key_lookup_index) 67 | -------------------------------------------------------------------------------- /plugins/account_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_history/plugin.hpp 5 | include/golos/plugins/account_history/history_object.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if (BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | target_link_libraries ( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos_chain_plugin 30 | golos_protocol 31 | golos::operation_history 32 | appbase 33 | golos_json_rpc 34 | graphene_time 35 | chainbase 36 | fc 37 | ) 38 | 39 | target_include_directories(golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) -------------------------------------------------------------------------------- /plugins/account_notes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_notes) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_notes/account_notes_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | account_notes_evaluators.cpp 9 | account_notes_operations.cpp 10 | account_notes_plugin.cpp 11 | ) 12 | 13 | if(BUILD_SHARED_LIBRARIES) 14 | add_library(golos_${CURRENT_TARGET} SHARED 15 | ${CURRENT_TARGET_HEADERS} 16 | ${CURRENT_TARGET_SOURCES} 17 | ) 18 | else() 19 | add_library(golos_${CURRENT_TARGET} STATIC 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | endif() 24 | 25 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos::chain_plugin 31 | golos::protocol 32 | golos::network 33 | golos::json_rpc 34 | graphene_utilities 35 | graphene_time 36 | appbase 37 | ) 38 | target_include_directories(golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 40 | 41 | install(TARGETS 42 | golos_${CURRENT_TARGET} 43 | 44 | RUNTIME DESTINATION bin 45 | LIBRARY DESTINATION lib 46 | ARCHIVE DESTINATION lib 47 | ) 48 | 49 | -------------------------------------------------------------------------------- /plugins/account_notes/account_notes_operations.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace account_notes { 8 | 9 | using golos::protocol::is_valid_account_name; 10 | 11 | static inline void validate_account_name(const string& name) { 12 | GOLOS_CHECK_VALUE(is_valid_account_name(name), "Account name ${name} is invalid", ("name", name)); 13 | } 14 | 15 | void set_value_operation::validate() const { 16 | GOLOS_CHECK_PARAM_ACCOUNT(account); 17 | GOLOS_CHECK_PARAM(key, GOLOS_CHECK_VALUE_LEGE(key.length(), 1, 128)); 18 | GOLOS_CHECK_PARAM(value, GOLOS_CHECK_VALUE_LE(value.length(), 4096)); 19 | } 20 | 21 | } } } // golos::plugins::account_notes 22 | 23 | DEFINE_OPERATION_TYPE(golos::plugins::account_notes::account_notes_plugin_operation); -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_api_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { namespace plugins { namespace account_notes { 4 | 5 | struct account_notes_settings_api_object { 6 | account_notes_settings_api_object() = default; 7 | 8 | account_notes_settings_api_object(uint16_t max_kl, uint16_t max_vl, uint16_t max_nc) 9 | : max_key_length(max_kl), max_value_length(max_vl), max_note_count(max_nc) { 10 | } 11 | 12 | uint16_t max_key_length = 0; 13 | uint16_t max_value_length = 0; 14 | uint16_t max_note_count = 0; 15 | flat_set tracked_accounts; 16 | flat_set untracked_accounts; 17 | }; 18 | 19 | } } } // golos::plugins::account_notes 20 | 21 | FC_REFLECT((golos::plugins::account_notes::account_notes_settings_api_object), 22 | (max_key_length)(max_value_length)(max_note_count)(tracked_accounts)(untracked_accounts)); 23 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_evaluators.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { namespace plugins { namespace account_notes { 9 | 10 | using golos::chain::database; 11 | using golos::chain::evaluator; 12 | using golos::chain::evaluator_impl; 13 | 14 | class set_value_evaluator : public golos::chain::evaluator_impl { 15 | public: 16 | using operation_type = set_value_operation; 17 | 18 | set_value_evaluator(database& db, const account_notes_settings_api_object* settings) 19 | : evaluator_impl(db), settings_(settings) { 20 | } 21 | 22 | void do_apply(const set_value_operation& o); 23 | 24 | private: 25 | bool is_tracked_account(const account_name_type& account); 26 | 27 | const account_notes_settings_api_object* settings_; 28 | }; 29 | 30 | } } } // golos::plugins::account_notes 31 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_operations.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace account_notes { 7 | 8 | using golos::protocol::base_operation; 9 | using golos::protocol::account_name_type; 10 | 11 | struct set_value_operation : base_operation { 12 | account_name_type account; 13 | string key; 14 | string value; 15 | 16 | void validate() const; 17 | 18 | void get_required_active_authorities(flat_set& a) const { 19 | a.insert(account); 20 | } 21 | }; 22 | 23 | using account_notes_plugin_operation = fc::static_variant; 24 | 25 | } } } // golos::plugins::account_notes 26 | 27 | FC_REFLECT((golos::plugins::account_notes::set_value_operation), (account)(key)(value)); 28 | 29 | FC_REFLECT_TYPENAME((golos::plugins::account_notes::account_notes_plugin_operation)); 30 | DECLARE_OPERATION_TYPE(golos::plugins::account_notes::account_notes_plugin_operation) 31 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace account_notes { 10 | 11 | using namespace golos::chain; 12 | 13 | DEFINE_API_ARGS(get_value, json_rpc::msg_pack, std::string) 14 | DEFINE_API_ARGS(get_settings, json_rpc::msg_pack, account_notes_settings_api_object) 15 | 16 | /** 17 | * This plugin provides the support of key-value storage for additional data for the accounts. 18 | * 19 | */ 20 | class account_notes_plugin final : public appbase::plugin { 21 | public: 22 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)) 23 | 24 | account_notes_plugin(); 25 | 26 | ~account_notes_plugin(); 27 | 28 | void set_program_options( 29 | boost::program_options::options_description& cli, 30 | boost::program_options::options_description& cfg) override; 31 | 32 | void plugin_initialize(const boost::program_options::variables_map& options) override; 33 | 34 | void plugin_startup() override; 35 | 36 | void plugin_shutdown() override; 37 | 38 | static const std::string& name(); 39 | 40 | DECLARE_API( 41 | (get_value) 42 | (get_settings) 43 | ) 44 | 45 | private: 46 | class account_notes_plugin_impl; 47 | 48 | std::unique_ptr my; 49 | }; 50 | 51 | } } } //golos::plugins::account_notes 52 | -------------------------------------------------------------------------------- /plugins/auth_util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET auth_util) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/auth_util/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if (BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | target_link_libraries ( 26 | golos_${CURRENT_TARGET} 27 | golos_chain 28 | golos_chain_plugin 29 | golos_protocol 30 | appbase 31 | fc 32 | ) 33 | 34 | target_include_directories(golos_${CURRENT_TARGET} 35 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 36 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 37 | ) 38 | 39 | install(TARGETS 40 | golos_${CURRENT_TARGET} 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | -------------------------------------------------------------------------------- /plugins/auth_util/include/golos/plugins/auth_util/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace golos { 13 | namespace plugins { 14 | namespace auth_util { 15 | 16 | using golos::plugins::json_rpc::msg_pack; 17 | 18 | 19 | DEFINE_API_ARGS ( check_authority_signature, msg_pack, std::vector) 20 | 21 | class plugin final : public appbase::plugin { 22 | public: 23 | constexpr static const char *plugin_name = "auth_util"; 24 | 25 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 26 | 27 | static const std::string &name() { 28 | static std::string name = plugin_name; 29 | return name; 30 | } 31 | 32 | plugin(); 33 | 34 | ~plugin(); 35 | 36 | void set_program_options(boost::program_options::options_description &cli, 37 | boost::program_options::options_description &cfg) override; 38 | 39 | void plugin_initialize(const boost::program_options::variables_map &options) override; 40 | 41 | void plugin_startup() override; 42 | 43 | void plugin_shutdown() override { 44 | } 45 | 46 | DECLARE_API ( 47 | (check_authority_signature) 48 | ) 49 | 50 | private: 51 | struct plugin_impl; 52 | 53 | std::unique_ptr my; 54 | }; 55 | 56 | } 57 | } 58 | } // golos::plugins::auth_util 59 | 60 | -------------------------------------------------------------------------------- /plugins/block_info/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET block_info) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/block_info/plugin.hpp 5 | include/golos/plugins/block_info/block_info.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_protocol 32 | appbase 33 | golos_chain_plugin 34 | golos::json_rpc 35 | fc 36 | ) 37 | 38 | target_include_directories( 39 | golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) 51 | -------------------------------------------------------------------------------- /plugins/block_info/include/golos/plugins/block_info/block_info.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace plugins { 7 | namespace block_info { 8 | 9 | struct block_info { 10 | golos::chain::block_id_type block_id; 11 | uint32_t block_size = 0; 12 | uint32_t average_block_size = 0; 13 | uint64_t aslot = 0; 14 | uint32_t last_irreversible_block_num = 0; 15 | uint32_t num_pow_witnesses = 0; 16 | }; 17 | 18 | struct block_with_info { 19 | golos::chain::signed_block block; 20 | block_info info; 21 | }; 22 | 23 | } } } 24 | 25 | 26 | FC_REFLECT( (golos::plugins::block_info::block_info), 27 | (block_id) 28 | (block_size) 29 | (average_block_size) 30 | (aslot) 31 | (last_irreversible_block_num) 32 | (num_pow_witnesses) 33 | ) 34 | 35 | 36 | FC_REFLECT( (golos::plugins::block_info::block_with_info), 37 | (block) 38 | (info) 39 | ) 40 | -------------------------------------------------------------------------------- /plugins/block_info/include/golos/plugins/block_info/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace golos { 14 | namespace protocol { 15 | 16 | struct signed_block; 17 | 18 | } } 19 | 20 | 21 | namespace golos { 22 | namespace plugins { 23 | namespace block_info { 24 | 25 | using golos::plugins::json_rpc::msg_pack; 26 | 27 | DEFINE_API_ARGS ( get_block_info, msg_pack, std::vector) 28 | DEFINE_API_ARGS ( get_blocks_with_info, msg_pack, std::vector) 29 | 30 | 31 | using boost::program_options::options_description; 32 | 33 | class plugin final : public appbase::plugin { 34 | public: 35 | APPBASE_PLUGIN_REQUIRES((golos::plugins::chain::plugin)) 36 | 37 | constexpr const static char *plugin_name = "block_info"; 38 | 39 | static const std::string &name() { 40 | static std::string name = plugin_name; 41 | return name; 42 | } 43 | 44 | plugin(); 45 | 46 | ~plugin(); 47 | 48 | void set_program_options(boost::program_options::options_description &cli, boost::program_options::options_description &cfg) override { 49 | } 50 | 51 | void plugin_initialize(const boost::program_options::variables_map &options) override; 52 | 53 | void plugin_startup() override; 54 | 55 | void plugin_shutdown() override; 56 | 57 | DECLARE_API( 58 | (get_block_info) 59 | (get_blocks_with_info) 60 | ) 61 | void on_applied_block(const protocol::signed_block &b); 62 | 63 | private: 64 | struct plugin_impl; 65 | 66 | std::unique_ptr my; 67 | }; 68 | 69 | } } } 70 | 71 | 72 | -------------------------------------------------------------------------------- /plugins/chain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET chain_plugin) 2 | list(APPEND CURRENT_TARGET_HEADERS 3 | include/golos/plugins/chain/plugin.hpp 4 | ) 5 | 6 | list(APPEND CURRENT_TARGET_SOURCES 7 | plugin.cpp 8 | serialize_state.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_protocol 31 | fc 32 | appbase 33 | golos::json_rpc 34 | ) 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | RUNTIME DESTINATION bin 41 | LIBRARY DESTINATION lib 42 | ARCHIVE DESTINATION lib 43 | ) 44 | install(FILES ${HEADERS} DESTINATION "include/golos/chain_plugin") 45 | -------------------------------------------------------------------------------- /plugins/chain/serialize_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // this file must only be included from serialize_state.cpp 4 | // required to declare some packers before so they become visible to compiler 5 | 6 | namespace fc { 7 | class uint128_t; 8 | template class fixed_string; 9 | } 10 | namespace golos { namespace chain { 11 | using account_name_type = fc::fixed_string; 12 | struct shared_authority; 13 | class comment_object; 14 | class savings_withdraw_object; 15 | }} 16 | namespace golos { namespace protocol { 17 | struct beneficiary_route_type; 18 | }} 19 | 20 | 21 | namespace fc { namespace raw { 22 | 23 | template void pack(S&, const golos::chain::comment_object&); 24 | template void pack(S&, const golos::chain::savings_withdraw_object&); 25 | template void pack(S&, const golos::chain::account_name_type&); 26 | template void pack(S&, const golos::chain::shared_authority&); 27 | template void pack(S&, const golos::protocol::beneficiary_route_type&); 28 | 29 | }} // fc::raw 30 | -------------------------------------------------------------------------------- /plugins/database_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET database_api) 2 | 3 | list(APPEND ${CURRENT_TARGET}_HEADERS 4 | include/golos/plugins/database_api/state.hpp 5 | include/golos/plugins/database_api/plugin.hpp 6 | 7 | 8 | include/golos/plugins/database_api/api_objects/account_recovery_request_api_object.hpp 9 | include/golos/plugins/database_api/forward.hpp 10 | include/golos/plugins/database_api/api_objects/owner_authority_history_api_object.hpp 11 | include/golos/plugins/database_api/api_objects/savings_withdraw_api_object.hpp 12 | include/golos/plugins/database_api/api_objects/proposal_api_object.hpp 13 | 14 | 15 | ) 16 | 17 | list(APPEND ${CURRENT_TARGET}_SOURCES 18 | api.cpp 19 | proposal_api_object.cpp 20 | ) 21 | 22 | if(BUILD_SHARED_LIBRARIES) 23 | add_library(golos_${CURRENT_TARGET} SHARED 24 | ${${CURRENT_TARGET}_HEADERS} 25 | ${${CURRENT_TARGET}_SOURCES} 26 | ) 27 | else() 28 | add_library(golos_${CURRENT_TARGET} STATIC 29 | ${${CURRENT_TARGET}_HEADERS} 30 | ${${CURRENT_TARGET}_SOURCES} 31 | ) 32 | endif() 33 | 34 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 35 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 36 | 37 | target_link_libraries( 38 | golos_${CURRENT_TARGET} 39 | golos_chain 40 | golos::chain_plugin 41 | golos::follow 42 | golos_protocol 43 | golos::json_rpc 44 | graphene_utilities 45 | appbase 46 | fc 47 | golos::api 48 | ) 49 | target_include_directories(golos_${CURRENT_TARGET} PUBLIC "include") 50 | 51 | install(TARGETS 52 | golos_${CURRENT_TARGET} 53 | 54 | RUNTIME DESTINATION bin 55 | LIBRARY DESTINATION lib 56 | ARCHIVE DESTINATION lib 57 | ) 58 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/account_recovery_request_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 2 | #define GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace database_api { 9 | using golos::chain::account_recovery_request_object; 10 | 11 | struct account_recovery_request_api_object { 12 | account_recovery_request_api_object(const golos::chain::account_recovery_request_object &o) : id(o.id), 13 | account_to_recover(o.account_to_recover), new_owner_authority(authority(o.new_owner_authority)), 14 | expires(o.expires) { 15 | } 16 | 17 | account_recovery_request_api_object() { 18 | } 19 | 20 | account_recovery_request_object::id_type id; 21 | account_name_type account_to_recover; 22 | authority new_owner_authority; 23 | time_point_sec expires; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | 30 | FC_REFLECT((golos::plugins::database_api::account_recovery_request_api_object), 31 | (id)(account_to_recover)(new_owner_authority)(expires)) 32 | 33 | 34 | #endif //GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 35 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/owner_authority_history_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 2 | #define GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace database_api { 9 | 10 | using protocol::authority; 11 | using golos::protocol::account_name_type; 12 | using golos::chain::owner_authority_history_object; 13 | 14 | struct owner_authority_history_api_object { 15 | owner_authority_history_api_object(const golos::chain::owner_authority_history_object &o) : id(o.id), 16 | account(o.account), previous_owner_authority(authority(o.previous_owner_authority)), 17 | last_valid_time(o.last_valid_time) { 18 | } 19 | 20 | owner_authority_history_api_object() { 21 | } 22 | 23 | owner_authority_history_object::id_type id; 24 | 25 | account_name_type account; 26 | authority previous_owner_authority; 27 | time_point_sec last_valid_time; 28 | }; 29 | } 30 | } 31 | } 32 | 33 | FC_REFLECT((golos::plugins::database_api::owner_authority_history_api_object), 34 | (id)(account)(previous_owner_authority)(last_valid_time)) 35 | #endif //GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 36 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/proposal_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace database_api { 10 | 11 | struct proposal_api_object final { 12 | proposal_api_object() = default; 13 | 14 | proposal_api_object(const golos::chain::proposal_object& p); 15 | 16 | protocol::account_name_type author; 17 | std::string title; 18 | std::string memo; 19 | 20 | time_point_sec expiration_time; 21 | optional review_period_time; 22 | std::vector proposed_operations; 23 | flat_set required_active_approvals; 24 | flat_set available_active_approvals; 25 | flat_set required_owner_approvals; 26 | flat_set available_owner_approvals; 27 | flat_set required_posting_approvals; 28 | flat_set available_posting_approvals; 29 | flat_set available_key_approvals; 30 | }; 31 | 32 | }}} // golos::plugins::database_api 33 | 34 | FC_REFLECT( 35 | (golos::plugins::database_api::proposal_api_object), 36 | (author)(title)(memo)(expiration_time)(review_period_time)(proposed_operations) 37 | (required_active_approvals)(available_active_approvals) 38 | (required_owner_approvals)(available_owner_approvals) 39 | (required_posting_approvals)(available_posting_approvals) 40 | (available_key_approvals)) -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/savings_withdraw_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 2 | #define GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace plugins { 9 | namespace database_api { 10 | using golos::chain::savings_withdraw_object; 11 | 12 | struct savings_withdraw_api_object { 13 | savings_withdraw_api_object(const golos::chain::savings_withdraw_object &o) : id(o.id), from(o.from), to(o.to), 14 | memo(golos::chain::to_string(o.memo)), request_id(o.request_id), amount(o.amount), complete(o.complete) { 15 | } 16 | 17 | savings_withdraw_api_object() { 18 | } 19 | 20 | savings_withdraw_object::id_type id; 21 | account_name_type from; 22 | account_name_type to; 23 | string memo; 24 | uint32_t request_id = 0; 25 | asset amount; 26 | time_point_sec complete; 27 | }; 28 | } 29 | } 30 | } 31 | 32 | FC_REFLECT((golos::plugins::database_api::savings_withdraw_api_object), 33 | (id)(from)(to)(memo)(request_id)(amount)(complete)) 34 | 35 | #endif //GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 36 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/forward.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_FORWARD_HPP 2 | #define GOLOS_FORWARD_HPP 3 | 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace database_api { 7 | typedef golos::chain::change_recovery_account_request_object change_recovery_account_request_api_object; 8 | typedef golos::chain::block_summary_object block_summary_api_object; 9 | typedef golos::chain::comment_vote_object comment_vote_api_object; 10 | typedef golos::chain::dynamic_global_property_object dynamic_global_property_api_object; 11 | typedef golos::chain::convert_request_object convert_request_api_object; 12 | typedef golos::chain::escrow_object escrow_api_object; 13 | typedef golos::chain::liquidity_reward_balance_object liquidity_reward_balance_api_object; 14 | typedef golos::chain::limit_order_object limit_order_api_object; 15 | typedef golos::chain::withdraw_vesting_route_object withdraw_vesting_route_api_object; 16 | typedef golos::chain::decline_voting_rights_request_object decline_voting_rights_request_api_object; 17 | typedef golos::chain::witness_vote_object witness_vote_api_object; 18 | typedef golos::chain::witness_schedule_object witness_schedule_api_object; 19 | typedef golos::chain::account_bandwidth_object account_bandwidth_api_object; 20 | 21 | using vesting_delegation_api_object = golos::chain::vesting_delegation_object; 22 | using vesting_delegation_expiration_api_object = golos::chain::vesting_delegation_expiration_object; 23 | 24 | } } } // golos::plugins::database_api 25 | 26 | #endif //GOLOS_FORWARD_HPP 27 | -------------------------------------------------------------------------------- /plugins/database_api/proposal_api_object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace plugins { namespace database_api { 4 | 5 | proposal_api_object::proposal_api_object(const golos::chain::proposal_object& p) 6 | : author(p.author), 7 | title(golos::chain::to_string(p.title)), 8 | memo(golos::chain::to_string(p.memo)), 9 | expiration_time(p.expiration_time), 10 | review_period_time(p.review_period_time), 11 | proposed_operations(p.operations()), 12 | required_active_approvals(p.required_active_approvals.begin(), p.required_active_approvals.end()), 13 | available_active_approvals(p.available_active_approvals.begin(), p.available_active_approvals.end()), 14 | required_owner_approvals(p.required_owner_approvals.begin(), p.required_owner_approvals.end()), 15 | available_owner_approvals(p.available_owner_approvals.begin(), p.available_owner_approvals.end()), 16 | required_posting_approvals(p.required_posting_approvals.begin(), p.required_posting_approvals.end()), 17 | available_posting_approvals(p.available_posting_approvals.begin(), p.available_posting_approvals.end()), 18 | available_key_approvals(p.available_key_approvals.begin(), p.available_key_approvals.end()) { 19 | } 20 | 21 | }}} // golos::plugins::database_api -------------------------------------------------------------------------------- /plugins/debug_node/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET debug_node) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/debug_node/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_protocol 31 | appbase 32 | graphene_utilities 33 | golos_chain_plugin 34 | # golos_json_rpc_plugin 35 | fc 36 | ) 37 | 38 | target_include_directories( 39 | golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) 51 | -------------------------------------------------------------------------------- /plugins/follow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET follow) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/follow/follow_api_object.hpp 5 | include/golos/plugins/follow/follow_evaluators.hpp 6 | include/golos/plugins/follow/follow_objects.hpp 7 | include/golos/plugins/follow/follow_operations.hpp 8 | include/golos/plugins/follow/follow_forward.hpp 9 | include/golos/plugins/follow/plugin.hpp 10 | ) 11 | 12 | list(APPEND CURRENT_TARGET_SOURCES 13 | follow_evaluators.cpp 14 | follow_operations.cpp 15 | plugin.cpp 16 | ) 17 | 18 | if(BUILD_SHARED_LIBRARIES) 19 | add_library(golos_${CURRENT_TARGET} SHARED 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | else() 24 | add_library(golos_${CURRENT_TARGET} STATIC 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | endif() 29 | 30 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 31 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 32 | 33 | target_link_libraries( 34 | golos_${CURRENT_TARGET} 35 | golos_chain 36 | golos::json_rpc 37 | golos::chain_plugin 38 | golos::protocol 39 | golos::api 40 | golos::social_network 41 | appbase 42 | fc 43 | ) 44 | target_include_directories(golos_${CURRENT_TARGET} PUBLIC "include") 45 | 46 | install(TARGETS 47 | golos_${CURRENT_TARGET} 48 | 49 | RUNTIME DESTINATION bin 50 | LIBRARY DESTINATION lib 51 | ARCHIVE DESTINATION lib 52 | ) -------------------------------------------------------------------------------- /plugins/follow/include/golos/plugins/follow/follow_evaluators.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_FOLLOW_EVALUATORS_HPP 2 | #define GOLOS_FOLLOW_EVALUATORS_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { 9 | namespace plugins { 10 | namespace follow { 11 | using golos::chain::evaluator; 12 | using golos::chain::database; 13 | 14 | class follow_evaluator : public golos::chain::evaluator_impl { 15 | public: 16 | typedef follow_operation operation_type; 17 | 18 | follow_evaluator(database& db, plugin* plugin) : golos::chain::evaluator_impl(db), _plugin(plugin) { 19 | } 20 | 21 | void do_apply(const follow_operation& o); 22 | 23 | plugin* _plugin; 24 | }; 25 | 26 | class reblog_evaluator : public golos::chain::evaluator_impl { 27 | public: 28 | typedef reblog_operation operation_type; 29 | 30 | reblog_evaluator(database& db, plugin* plugin) : golos::chain::evaluator_impl(db), _plugin(plugin) { 31 | } 32 | 33 | void do_apply(const reblog_operation& o); 34 | 35 | plugin* _plugin; 36 | }; 37 | 38 | class delete_reblog_evaluator : public golos::chain::evaluator_impl { 39 | public: 40 | typedef delete_reblog_operation operation_type; 41 | 42 | delete_reblog_evaluator(database& db, plugin* plugin) : golos::chain::evaluator_impl(db), _plugin(plugin) { 43 | } 44 | 45 | void do_apply(const delete_reblog_operation& o); 46 | 47 | plugin* _plugin; 48 | }; 49 | } 50 | } 51 | } 52 | 53 | #endif //GOLOS_FOLLOW_EVALUATORS_HPP 54 | -------------------------------------------------------------------------------- /plugins/follow/include/golos/plugins/follow/follow_forward.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_FOLLOW_FORWARD_HPP 2 | #define GOLOS_FOLLOW_FORWARD_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace follow { 9 | 10 | enum follow_type { 11 | undefined, 12 | blog, 13 | ignore 14 | }; 15 | 16 | }}} 17 | 18 | FC_REFLECT_ENUM(golos::plugins::follow::follow_type, (undefined)(blog)(ignore)) 19 | 20 | #endif //GOLOS_FORWARD_HPP 21 | -------------------------------------------------------------------------------- /plugins/follow/include/golos/plugins/follow/follow_operations.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace plugins { 9 | namespace follow { 10 | using golos::chain::base_operation; 11 | using golos::protocol::account_name_type; 12 | struct follow_operation : base_operation { 13 | protocol::account_name_type follower; 14 | protocol::account_name_type following; 15 | std::set what; /// blog, mute 16 | 17 | void validate() const; 18 | void get_required_posting_authorities(flat_set& a) const { 19 | a.insert(follower); 20 | } 21 | }; 22 | 23 | struct reblog_operation : base_operation { 24 | protocol::account_name_type account; 25 | protocol::account_name_type author; 26 | std::string permlink; 27 | string title; 28 | string body; 29 | string json_metadata; 30 | 31 | void validate() const; 32 | void get_required_posting_authorities(flat_set& a) const { 33 | a.insert(account); 34 | } 35 | }; 36 | 37 | struct delete_reblog_operation : base_operation { 38 | protocol::account_name_type account; 39 | protocol::account_name_type author; 40 | std::string permlink; 41 | 42 | void validate() const; 43 | void get_required_posting_authorities(flat_set& a) const { 44 | a.insert(account); 45 | } 46 | }; 47 | 48 | using follow_plugin_operation = fc::static_variant; 49 | 50 | } 51 | } 52 | } // golos::follow 53 | 54 | FC_REFLECT((golos::plugins::follow::follow_operation), (follower)(following)(what)); 55 | FC_REFLECT((golos::plugins::follow::reblog_operation), (account)(author)(permlink)(title)(body)(json_metadata)); 56 | FC_REFLECT((golos::plugins::follow::delete_reblog_operation), (account)(author)(permlink)); 57 | 58 | FC_REFLECT_TYPENAME((golos::plugins::follow::follow_plugin_operation)); 59 | DECLARE_OPERATION_TYPE(golos::plugins::follow::follow_plugin_operation) 60 | -------------------------------------------------------------------------------- /plugins/json_rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET json_rpc) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/json_rpc/plugin.hpp 5 | include/golos/plugins/json_rpc/utility.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | target_link_libraries(golos_${CURRENT_TARGET} golos_protocol appbase fc) 27 | target_include_directories(golos_${CURRENT_TARGET} 28 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 29 | 30 | install(TARGETS 31 | golos_${CURRENT_TARGET} 32 | 33 | RUNTIME DESTINATION bin 34 | LIBRARY DESTINATION lib 35 | ARCHIVE DESTINATION lib 36 | ) 37 | -------------------------------------------------------------------------------- /plugins/market_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET market_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/market_history/market_history_plugin.hpp 5 | include/golos/plugins/market_history/market_history_objects.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | market_history_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::p2p 31 | golos::protocol 32 | golos::network 33 | graphene_utilities 34 | graphene_time 35 | appbase 36 | ) 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) 47 | 48 | -------------------------------------------------------------------------------- /plugins/mongo_db/include/golos/plugins/mongo_db/mongo_db_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | namespace golos { 11 | namespace plugins { 12 | namespace mongo_db { 13 | 14 | class mongo_db_plugin final : public appbase::plugin { 15 | public: 16 | 17 | APPBASE_PLUGIN_REQUIRES( 18 | (chain::plugin) 19 | ) 20 | 21 | mongo_db_plugin(); 22 | 23 | virtual ~mongo_db_plugin(); 24 | 25 | void set_program_options( 26 | boost::program_options::options_description& cli, 27 | boost::program_options::options_description& cfg 28 | ) override; 29 | 30 | void plugin_initialize(const boost::program_options::variables_map& options) override; 31 | 32 | void plugin_startup() override; 33 | 34 | void plugin_shutdown() override; 35 | 36 | constexpr const static char *plugin_name = "mongo_db"; 37 | 38 | static const std::string& name() { 39 | static std::string name = plugin_name; 40 | return name; 41 | } 42 | 43 | private: 44 | class mongo_db_plugin_impl; 45 | 46 | std::unique_ptr pimpl_; 47 | }; 48 | 49 | }}} // namespace golos::plugins::mongo_db 50 | 51 | -------------------------------------------------------------------------------- /plugins/mongo_db/mongo_db_types.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { 4 | namespace plugins { 5 | namespace mongo_db { 6 | 7 | void bmi_insert_or_replace(db_map& bmi, named_document doc) { 8 | auto& idx = bmi.get(); 9 | auto it = idx.find(std::make_tuple( 10 | doc.collection_name, 11 | doc.key, doc.keyval, doc.is_removal)); 12 | if (it != idx.end()) { 13 | idx.erase(it); 14 | } 15 | idx.emplace(std::move(doc)); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /plugins/network_broadcast_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET network_broadcast_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/network_broadcast_api/network_broadcast_api_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | network_broadcast_api.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 25 | 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos::chain_plugin 30 | golos::json_rpc 31 | golos::p2p 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /plugins/operation_dump/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET operation_dump) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/operation_dump/operation_dump_plugin.hpp 5 | include/golos/plugins/operation_dump/operation_dump_container.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | operation_dump_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::follow 31 | golos::tags 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_container.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace operation_dump { 8 | 9 | namespace bfs = boost::filesystem; 10 | 11 | // Structure size can differ - uses sizeof 12 | struct dump_header { 13 | char magic[13] = "Golos\adumpOP"; 14 | uint32_t version = 1; 15 | }; 16 | 17 | using operation_number = std::pair; 18 | 19 | class dump_buffer : public std::stringstream { 20 | public: 21 | dump_buffer() { 22 | } 23 | 24 | using std::stringstream::write; 25 | 26 | void write(const operation_number& op_num) { 27 | fc::raw::pack(*this, op_num); 28 | } 29 | }; 30 | 31 | using dump_buffers = std::map; 32 | 33 | class dump_file : public bfs::ofstream { 34 | public: 35 | dump_file(const bfs::path& p): bfs::ofstream(p, std::ios_base::binary | std::ios_base::app) { 36 | bfs::ofstream::exceptions(std::ofstream::failbit | std::ofstream::badbit); 37 | } 38 | 39 | void write(const dump_header& hdr) { 40 | bfs::ofstream::write((const char*)&hdr, sizeof(dump_header)); 41 | } 42 | }; 43 | 44 | } } } // golos::plugins::operation_dump 45 | -------------------------------------------------------------------------------- /plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace golos { namespace plugins { namespace operation_dump { 11 | 12 | namespace bpo = boost::program_options; 13 | using namespace golos::chain; 14 | 15 | template 16 | using clarifications = std::map>; 17 | 18 | class operation_dump_plugin final : public appbase::plugin { 19 | public: 20 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 21 | 22 | operation_dump_plugin(); 23 | 24 | ~operation_dump_plugin(); 25 | 26 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 27 | 28 | void plugin_initialize(const bpo::variables_map& options) override; 29 | 30 | void plugin_startup() override; 31 | 32 | void plugin_shutdown() override; 33 | 34 | static const std::string& name(); 35 | 36 | dump_buffers buffers; 37 | clarifications vote_rshares; 38 | clarifications not_deleted_comments; 39 | clarifications transfer_golos_amounts; 40 | private: 41 | class operation_dump_plugin_impl; 42 | 43 | std::unique_ptr my; 44 | }; 45 | 46 | } } } //golos::plugins::operation_dump 47 | -------------------------------------------------------------------------------- /plugins/operation_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET operation_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/operation_history/plugin.hpp 5 | include/golos/plugins/operation_history/history_object.hpp 6 | include/golos/plugins/operation_history/applied_operation.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | plugin.cpp 11 | applied_operation.cpp 12 | ) 13 | 14 | if (BUILD_SHARED_LIBRARIES) 15 | add_library(golos_${CURRENT_TARGET} SHARED 16 | ${CURRENT_TARGET_HEADERS} 17 | ${CURRENT_TARGET_SOURCES} 18 | ) 19 | else() 20 | add_library(golos_${CURRENT_TARGET} STATIC 21 | ${CURRENT_TARGET_HEADERS} 22 | ${CURRENT_TARGET_SOURCES} 23 | ) 24 | endif() 25 | 26 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 27 | 28 | target_link_libraries ( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_chain_plugin 32 | golos_protocol 33 | appbase 34 | golos_json_rpc 35 | graphene_time 36 | chainbase 37 | fc 38 | golos::api 39 | ) 40 | 41 | target_include_directories(golos_${CURRENT_TARGET} 42 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 43 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 44 | ) 45 | 46 | install(TARGETS 47 | golos_${CURRENT_TARGET} 48 | 49 | RUNTIME DESTINATION bin 50 | LIBRARY DESTINATION lib 51 | ARCHIVE DESTINATION lib 52 | ) -------------------------------------------------------------------------------- /plugins/operation_history/applied_operation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace plugins { namespace operation_history { 4 | 5 | applied_operation::applied_operation() = default; 6 | 7 | applied_operation::applied_operation(const operation_object& op_obj) 8 | : trx_id(op_obj.trx_id), 9 | block(op_obj.block), 10 | trx_in_block(op_obj.trx_in_block), 11 | op_in_trx(op_obj.op_in_trx), 12 | virtual_op(op_obj.virtual_op), 13 | timestamp(op_obj.timestamp), 14 | op(fc::raw::unpack(op_obj.serialized_op)) { 15 | } 16 | 17 | } } } // golos::plugins::operation_history 18 | -------------------------------------------------------------------------------- /plugins/operation_history/include/golos/plugins/operation_history/applied_operation.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace operation_history { 8 | 9 | struct applied_operation final { 10 | applied_operation(); 11 | 12 | applied_operation(const operation_object&); 13 | 14 | golos::protocol::transaction_id_type trx_id; 15 | uint32_t block = 0; 16 | uint32_t trx_in_block = 0; 17 | uint16_t op_in_trx = 0; 18 | uint64_t virtual_op = 0; 19 | fc::time_point_sec timestamp; 20 | golos::protocol::operation op; 21 | }; 22 | 23 | } } } // golos::plugins::operation_history 24 | 25 | FC_REFLECT( 26 | (golos::plugins::operation_history::applied_operation), 27 | (trx_id)(block)(trx_in_block)(op_in_trx)(virtual_op)(timestamp)(op)) 28 | -------------------------------------------------------------------------------- /plugins/p2p/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET p2p) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/p2p/p2p_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | p2p_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos::chain_plugin 31 | golos::network 32 | appbase 33 | ) 34 | 35 | target_include_directories( 36 | golos_${CURRENT_TARGET} 37 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 38 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 39 | ) 40 | 41 | install(TARGETS 42 | golos_${CURRENT_TARGET} 43 | 44 | RUNTIME DESTINATION bin 45 | LIBRARY DESTINATION lib 46 | ARCHIVE DESTINATION lib 47 | ) 48 | -------------------------------------------------------------------------------- /plugins/p2p/include/golos/plugins/p2p/p2p_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #define STEEM_P2P_PLUGIN_NAME "p2p" 8 | 9 | namespace golos { 10 | namespace plugins { 11 | namespace p2p { 12 | namespace bpo = boost::program_options; 13 | 14 | namespace detail { 15 | class p2p_plugin_impl; 16 | } 17 | 18 | class p2p_plugin final : public appbase::plugin { 19 | public: 20 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 21 | 22 | p2p_plugin(); 23 | 24 | ~p2p_plugin(); 25 | 26 | void set_program_options(boost::program_options::options_description &, 27 | boost::program_options::options_description &config_file_options) override; 28 | 29 | static const std::string &name() { 30 | static std::string name = STEEM_P2P_PLUGIN_NAME; 31 | return name; 32 | } 33 | 34 | void plugin_initialize(const boost::program_options::variables_map &options) override; 35 | 36 | void plugin_startup() override; 37 | 38 | void plugin_shutdown() override; 39 | 40 | void broadcast_block(const golos::protocol::signed_block &block); 41 | 42 | void broadcast_transaction(const golos::protocol::signed_transaction &tx); 43 | 44 | void set_block_production(bool producing_blocks); 45 | 46 | private: 47 | std::unique_ptr my; 48 | }; 49 | 50 | } 51 | } 52 | } // steem::plugins::p2p 53 | -------------------------------------------------------------------------------- /plugins/private_message/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET private_message) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/private_message/private_message_plugin.hpp 5 | include/golos/plugins/private_message/private_message_api_objects.hpp 6 | include/golos/plugins/private_message/private_message_objects.hpp 7 | include/golos/plugins/private_message/private_message_operations.hpp 8 | include/golos/plugins/private_message/private_message_evaluators.hpp 9 | include/golos/plugins/private_message/private_message_exceptions.hpp 10 | ) 11 | 12 | list(APPEND CURRENT_TARGET_SOURCES 13 | private_message_plugin.cpp 14 | private_message_api_objects.cpp 15 | private_message_operations.cpp 16 | ) 17 | 18 | if(BUILD_SHARED_LIBRARIES) 19 | add_library(golos_${CURRENT_TARGET} SHARED 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | else() 24 | add_library(golos_${CURRENT_TARGET} STATIC 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | endif() 29 | 30 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 31 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 32 | 33 | target_link_libraries( 34 | golos_${CURRENT_TARGET} 35 | golos::chain_plugin 36 | golos::protocol 37 | golos::network 38 | golos::json_rpc 39 | graphene_utilities 40 | graphene_time 41 | appbase 42 | ) 43 | target_include_directories(golos_${CURRENT_TARGET} 44 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 45 | 46 | install(TARGETS 47 | golos_${CURRENT_TARGET} 48 | 49 | RUNTIME DESTINATION bin 50 | LIBRARY DESTINATION lib 51 | ARCHIVE DESTINATION lib 52 | ) 53 | 54 | -------------------------------------------------------------------------------- /plugins/private_message/include/golos/plugins/private_message/private_message_exceptions.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace private_message { 7 | 8 | struct logic_errors { 9 | enum types { 10 | cannot_send_to_yourself, 11 | from_and_to_memo_keys_must_be_different, 12 | cannot_add_contact_to_yourself, 13 | sender_in_ignore_list, 14 | recepient_ignores_messages_from_unknown_contact, 15 | add_unknown_contact, 16 | contact_has_not_changed, 17 | no_unread_messages, 18 | }; 19 | }; 20 | 21 | } } } // golos::plugins::private_message 22 | 23 | namespace golos { 24 | template<> 25 | inline std::string get_logic_error_namespace() { 26 | return golos::plugins::private_message::private_message_plugin::name(); 27 | } 28 | } 29 | 30 | FC_REFLECT_ENUM(golos::plugins::private_message::logic_errors::types, 31 | (cannot_send_to_yourself) 32 | (from_and_to_memo_keys_must_be_different) 33 | (cannot_add_contact_to_yourself) 34 | (sender_in_ignore_list) 35 | (recepient_ignores_messages_from_unknown_contact) 36 | (add_unknown_contact) 37 | (contact_has_not_changed) 38 | (no_unread_messages) 39 | ); -------------------------------------------------------------------------------- /plugins/private_message/private_message_api_objects.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace golos { namespace plugins { namespace private_message { 5 | 6 | message_api_object::message_api_object(const message_object& o) 7 | : from(o.from), 8 | to(o.to), 9 | nonce(o.nonce), 10 | from_memo_key(o.from_memo_key), 11 | to_memo_key(o.to_memo_key), 12 | checksum(o.checksum), 13 | encrypted_message(o.encrypted_message.begin(), o.encrypted_message.end()), 14 | create_date(std::max(o.inbox_create_date, o.outbox_create_date)), 15 | receive_date(o.receive_date), 16 | read_date(o.read_date), 17 | remove_date(o.remove_date) { 18 | } 19 | 20 | message_api_object::message_api_object() = default; 21 | 22 | 23 | settings_api_object::settings_api_object(const settings_object& o) 24 | : ignore_messages_from_unknown_contact(o.ignore_messages_from_unknown_contact) { 25 | } 26 | 27 | settings_api_object::settings_api_object() = default; 28 | 29 | 30 | contact_api_object::contact_api_object(const contact_object& o) 31 | : owner(o.owner), 32 | contact(o.contact), 33 | json_metadata(o.json_metadata.begin(), o.json_metadata.end()), 34 | local_type(o.type), 35 | size(o.size) { 36 | } 37 | 38 | contact_api_object::contact_api_object() = default; 39 | 40 | } } } // golos::plugins::private_message 41 | 42 | 43 | -------------------------------------------------------------------------------- /plugins/raw_block/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET raw_block) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/raw_block/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_chain_plugin 31 | golos_protocol 32 | appbase 33 | golos::json_rpc 34 | fc 35 | ) 36 | 37 | target_include_directories( 38 | golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 40 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 41 | ) 42 | 43 | install(TARGETS 44 | golos_${CURRENT_TARGET} 45 | 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib 49 | ) 50 | -------------------------------------------------------------------------------- /plugins/raw_block/include/golos/plugins/raw_block/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace golos { 12 | namespace plugins { 13 | namespace raw_block { 14 | 15 | using golos::plugins::json_rpc::msg_pack; 16 | 17 | struct get_raw_block_r { 18 | golos::chain::block_id_type block_id; 19 | golos::chain::block_id_type previous; 20 | fc::time_point_sec timestamp; 21 | std::string raw_block; 22 | }; 23 | 24 | DEFINE_API_ARGS ( get_raw_block, msg_pack, get_raw_block_r ) 25 | 26 | using boost::program_options::options_description; 27 | 28 | class plugin final : public appbase::plugin { 29 | public: 30 | APPBASE_PLUGIN_REQUIRES( 31 | (chain::plugin) 32 | (json_rpc::plugin) 33 | ) 34 | 35 | constexpr const static char *plugin_name = "raw_block"; 36 | 37 | static const std::string &name() { 38 | static std::string name = plugin_name; 39 | return name; 40 | } 41 | 42 | plugin(); 43 | 44 | ~plugin(); 45 | 46 | void set_program_options( 47 | boost::program_options::options_description &cli, 48 | boost::program_options::options_description &cfg) override { 49 | } 50 | 51 | void plugin_initialize(const boost::program_options::variables_map &options) override; 52 | 53 | void plugin_startup() override; 54 | 55 | void plugin_shutdown() override; 56 | 57 | DECLARE_API ( 58 | (get_raw_block) 59 | ) 60 | 61 | private: 62 | struct plugin_impl; 63 | 64 | std::unique_ptr my; 65 | }; 66 | 67 | } } } // golos::plugins::raw_block 68 | 69 | FC_REFLECT((golos::plugins::raw_block::get_raw_block_r), 70 | (block_id)(previous)(timestamp)(raw_block) 71 | ) 72 | -------------------------------------------------------------------------------- /plugins/raw_block/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace golos { 10 | namespace plugins { 11 | namespace raw_block { 12 | 13 | struct plugin::plugin_impl { 14 | public: 15 | plugin_impl() : db_(appbase::app().get_plugin().db()) { 16 | } 17 | // API 18 | get_raw_block_r get_raw_block(uint32_t block_num = 0); 19 | 20 | // HELPING METHODS 21 | golos::chain::database &database() { 22 | return db_; 23 | } 24 | private: 25 | golos::chain::database & db_; 26 | }; 27 | 28 | get_raw_block_r plugin::plugin_impl::get_raw_block(uint32_t block_num) { 29 | get_raw_block_r result; 30 | const auto &db = database(); 31 | 32 | auto block = db.fetch_block_by_number(block_num); 33 | if (!block.valid()) { 34 | return result; 35 | } 36 | std::vector serialized_block = fc::raw::pack(*block); 37 | result.raw_block = fc::base64_encode( 38 | std::string( 39 | &serialized_block[0], 40 | &serialized_block[0] + serialized_block.size() 41 | ) 42 | ); 43 | result.block_id = block->id(); 44 | result.previous = block->previous; 45 | result.timestamp = block->timestamp; 46 | return result; 47 | } 48 | 49 | DEFINE_API ( plugin, get_raw_block ) { 50 | PLUGIN_API_VALIDATE_ARGS( 51 | (uint32_t, block_num) 52 | ); 53 | auto &db = my->database(); 54 | return db.with_weak_read_lock([&]() { 55 | return my->get_raw_block(block_num); 56 | }); 57 | } 58 | 59 | plugin::plugin() { 60 | } 61 | 62 | plugin::~plugin() { 63 | } 64 | 65 | void plugin::plugin_initialize(const boost::program_options::variables_map &options) { 66 | my.reset(new plugin_impl); 67 | JSON_RPC_REGISTER_API ( name() ) ; 68 | } 69 | 70 | void plugin::plugin_startup() { 71 | } 72 | 73 | void plugin::plugin_shutdown() { 74 | } 75 | 76 | } } } // golos::plugin::raw_block 77 | -------------------------------------------------------------------------------- /plugins/social_network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET social_network) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/social_network/social_network.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | social_network.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos::chain_plugin 31 | golos::network 32 | golos::follow 33 | golos::tags 34 | appbase 35 | ) 36 | 37 | target_include_directories( 38 | golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 40 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 41 | ) 42 | 43 | install(TARGETS 44 | golos_${CURRENT_TARGET} 45 | 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib 49 | ) 50 | -------------------------------------------------------------------------------- /plugins/statsd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET statsd) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/statsd/plugin.hpp 5 | include/golos/plugins/statsd/statistics_sender.hpp 6 | include/golos/plugins/statsd/runtime_bucket_object.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | plugin.cpp 11 | statistics_sender.cpp 12 | ) 13 | 14 | if(BUILD_SHARED_LIBRARIES) 15 | add_library( golos_${CURRENT_TARGET} SHARED 16 | ${CURRENT_TARGET_HEADERS} 17 | ${CURRENT_TARGET_SOURCES} 18 | ) 19 | else() 20 | add_library( golos_${CURRENT_TARGET} STATIC 21 | ${CURRENT_TARGET_HEADERS} 22 | ${CURRENT_TARGET_SOURCES} 23 | ) 24 | endif() 25 | 26 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_chain_plugin 32 | golos_protocol 33 | appbase 34 | fc 35 | ) 36 | 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 39 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 40 | ) 41 | 42 | install(TARGETS 43 | golos_${CURRENT_TARGET} 44 | 45 | RUNTIME DESTINATION bin 46 | LIBRARY DESTINATION lib 47 | ARCHIVE DESTINATION lib 48 | ) 49 | 50 | # TODO 51 | # Maybe we should also do smthng like this. 52 | # install(FILES ${HEADERS} DESTINATION "include/golos/chain_plugin") 53 | -------------------------------------------------------------------------------- /plugins/statsd/include/golos/plugins/statsd/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // 11 | // Plugins should #define their SPACE_ID's so plugins with 12 | // conflicting SPACE_ID assignments can be compiled into the 13 | // same binary (by simply re-assigning some of the conflicting #defined 14 | // SPACE_ID's in a build script). 15 | // 16 | // Assignment of SPACE_ID's cannot be done at run-time because 17 | // various template automagic depends on them being known at compile 18 | // time. 19 | // 20 | #ifndef STATSD_SPACE_ID 21 | #define STATSD_SPACE_ID 9 22 | #endif 23 | 24 | #ifndef STATSD_PLUGIN_NAME 25 | #define STATSD_PLUGIN_NAME "statsd" 26 | #endif 27 | 28 | namespace golos { 29 | namespace plugins { 30 | namespace statsd { 31 | 32 | using namespace golos::chain; 33 | using boost::program_options::options_description; 34 | using boost::program_options::variables_map; 35 | 36 | 37 | class plugin final : public appbase::plugin { 38 | public: 39 | static const std::string &name() { 40 | static std::string name = STATSD_PLUGIN_NAME; 41 | return name; 42 | } 43 | 44 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 45 | 46 | plugin(); 47 | 48 | ~plugin(); 49 | 50 | void set_program_options( options_description& cli, options_description& cfg ) override ; 51 | 52 | void plugin_initialize(const boost::program_options::variables_map &options) override; 53 | 54 | void plugin_startup() override; 55 | 56 | const flat_set &get_tracked_buckets() const; 57 | 58 | uint32_t get_max_history_per_bucket() const; 59 | 60 | void plugin_shutdown() override; 61 | 62 | private: 63 | struct plugin_impl; 64 | 65 | std::unique_ptr _my; 66 | }; 67 | 68 | } } } // golos::plugins::statsd 69 | -------------------------------------------------------------------------------- /plugins/statsd/include/golos/plugins/statsd/statistics_sender.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace golos::chain; 10 | 11 | class statistics_sender final { 12 | public: 13 | statistics_sender() ; 14 | statistics_sender(uint32_t default_port); 15 | 16 | ~statistics_sender() = default; 17 | 18 | bool can_start(); 19 | 20 | // sends a string to all endpoints 21 | void push(const std::string & str); 22 | 23 | // adds address to recipient_endpoint_set. 24 | void add_address(const std::string & address); 25 | 26 | /// returns statistics recievers endpoints 27 | std::vector get_endpoint_string_vector(); 28 | 29 | golos::plugins::statsd::runtime_bucket_object previous_bucket; 30 | golos::plugins::statsd::runtime_bucket_object current_bucket; 31 | bool is_previous_bucket_set; 32 | private: 33 | // Stat sender will send data to all endpoints from recipient_endpoint_set 34 | std::set recipient_endpoint_set; 35 | // DefaultPort for asio broadcasting 36 | uint32_t default_port; 37 | void init(); 38 | boost::asio::io_service & ios; 39 | boost::asio::ip::udp::socket socket; 40 | }; 41 | -------------------------------------------------------------------------------- /plugins/tags/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET tags) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/tags/discussion_query.hpp 5 | include/golos/plugins/tags/plugin.hpp 6 | include/golos/plugins/tags/tag_api_object.hpp 7 | include/golos/plugins/tags/tag_visitor.hpp 8 | include/golos/plugins/tags/tags_object.hpp 9 | include/golos/plugins/tags/tags_sort.hpp 10 | ) 11 | 12 | list(APPEND CURRENT_TARGET_SOURCES 13 | plugin.cpp 14 | tag_visitor.cpp 15 | discussion_query.cpp 16 | ) 17 | 18 | if(BUILD_SHARED_LIBRARIES) 19 | add_library(golos_${CURRENT_TARGET} SHARED 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | else() 24 | add_library(golos_${CURRENT_TARGET} STATIC 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | endif() 29 | 30 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 31 | 32 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 33 | 34 | target_link_libraries( 35 | golos_${CURRENT_TARGET} 36 | golos_chain 37 | golos::chain_plugin 38 | golos::network 39 | golos::follow 40 | golos::api 41 | golos::social_network 42 | appbase 43 | ) 44 | 45 | target_include_directories( 46 | golos_${CURRENT_TARGET} 47 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 48 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 49 | ) 50 | 51 | install(TARGETS 52 | golos_${CURRENT_TARGET} 53 | 54 | RUNTIME DESTINATION bin 55 | LIBRARY DESTINATION lib 56 | ARCHIVE DESTINATION lib 57 | ) 58 | -------------------------------------------------------------------------------- /plugins/tags/include/golos/plugins/tags/tag_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_TAG_API_OBJ_HPP 2 | #define GOLOS_TAG_API_OBJ_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace tags { 8 | struct tag_api_object { 9 | tag_api_object(const tags::tag_stats_object& o) 10 | : name(o.name), 11 | total_children_rshares2(o.total_children_rshares2), 12 | total_payouts(o.total_payout), 13 | net_votes(o.net_votes), top_posts(o.top_posts), 14 | comments(o.comments) { 15 | } 16 | 17 | tag_api_object() { 18 | } 19 | 20 | std::string name; 21 | fc::uint128_t total_children_rshares2; 22 | golos::protocol::asset total_payouts; 23 | int32_t net_votes = 0; 24 | uint32_t top_posts = 0; 25 | uint32_t comments = 0; 26 | }; 27 | } } } // golos::plugins::tags 28 | 29 | 30 | FC_REFLECT((golos::plugins::tags::tag_api_object), 31 | (name)(total_children_rshares2)(total_payouts)(net_votes)(top_posts)(comments) 32 | ) 33 | #endif //GOLOS_TAG_API_OBJ_HPP 34 | -------------------------------------------------------------------------------- /plugins/test_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET test_api_plugin) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/test_api/test_api_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | test_api_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::json_rpc 30 | fc 31 | appbase 32 | ) 33 | 34 | target_include_directories( 35 | golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 37 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 38 | ) 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) 47 | 48 | install(FILES ${HEADERS} DESTINATION "include/golos/test_api_plugin") 49 | 50 | 51 | #target_link_libraries( test_api_plugin plugin appbase fc ) -------------------------------------------------------------------------------- /plugins/test_api/include/golos/plugins/test_api/test_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace golos { 9 | namespace plugins { 10 | namespace test_api { 11 | 12 | using namespace appbase; 13 | using json_rpc::msg_pack; 14 | using fc::variant; 15 | 16 | struct test_api_a_t { 17 | std::string value; 18 | }; 19 | struct test_api_b_t { 20 | std::string value; 21 | }; 22 | 23 | /// API, args, return 24 | DEFINE_API_ARGS(test_api_a, msg_pack, test_api_a_t) 25 | DEFINE_API_ARGS(test_api_b, msg_pack, test_api_b_t) 26 | 27 | class test_api_plugin final : public appbase::plugin { 28 | public: 29 | test_api_plugin(); 30 | 31 | ~test_api_plugin(); 32 | 33 | constexpr static const char *plugin_name = "test_api"; 34 | 35 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)); 36 | 37 | static const std::string &name() { 38 | static std::string name = plugin_name; 39 | return name; 40 | } 41 | 42 | void set_program_options(boost::program_options::options_description &, 43 | boost::program_options::options_description &) override { 44 | } 45 | 46 | void plugin_initialize(const boost::program_options::variables_map &options) override; 47 | 48 | void plugin_startup() override; 49 | 50 | void plugin_shutdown() override; 51 | 52 | DECLARE_API((test_api_a)(test_api_b)) 53 | }; 54 | 55 | } 56 | } 57 | } // steem::plugins::test_api 58 | 59 | FC_REFLECT((golos::plugins::test_api::test_api_a_t), (value)) 60 | FC_REFLECT((golos::plugins::test_api::test_api_b_t), (value)) 61 | -------------------------------------------------------------------------------- /plugins/test_api/test_api_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace plugins { 7 | namespace test_api { 8 | 9 | test_api_plugin::test_api_plugin() { 10 | } 11 | 12 | test_api_plugin::~test_api_plugin() { 13 | } 14 | 15 | void test_api_plugin::plugin_initialize(const boost::program_options::variables_map &options) { 16 | JSON_RPC_REGISTER_API(plugin_name); 17 | } 18 | 19 | void test_api_plugin::plugin_startup() { 20 | } 21 | 22 | void test_api_plugin::plugin_shutdown() { 23 | } 24 | 25 | DEFINE_API(test_api_plugin, test_api_a) { 26 | test_api_a_t result; 27 | result.value = "A"; 28 | return result; 29 | } 30 | 31 | DEFINE_API(test_api_plugin, test_api_b) { 32 | test_api_b_t result; 33 | result.value = "B"; 34 | return result; 35 | } 36 | 37 | } 38 | } 39 | } // steem::plugins::test_api 40 | -------------------------------------------------------------------------------- /plugins/webserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET webserver_plugin) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/webserver/webserver_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | webserver_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos::json_rpc 29 | golos_chain 30 | golos::chain_plugin 31 | appbase 32 | fc) 33 | target_include_directories(golos_${CURRENT_TARGET} 34 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 35 | 36 | install(TARGETS 37 | golos_${CURRENT_TARGET} 38 | 39 | RUNTIME DESTINATION bin 40 | LIBRARY DESTINATION lib 41 | ARCHIVE DESTINATION lib 42 | ) 43 | -------------------------------------------------------------------------------- /plugins/webserver/include/golos/plugins/webserver/webserver_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | 11 | #define STEEM_WEBSERVER_PLUGIN_NAME "webserver" 12 | 13 | namespace golos { 14 | namespace plugins { 15 | namespace webserver { 16 | 17 | using namespace appbase; 18 | 19 | /** 20 | * This plugin starts an HTTP/ws webserver and dispatches queries to 21 | * registered handles based on payload. The payload must be conform 22 | * to the JSONRPC 2.0 spec. 23 | * 24 | * The handler will be called from the appbase application io_service 25 | * thread. The callback can be called from any thread and will 26 | * automatically propagate the call to the http thread. 27 | * 28 | * The HTTP service will run in its own thread with its own io_service to 29 | * make sure that HTTP request processing does not interfer with other 30 | * plugins. 31 | */ 32 | class webserver_plugin final : public appbase::plugin { 33 | public: 34 | webserver_plugin(); 35 | 36 | ~webserver_plugin(); 37 | 38 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)); 39 | 40 | static const std::string &name() { 41 | static std::string name = STEEM_WEBSERVER_PLUGIN_NAME; 42 | return name; 43 | } 44 | 45 | void set_program_options(boost::program_options::options_description &, boost::program_options::options_description &cfg) override; 46 | 47 | protected: 48 | void plugin_initialize(const boost::program_options::variables_map &options) override; 49 | 50 | void plugin_startup() override; 51 | 52 | void plugin_shutdown() override; 53 | 54 | private: 55 | struct webserver_plugin_impl; 56 | std::unique_ptr my; 57 | }; 58 | 59 | } 60 | } 61 | } // steem::plugins::webserver 62 | -------------------------------------------------------------------------------- /plugins/witness/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET witness) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/witness/witness.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | witness.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 25 | 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos::chain_plugin 29 | golos::p2p 30 | golos::protocol 31 | golos::network 32 | graphene_utilities 33 | graphene_time 34 | appbase 35 | ) 36 | target_include_directories(golos_${CURRENT_TARGET} 37 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 38 | 39 | install(TARGETS 40 | golos_${CURRENT_TARGET} 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | 47 | -------------------------------------------------------------------------------- /plugins/witness/include/golos/plugins/witness/witness.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace golos { 12 | namespace plugins { 13 | namespace witness_plugin { 14 | 15 | using std::string; 16 | using protocol::public_key_type; 17 | using golos::protocol::block_id_type; 18 | using golos::chain::signed_block; 19 | 20 | namespace block_production_condition { 21 | enum block_production_condition_enum { 22 | produced = 0, 23 | not_synced = 1, 24 | not_my_turn = 2, 25 | not_time_yet = 3, 26 | no_private_key = 4, 27 | low_participation = 5, 28 | lag = 6, 29 | consecutive = 7, 30 | wait_for_genesis = 8, 31 | exception_producing_block = 9 32 | }; 33 | } 34 | 35 | class witness_plugin final : public appbase::plugin { 36 | public: 37 | APPBASE_PLUGIN_REQUIRES((chain::plugin) (p2p::p2p_plugin)) 38 | 39 | constexpr static const char *plugin_name = "witness"; 40 | 41 | static const std::string &name() { 42 | static std::string name = plugin_name; 43 | return name; 44 | } 45 | 46 | witness_plugin(); 47 | 48 | ~witness_plugin(); 49 | 50 | 51 | void set_program_options(boost::program_options::options_description &command_line_options, 52 | boost::program_options::options_description &config_file_options) override; 53 | 54 | void set_block_production(bool allow); 55 | 56 | void plugin_initialize(const boost::program_options::variables_map &options) override; 57 | 58 | void plugin_startup() override; 59 | 60 | void plugin_shutdown() override; 61 | 62 | private: 63 | struct impl; 64 | std::unique_ptr pimpl; 65 | 66 | }; 67 | 68 | } 69 | } 70 | } //golos::witness_plugin 71 | -------------------------------------------------------------------------------- /plugins/witness_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET witness_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/witness_api/plugin.hpp 5 | include/golos/plugins/witness_api/api_objects/feed_history_api_object.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if (BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | target_link_libraries ( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos_chain_plugin 30 | golos_protocol 31 | golos_api 32 | appbase 33 | golos_json_rpc 34 | graphene_time 35 | chainbase 36 | fc 37 | ) 38 | 39 | target_include_directories(golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) -------------------------------------------------------------------------------- /plugins/witness_api/include/golos/plugins/witness_api/api_objects/feed_history_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace plugins { namespace witness_api { 6 | 7 | using namespace golos::chain; 8 | using namespace golos::protocol; 9 | 10 | struct feed_history_api_object { 11 | feed_history_api_object(const feed_history_object &f) : 12 | id(f.id), 13 | current_median_history(f.current_median_history), 14 | price_history(f.price_history.begin(), f.price_history.end()) { 15 | } 16 | 17 | feed_history_api_object() { 18 | } 19 | 20 | feed_history_id_type id; 21 | price current_median_history; 22 | deque price_history; 23 | }; 24 | } 25 | } 26 | } 27 | 28 | FC_REFLECT((golos::plugins::witness_api::feed_history_api_object), (id)(current_median_history)(price_history)) 29 | -------------------------------------------------------------------------------- /programs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(build_helpers) 2 | add_subdirectory(cli_wallet) 3 | add_subdirectory(golosd) 4 | #add_subdirectory( delayed_node ) 5 | add_subdirectory(js_operation_serializer) 6 | add_subdirectory(size_checker) 7 | add_subdirectory(util) 8 | -------------------------------------------------------------------------------- /programs/build_helpers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(cat-parts cat-parts.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | # we only actually need Boost, but link against FC for now so we don't duplicate it. 7 | target_link_libraries(cat-parts PRIVATE fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | -------------------------------------------------------------------------------- /programs/build_helpers/cat-parts.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char **argv, char **envp) { 8 | if (argc != 3) { 9 | std::cerr << "syntax: cat-parts DIR OUTFILE" << std::endl; 10 | return 1; 11 | } 12 | 13 | boost::filesystem::path p(argv[1]); 14 | 15 | try { 16 | std::vector v; 17 | 18 | for (boost::filesystem::directory_iterator it(p); 19 | it != boost::filesystem::directory_iterator(); 20 | ++it) { 21 | boost::filesystem::path pit = it->path(); 22 | std::string spit = pit.generic_string(); 23 | size_t n = spit.length(); 24 | if (n <= 3) { 25 | continue; 26 | } 27 | if (spit.substr(n - 3, 3) != ".hf") { 28 | continue; 29 | } 30 | v.push_back(pit); 31 | } 32 | std::sort(v.begin(), v.end()); 33 | 34 | // open each file and grab its contents, concatenating into single stringstream 35 | std::stringstream ss_data; 36 | for (const boost::filesystem::path &p : v) { 37 | boost::filesystem::ifstream ifs(p); 38 | ss_data << ifs.rdbuf(); 39 | } 40 | std::string new_data = ss_data.str(); 41 | 42 | boost::filesystem::path opath(argv[2]); 43 | 44 | if (boost::filesystem::exists(opath)) { 45 | boost::filesystem::ifstream ifs(opath); 46 | std::stringstream ss_old_data; 47 | ss_old_data << ifs.rdbuf(); 48 | std::string old_data = ss_old_data.str(); 49 | if (old_data == new_data) { 50 | std::cerr << "File " << opath << " up-to-date with .d directory" 51 | << std::endl; 52 | return 0; 53 | } 54 | } 55 | 56 | { 57 | boost::filesystem::ofstream ofs(opath); 58 | ofs.write(new_data.c_str(), new_data.length()); 59 | } 60 | 61 | std::cerr << "Built " << opath << " from .d directory" << std::endl; 62 | } 63 | catch (const boost::filesystem::filesystem_error &e) { 64 | std::cout << e.what() << std::endl; 65 | return 1; 66 | } 67 | return 0; 68 | } -------------------------------------------------------------------------------- /programs/build_helpers/cat_parts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | from pathlib import Path 5 | 6 | 7 | def print_usage(program_name): 8 | print("usage: {} DIR OUTFILE".format(program_name)) 9 | 10 | 11 | def generate_concatenated_outfile(input_dir, suffix_filter="hf"): 12 | def predicate(path): 13 | if not path.is_file(): 14 | return false 15 | if suffix_filter == "": 16 | return true 17 | else: 18 | return path.suffix == ("." + suffix_filter) 19 | 20 | input_files = [p for p in input_dir.iterdir() if predicate(p)] 21 | output = "" 22 | for p in sorted(input_files): 23 | with p.open(mode='r') as f: 24 | output += f.read() 25 | return output 26 | 27 | 28 | def main(program_name, args): 29 | if len(args) < 2: 30 | print_usage(program_name) 31 | return 1 32 | 33 | input_dir = Path(args[0]) 34 | if not input_dir.is_dir(): 35 | print_usage(program_name) 36 | return 1 37 | 38 | out_file = Path(args[1]) 39 | if out_file.exists(): 40 | if not out_file.is_file(): 41 | print('Chosen OUTFILE "{}" is not a file'.format( 42 | out_file.absolute().as_posix())) 43 | return 1 44 | new_outfile_contents = generate_concatenated_outfile(input_dir) 45 | with out_file.open(mode='r') as f: 46 | if f.read() == new_outfile_contents: 47 | print('File "{}" up-to-date with .d directory'.format(out_file)) 48 | return 0 49 | else: 50 | if not out_file.parent.exists(): 51 | try: 52 | out_file.parent.mkdir(parents=True) 53 | except FileExistsError: 54 | pass 55 | except: 56 | print( 57 | 'Unexpected error occured while trying to create directory "{}"'.format( 58 | out_file.parent.absolute().as_posix())) 59 | raise 60 | elif not out_file.parent.is_dir(): 61 | print('"{}" is not a directory'.format( 62 | out_file.parent.absolute().as_posix())) 63 | return 1 64 | new_outfile_contents = generate_concatenated_outfile(input_dir) 65 | 66 | with out_file.open(mode='w') as f: 67 | f.write(new_outfile_contents) 68 | print('Built "{}" from .d directory'.format(out_file)) 69 | return 0 70 | 71 | 72 | if __name__ == "__main__": 73 | sys.exit(main(sys.argv[0], sys.argv[1:])) 74 | -------------------------------------------------------------------------------- /programs/cli_wallet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(cli_wallet main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | if(APPLE) 7 | list(APPEND PLATFORM_SPECIFIC_LIBS readline) 8 | endif() 9 | 10 | find_package(Gperftools QUIET) 11 | if(GPERFTOOLS_FOUND) 12 | message(STATUS "Found gperftools; compiling cli_wallet with TCMalloc") 13 | list(APPEND PLATFORM_SPECIFIC_LIBS tcmalloc) 14 | endif() 15 | 16 | FIND_PACKAGE(Boost REQUIRED COMPONENTS 17 | regex 18 | ) 19 | 20 | # I don't know why golos_app is required twice in the following line, I just know the linker breaks if it isn't. 21 | target_link_libraries( 22 | cli_wallet 23 | PRIVATE 24 | golos_network 25 | golos_chain 26 | golos_protocol 27 | graphene_utilities 28 | golos_wallet 29 | golos::database_api 30 | golos::account_history 31 | golos::market_history 32 | golos::social_network 33 | golos::private_message 34 | golos::follow 35 | golos::network_broadcast_api 36 | golos::witness_api 37 | fc 38 | ${readline_libraries} 39 | ${CMAKE_DL_LIBS} 40 | ${PLATFORM_SPECIFIC_LIBS} 41 | ${Boost_LIBRARIES} 42 | ) 43 | 44 | if(MSVC) 45 | set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "/bigobj") 46 | endif(MSVC) 47 | 48 | install(TARGETS 49 | cli_wallet 50 | 51 | RUNTIME DESTINATION bin 52 | LIBRARY DESTINATION lib 53 | ARCHIVE DESTINATION lib 54 | ) 55 | -------------------------------------------------------------------------------- /programs/golosd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET golosd) 2 | add_executable(${CURRENT_TARGET} main.cpp) 3 | 4 | if(UNIX AND NOT APPLE) 5 | set(rt_library rt) 6 | elseif(APPLE) 7 | list(APPEND PLATFORM_SPECIFIC_LIBS readline) 8 | endif() 9 | 10 | find_package(Gperftools QUIET) 11 | if(GPERFTOOLS_FOUND) 12 | message(STATUS "Found gperftools; compiling golosd with TCMalloc") 13 | list(APPEND PLATFORM_SPECIFIC_LIBS tcmalloc) 14 | endif() 15 | 16 | target_link_libraries( 17 | ${CURRENT_TARGET} PRIVATE 18 | appbase 19 | golos::webserver_plugin 20 | golos::p2p 21 | graphene_utilities 22 | golos::chain_plugin 23 | golos::network_broadcast_api 24 | golos::witness 25 | golos::witness_api 26 | golos::database_api 27 | golos::test_api_plugin 28 | golos::social_network 29 | golos::tags 30 | golos::market_history 31 | golos::operation_dump 32 | golos::operation_history 33 | golos::statsd 34 | golos::account_by_key 35 | golos::account_history 36 | golos::account_notes 37 | golos::private_message 38 | golos::auth_util 39 | golos::debug_node 40 | golos::raw_block 41 | golos::block_info 42 | golos::json_rpc 43 | golos::follow 44 | ${MONGO_LIB} 45 | golos_protocol 46 | fc 47 | ${CMAKE_DL_LIBS} 48 | ${PLATFORM_SPECIFIC_LIBS} 49 | ) 50 | 51 | install(TARGETS 52 | ${CURRENT_TARGET} 53 | 54 | RUNTIME DESTINATION bin 55 | LIBRARY DESTINATION lib 56 | ARCHIVE DESTINATION lib 57 | ) 58 | -------------------------------------------------------------------------------- /programs/js_operation_serializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(js_operation_serializer main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(js_operation_serializer 7 | PRIVATE 8 | golos_chain 9 | golos_protocol 10 | graphene_utilities 11 | golos::private_message 12 | golos::follow 13 | fc 14 | ${CMAKE_DL_LIBS} 15 | ${PLATFORM_SPECIFIC_LIBS}) 16 | 17 | install(TARGETS 18 | js_operation_serializer 19 | 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib 23 | ) 24 | -------------------------------------------------------------------------------- /programs/size_checker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(size_checker main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(size_checker 7 | PRIVATE golos_chain golos_protocol fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | 9 | install(TARGETS 10 | size_checker 11 | 12 | RUNTIME DESTINATION bin 13 | LIBRARY DESTINATION lib 14 | ARCHIVE DESTINATION lib 15 | ) 16 | -------------------------------------------------------------------------------- /programs/util/inflation_plot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json 4 | import matplotlib 5 | import sys 6 | 7 | matplotlib.use("Agg") 8 | 9 | import matplotlib.pyplot as plt 10 | from matplotlib.ticker import AutoMinorLocator 11 | 12 | x = [] 13 | y = [] 14 | 15 | names = ["curate", "content", "producer", "liquidity", "pow"] 16 | inflections = {} 17 | markers = [] 18 | 19 | colors = iter("mgbr") 20 | shapes = iter("ovx+") 21 | 22 | ax = plt.gca() 23 | 24 | plt.axis([0, 10, 5e9, 320e9]) 25 | ax.set_xticks(range(11)) 26 | ax.xaxis.set_minor_locator(AutoMinorLocator(12)) 27 | ax.set_yscale("log") 28 | ax.tick_params(axis="y", which="minor", left="off", right="off") 29 | ax.set_yticks( 30 | [10e6, 20e6, 40e6, 80e6, 160e6, 320e6, 640e6, 1300e6, 2600e6, 5200e6, 10e9, 31 | 20e9, 40e9, 80e9, 160e9, 320e9]) 32 | ax.set_yticklabels( 33 | ["10M", "20M", "40M", "80M", "160M", "320M", "640M", "1.3B", "2.6B", "5.2B", 34 | "10B", "20B", "40B", "80B", "160B", "320B"]) 35 | plt.grid(True, which="major", linestyle="-") 36 | ax.xaxis.grid(True, which="minor", linestyle="-", color="g") 37 | 38 | BLOCKS_PER_YEAR = 20 * 60 * 24 * 365 39 | 40 | with open(sys.argv[1], "r") as f: 41 | n = 0 42 | for line in f: 43 | n += 1 44 | d = json.loads(line) 45 | b = int(d["b"]) 46 | s = int(d["s"]) 47 | 48 | if (b % 10000) != 0: 49 | continue 50 | 51 | px = b / BLOCKS_PER_YEAR 52 | py = s / 1000 53 | 54 | x.append(px) 55 | y.append(py) 56 | for i in range(len(names)): 57 | if i == 1: 58 | continue 59 | if names[i] in inflections: 60 | continue 61 | if (int(d["rvec"][i * 2]) % 1000) == 0: 62 | continue 63 | inflections[names[i]] = d["b"] 64 | markers.append([[[px], [py], next(colors) + next(shapes)], 65 | {"label": names[i]}]) 66 | 67 | plt.plot(x, y) 68 | for m in markers: 69 | print(m) 70 | plt.plot(*m[0], **m[1]) 71 | plt.legend(loc=4) 72 | plt.title("10-year STEEM supply projection") 73 | plt.savefig("myfig.png") 74 | -------------------------------------------------------------------------------- /programs/util/pretty_schema.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import itertools 4 | import json 5 | import requests 6 | 7 | id_count = itertools.count(1) 8 | 9 | result = requests.post("http://127.0.0.1:18390", data=json.dumps( 10 | {"jsonrpc": "2.0", "method": "call", 11 | "params": ["debug_node_api", "debug_get_json_schema", []], 12 | "id": next(id_count)})) 13 | str_schema = result.json()["result"] 14 | schema = json.loads(str_schema) 15 | 16 | 17 | def maybe_json(s): 18 | try: 19 | return json.loads(s) 20 | except ValueError: 21 | return s 22 | 23 | 24 | new_types = {k: maybe_json(v) for k, v in schema["types"].items()} 25 | schema["types"] = new_types 26 | 27 | print(json.dumps(schema, indent=3, sort_keys=True)) 28 | -------------------------------------------------------------------------------- /programs/util/saltpass.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import base64 4 | import getpass 5 | import hashlib 6 | import json 7 | import os 8 | 9 | pw = getpass.getpass("enter your password: ") 10 | pw_bytes = pw.encode("utf-8") 11 | salt_bytes = os.urandom(8) 12 | salt_b64 = base64.b64encode(salt_bytes) 13 | pw_hash = hashlib.sha256(pw_bytes + salt_bytes).digest() 14 | pw_hash_b64 = base64.b64encode(pw_hash) 15 | 16 | print(json.dumps( 17 | { 18 | "password_hash_b64": pw_hash_b64.decode("ascii"), 19 | "password_salt_b64": salt_b64.decode("ascii"), 20 | }, 21 | sort_keys=True, 22 | indent=3, separators=(',', ' : ') 23 | )) 24 | -------------------------------------------------------------------------------- /programs/util/schema_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | using namespace graphene::db; 14 | 15 | struct mystruct { 16 | std::string alpha; 17 | uint64_t beta; 18 | }; 19 | 20 | FC_REFLECT(mystruct, 21 | (alpha) 22 | (beta) 23 | ); 24 | 25 | void process(std::shared_ptr s) { 26 | std::string name; 27 | s->get_name(name); 28 | std::cout << " name = " << name; 29 | std::vector> deps; 30 | s->get_deps(deps); 31 | std::vector dep_names; 32 | for (const std::shared_ptr &s : deps) { 33 | std::string s_name; 34 | s->get_name(s_name); 35 | dep_names.push_back(s_name); 36 | } 37 | std::cout << " deps = " << fc::json::to_string(dep_names); 38 | std::string str_schema; 39 | s->get_str_schema(str_schema); 40 | std::cout << " s = " << str_schema; 41 | std::cout << std::endl; 42 | } 43 | 44 | int main(int argc, char **argv, char **envp) { 45 | std::vector> schemas; 46 | 47 | schemas.push_back(get_schema_for_type()); 48 | schemas.push_back(get_schema_for_type()); 49 | add_dependent_schemas(schemas); 50 | 51 | for (const std::shared_ptr &s : schemas) { 52 | process(s); 53 | } 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /programs/util/sign_digest.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | struct signing_request { 13 | fc::sha256 dig; 14 | std::string wif; 15 | }; 16 | 17 | struct signing_result { 18 | fc::sha256 dig; 19 | golos::protocol::public_key_type key; 20 | golos::protocol::signature_type sig; 21 | }; 22 | 23 | FC_REFLECT((signing_request), (dig)(wif)) 24 | FC_REFLECT((signing_result), (dig)(key)(sig)) 25 | 26 | int main(int argc, char **argv, char **envp) { 27 | // hash key pairs on stdin 28 | std::string chain_id, hash, wif; 29 | while (std::cin) { 30 | std::string line; 31 | std::getline(std::cin, line); 32 | boost::trim(line); 33 | if (line == "") { 34 | continue; 35 | } 36 | 37 | fc::variant v = fc::json::from_string(line, fc::json::strict_parser); 38 | signing_request sreq; 39 | fc::from_variant(v, sreq); 40 | signing_result sres; 41 | sres.dig = sreq.dig; 42 | fc::ecc::private_key priv_key = *golos::utilities::wif_to_key(sreq.wif); 43 | sres.sig = priv_key.sign_compact(sreq.dig); 44 | sres.key = golos::protocol::public_key_type(priv_key.get_public_key()); 45 | std::cout << fc::json::to_string(sres) << std::endl; 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /programs/util/sign_transaction.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | struct tx_signing_request { 13 | golos::protocol::transaction tx; 14 | std::string wif; 15 | }; 16 | 17 | struct tx_signing_result { 18 | golos::protocol::transaction tx; 19 | fc::sha256 digest; 20 | fc::sha256 sig_digest; 21 | golos::protocol::public_key_type key; 22 | golos::protocol::signature_type sig; 23 | }; 24 | 25 | FC_REFLECT((tx_signing_request), (tx)(wif)) 26 | FC_REFLECT((tx_signing_result), (digest)(sig_digest)(key)(sig)) 27 | 28 | int main(int argc, char **argv, char **envp) { 29 | // hash key pairs on stdin 30 | std::string chain_id, hash, wif; 31 | while (std::cin) { 32 | std::string line; 33 | std::getline(std::cin, line); 34 | boost::trim(line); 35 | if (line == "") { 36 | continue; 37 | } 38 | 39 | fc::variant v = fc::json::from_string(line, fc::json::strict_parser); 40 | tx_signing_request sreq; 41 | fc::from_variant(v, sreq); 42 | tx_signing_result sres; 43 | sres.tx = sreq.tx; 44 | sres.digest = sreq.tx.digest(); 45 | sres.sig_digest = sreq.tx.sig_digest(STEEMIT_CHAIN_ID); 46 | 47 | fc::ecc::private_key priv_key = *golos::utilities::wif_to_key(sreq.wif); 48 | sres.sig = priv_key.sign_compact(sres.sig_digest); 49 | sres.key = golos::protocol::public_key_type(priv_key.get_public_key()); 50 | std::cout << fc::json::to_string(sres) << std::endl; 51 | } 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /programs/util/test_block_log.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv, char **envp) { 4 | try { 5 | //golos::chain::database db; 6 | golos::chain::block_log log; 7 | 8 | fc::temp_directory temp_dir("."); 9 | 10 | //db.open( temp_dir ); 11 | log.open(temp_dir.path() / "log"); 12 | 13 | idump((log.head())); 14 | 15 | golos::protocol::signed_block b1; 16 | b1.witness = "alice"; 17 | b1.previous = golos::protocol::block_id_type(); 18 | 19 | log.append(b1); 20 | log.flush(); 21 | idump((b1)); 22 | idump((log.head())); 23 | idump((fc::raw::pack_size(b1))); 24 | 25 | golos::protocol::signed_block b2; 26 | b2.witness = "bob"; 27 | b2.previous = b1.id(); 28 | 29 | log.append(b2); 30 | log.flush(); 31 | idump((b2)); 32 | idump((log.head())); 33 | idump((fc::raw::pack_size(b2))); 34 | 35 | auto r1 = log.read_block(0); 36 | idump((r1)); 37 | idump((fc::raw::pack_size(r1.first))); 38 | 39 | auto r2 = log.read_block(r1.second); 40 | idump((r2)); 41 | idump((fc::raw::pack_size(r2.first))); 42 | 43 | idump((log.read_head())); 44 | idump((fc::raw::pack_size(log.read_head()))); 45 | 46 | auto r3 = log.read_block(r2.second); 47 | idump((r3)); 48 | } 49 | catch (const std::exception &e) { 50 | edump((std::string(e.what()))); 51 | } 52 | 53 | return 0; 54 | } -------------------------------------------------------------------------------- /python_scripts/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( name='steemdebugnode', 4 | version='0.1', 5 | description='A wrapper for launching and interacting with a Golos Debug Node', 6 | url='http://github.com/steemit/steem', 7 | author='Golos, Inc.', 8 | author_email='vandeberg@steemit.com', 9 | license='See LICENSE.md', 10 | packages=['steemdebugnode'], 11 | #install_requires=['steemapi'], 12 | zip_safe=False ) -------------------------------------------------------------------------------- /python_scripts/steemdebugnode/__init__.py: -------------------------------------------------------------------------------- 1 | from steemdebugnode.debugnode import DebugNode 2 | 3 | __all__ = [ 'debugnode' ] -------------------------------------------------------------------------------- /share/golosd/docker/Dockerfile-test: -------------------------------------------------------------------------------- 1 | FROM phusion/baseimage:0.9.19 2 | 3 | ENV LANG=en_US.UTF-8 4 | 5 | RUN \ 6 | apt-get update && \ 7 | apt-get install -y \ 8 | autoconf \ 9 | automake \ 10 | autotools-dev \ 11 | bsdmainutils \ 12 | build-essential \ 13 | cmake \ 14 | doxygen \ 15 | git \ 16 | ccache\ 17 | libboost-all-dev \ 18 | libreadline-dev \ 19 | libssl-dev \ 20 | libtool \ 21 | ncurses-dev \ 22 | pbzip2 \ 23 | pkg-config \ 24 | python3 \ 25 | python3-dev \ 26 | python3-pip \ 27 | && \ 28 | apt-get clean && \ 29 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ 30 | pip3 install gcovr 31 | 32 | ADD . /usr/local/src/golos 33 | 34 | RUN \ 35 | cd /usr/local/src/golos && \ 36 | git submodule deinit -f . && \ 37 | git submodule update --init --recursive -f && \ 38 | mkdir build && \ 39 | cd build && \ 40 | cmake \ 41 | -DCMAKE_BUILD_TYPE=Debug \ 42 | -DBUILD_GOLOS_TESTNET=TRUE \ 43 | -DMAX_19_VOTED_WITNESSES=TRUE \ 44 | -DENABLE_MONGO_PLUGIN=FALSE \ 45 | .. && \ 46 | make -j$(nproc) chain_test plugin_test && \ 47 | ./tests/chain_test --log_level=message --report_level=detailed && \ 48 | ./tests/plugin_test --log_level=message --report_level=detailed 49 | 50 | # isn't used now, but can be used later ... 51 | # 52 | # RUN \ 53 | # cd /usr/local/src/golos && \ 54 | # rm -rf build && \ 55 | # git submodule update --init --recursive -f && \ 56 | # mkdir build && \ 57 | # cd build && \ 58 | # cmake \ 59 | # -DCMAKE_BUILD_TYPE=Debug \ 60 | # -DENABLE_COVERAGE_TESTING=TRUE \ 61 | # -DBUILD_GOLOS_TESTNET=TRUE \ 62 | # -DMAX_19_VOTED_WITNESSES=TRUE \ 63 | # -DENABLE_MONGO_PLUGIN=FALSE \ 64 | # .. && \ 65 | # make -j$(nproc) chain_test plugin_test && \ 66 | # ./tests/chain_test && \ 67 | # ./tests/plugin_test && \ 68 | # mkdir -p /var/cobertura && \ 69 | # gcovr --object-directory="../" --root=../ --xml-pretty --gcov-exclude=".*tests.*" --gcov-exclude=".*fc.*" --output="/var/cobertura/coverage.xml" 70 | -------------------------------------------------------------------------------- /share/golosd/golosdctl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GOLOSD=golosd 4 | HOME="/var/lib/golosd" 5 | REPLAY_FLAG="$HOME/replay" 6 | FORCE_REPLAY_FLAG="$HOME/force-reply" 7 | 8 | USAGE="Usage: `basename $0` start | stop | restart | status | replay | force-replay" 9 | 10 | if [ $# -ne 1 ]; then 11 | echo "${USAGE}" >&2 12 | exit 1 13 | fi 14 | 15 | ACTION="${1}" 16 | 17 | case "${ACTION}" in 18 | start|stop|restart|status) 19 | exec sv "${ACTION}" "${GOLOSD}" 20 | ;; 21 | replay) 22 | touch "${REPLAY_FLAG}" 23 | exec sv restart "${GOLOSD}" 24 | ;; 25 | force-replay) 26 | touch "${FORCE_REPLAY_FLAG}" 27 | exec sv restart "${GOLOSD}" 28 | ;; 29 | *) 30 | echo "${USAGE}" >&2 31 | exit 1 32 | ;; 33 | esac 34 | -------------------------------------------------------------------------------- /share/golosd/seednodes: -------------------------------------------------------------------------------- 1 | 212.220.56.171:4243 2 | 95.216.148.238:2001 3 | 95.216.148.254:2001 4 | 88.99.241.179:4243 5 | 95.216.149.46:2001 6 | 185.183.156.107:4243 7 | 195.201.228.219:2001 8 | 5.189.145.86:2001 9 | 138.201.173.106:2001 10 | 159.69.33.137:2001 11 | 173.249.59.96:4243 12 | 217.182.175.117:2001 13 | 94.130.15.169:4243 14 | 95.216.151.95:4243 15 | 87.98.241.156:4243 16 | 188.40.137.181:4243 17 | 94.16.122.18:4243 18 | 185.148.146.42:4243 19 | 159.69.33.138:2001 20 | 51.15.211.153:4243 21 | 159.69.33.136:2001 22 | 52.169.13.55:4243 23 | 144.76.168.55:2001 24 | 94.130.137.98:4243 25 | 185.148.147.140:4243 26 | 198.211.118.37:2001 27 | 95.216.148.228:2001 28 | 159.65.24.238:4243 29 | 51.15.42.83:4243 30 | 78.46.253.144:2001 31 | 138.201.189.140:2001 32 | 33 | -------------------------------------------------------------------------------- /share/golosd/seednodes_empty: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB COMMON_SOURCES 2 | common/database_fixture.cpp 3 | common/database_fixture.hpp 4 | common/comment_reward.hpp) 5 | 6 | find_package(Gperftools QUIET) 7 | if(GPERFTOOLS_FOUND) 8 | message(STATUS "Found gperftools; compiling tests with TCMalloc") 9 | list(APPEND PLATFORM_SPECIFIC_LIBS tcmalloc) 10 | endif() 11 | 12 | if(NOT Boost_USE_STATIC_LIBS) 13 | add_definitions(-DBOOST_TEST_DYN_LINK) 14 | endif() 15 | 16 | file(GLOB UNIT_TESTS "tests/*.cpp") 17 | add_executable(chain_test ${UNIT_TESTS} ${COMMON_SOURCES}) 18 | target_include_directories(chain_test PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/common") 19 | target_link_libraries( 20 | chain_test 21 | chainbase 22 | golos_chain 23 | golos_protocol 24 | golos_account_history 25 | golos_market_history 26 | golos_debug_node 27 | golos::api 28 | golos_social_network 29 | fc ${PLATFORM_SPECIFIC_LIBS}) 30 | 31 | add_test(NAME chain_test_run COMMAND chain_test) 32 | 33 | file(GLOB PLUGIN_TESTS 34 | "plugin_tests/main.cpp" 35 | "plugin_tests/market_history.cpp" 36 | "plugin_tests/plugin_ops.cpp" 37 | "plugin_tests/json_rpc.cpp" 38 | "plugin_tests/chain.cpp" 39 | "plugin_tests/operation_history.cpp" 40 | "plugin_tests/account_history.cpp" 41 | "plugin_tests/account_notes.cpp" 42 | "plugin_tests/follow.cpp" 43 | "plugin_tests/private_message.cpp") 44 | add_executable(plugin_test ${PLUGIN_TESTS} ${COMMON_SOURCES}) 45 | target_link_libraries(plugin_test 46 | golos_chain golos_protocol 47 | golos_account_history 48 | golos_account_notes 49 | golos_market_history 50 | golos_debug_node 51 | golos_social_network 52 | golos_private_message 53 | fc 54 | ${PLATFORM_SPECIFIC_LIBS}) 55 | target_include_directories(plugin_test PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/common") 56 | add_test(NAME plugin_test_run COMMAND plugin_test) 57 | 58 | if(MSVC) 59 | set_source_files_properties(tests/serialization_tests.cpp PROPERTIES COMPILE_FLAGS "/bigobj") 60 | endif(MSVC) 61 | 62 | # add_subdirectory( generate_empty_blocks ) 63 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Automated Testing Documentation 2 | 3 | ## To Run The Tests 4 | 5 | In the root of the repository. 6 | 7 | docker build --rm=false \ 8 | -t golosd/golosd-test \ 9 | -f share/golosd/docker/Dockerfile-test . 10 | 11 | ## To Troubleshoot Failing Tests 12 | 13 | docker run -ti \ 14 | golosd/golosd-test \ 15 | /bin/bash 16 | -------------------------------------------------------------------------------- /tests/generate_empty_blocks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(generate_empty_blocks main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(generate_empty_blocks 7 | PRIVATE vaporware_app vaporware_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | 9 | install(TARGETS 10 | generate_empty_blocks 11 | 12 | RUNTIME DESTINATION bin 13 | LIBRARY DESTINATION lib 14 | ARCHIVE DESTINATION lib 15 | ) 16 | -------------------------------------------------------------------------------- /tests/plugin_tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #include 25 | #include 26 | #include 27 | 28 | #ifdef BOOST_TEST_DYN_LINK 29 | #define BOOST_TEST_MODULE plugin_tests 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | extern uint32_t STEEMIT_TESTING_GENESIS_TIMESTAMP; 36 | 37 | boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) { 38 | fc::configure_logging(fc::logging_config::default_config(fc::log_level::error)); 39 | std::srand(time(NULL)); 40 | std::cout << "Random number generator seeded to " << time(NULL) 41 | << std::endl; 42 | const char *genesis_timestamp_str = getenv("STEEMIT_TESTING_GENESIS_TIMESTAMP"); 43 | if (genesis_timestamp_str != nullptr) { 44 | STEEMIT_TESTING_GENESIS_TIMESTAMP = std::stoul(genesis_timestamp_str); 45 | } 46 | std::cout << "STEEMIT_TESTING_GENESIS_TIMESTAMP is " 47 | << STEEMIT_TESTING_GENESIS_TIMESTAMP << std::endl; 48 | return nullptr; 49 | } 50 | -------------------------------------------------------------------------------- /tests/tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #include 25 | #include 26 | #include 27 | 28 | #ifdef BOOST_TEST_DYN_LINK 29 | #define BOOST_TEST_MODULE unit_tests 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | 36 | boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) { 37 | fc::configure_logging(fc::logging_config::default_config(fc::log_level::error)); 38 | 39 | std::srand(time(NULL)); 40 | std::cout << "Random number generator seeded to " << time(NULL) 41 | << std::endl; 42 | return nullptr; 43 | } -------------------------------------------------------------------------------- /thirdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(appbase) 2 | add_subdirectory(fc) 3 | add_subdirectory(chainbase) --------------------------------------------------------------------------------