diff --git a/.gitmodules b/.gitmodules index 4db5589f4942b5ad58f188311bf2283f570ad9fd..976f9dabbf184f75600728c281bd2f58b1c41082 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,9 +12,9 @@ branch = master [submodule "cellframe-sdk"] path = cellframe-sdk - url = ../cellframe-sdk + url = ../cellframe-sdk.git branch = master [submodule "cellframe-sdk-python"] path = cellframe-sdk-python - url = https://gitlab.demlabs.net/cellframe/cellframe-sdk-python + url = ../cellframe-sdk-python branch = master diff --git a/CMakeLists.txt b/CMakeLists.txt index c0806723827b22f75d504625bf843e80362d0815..0bc484d23d2601347b4c56b7b1347faf55159259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,11 @@ set(CMAKE_C_STANDARD 11) # Predefine project SET( CPACK_PACKAGE_NAME "${PROJECT_NAME}") SET( CPACK_PACKAGE_VERSION_MAJOR 2) -SET( CPACK_PACKAGE_VERSION_MINOR 14) -SET( CPACK_PACKAGE_VERSION_PATCH 9) +SET( CPACK_PACKAGE_VERSION_MINOR 15) +SET( CPACK_PACKAGE_VERSION_PATCH 0) # init CellFrame SDK add_definitions("-DDAP_VERSION=\"${CPACK_PACKAGE_VERSION_MAJOR}\"") -add_definitions ("-DDAP_SERVER -DDAP_LOG_MT") set(SUBMODULES_NO_BUILD ON) set(SUPPORT_PYTHON_PLUGINS ON) include (cellframe-sdk/cmake/OS_Detection.cmake) @@ -91,7 +90,7 @@ if(WIN32) add_executable(${PROJECT_NAME} "sources/main.c" "sources/exh_win32.c" "sources/sig_win32_handler.c") add_executable(${NODE_CLI_TARGET} "sources/main_node_cli.c" ) add_executable(${NODE_TOOL_TARGET} "sources/main_node_tool.c" ) - target_link_libraries(${NODE_CLI_TARGET} dap_chain_net dap_app_cli nghttp2 ssl cares ssh2 crypto z pthread # curl + target_link_libraries(${NODE_CLI_TARGET} dap_chain_net dap_app_cli nghttp2 ssl cares crypto z pthread # curl ${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/curl[x86_64CLANG].a KERNEL32 USER32 @@ -119,9 +118,8 @@ if(WIN32) dap_chain_cs_dag dap_chain_cs_dag_poa dap_chain_cs_dag_pos dap_chain_net dap_chain_net_srv dap_chain_net_srv_app dap_chain_net_srv_app_db dap_chain_net_srv_datum dap_chain_net_srv_datum_pool - dap_chain_wallet dap_chain_global_db dap_chain_mempool dap_cuttdb nghttp2 ssl cares ssh2 crypto z pthread # curl + dap_chain_wallet dap_chain_global_db dap_chain_mempool dap_cuttdb nghttp2 cares z pthread # curl - ${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/curl[x86_64CLANG].a KERNEL32 USER32 SHELL32 @@ -142,15 +140,7 @@ if(WIN32) userenv ) set_property(TARGET ${NODE_TOOL_TARGET} APPEND_STRING PROPERTY LINK_FLAGS "-mconsole") - target_link_libraries(${PROJECT_NAME} cellframe-sdk json-c sqlite3 nghttp2 ssl cares z ssh2 crypto m - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/nghttp2[x86_64CLANG].a - ${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/curl[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/libssl[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/c-ares[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/misc[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/zlib[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/libssh2[x86_64CLANG].a - #${CMAKE_CURRENT_SOURCE_DIR}/lib/[x86_64CLANG]/libcrypto[x86_64CLANG].a + target_link_libraries(${PROJECT_NAME} cellframe-sdk json-c sqlite3 cares z m KERNEL32 USER32 SHELL32 @@ -215,6 +205,7 @@ if(UNIX AND NOT WIN32) add_subdirectory(cellframe-sdk-python/libdap-chain-python) add_subdirectory(cellframe-sdk-python/libdap-app-cli-python) add_subdirectory(cellframe-sdk-python/libdap-client-python) + add_subdirectory(cellframe-sdk-python/libdap-chain-wallet-python) add_subdirectory(python-cellframe) add_subdirectory(libdap-plugins-python) set(NODE_LIBRARIES ${NODE_LIBRARIES} ${PYTHON_LIBRARIES} dap_plugins_python) diff --git a/README.md b/README.md index b70424f08428d5737a438b56083e5cf2c7707db5..0a95e0a9707aeb67627218a9e94e43c2f022e394 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # cellframe-node Cellframe Node -[Cellframe Node usage Wiki](https://wiki.cellframe.net/index.php/Node_usage) - article is being prepared. +[Cellframe Node usage Wiki](https://wiki.cellframe.net/index.php/Node_usage) ## This guide will work on Debian/Ubuntu @@ -10,7 +10,8 @@ Cellframe Node #### Prerequsites: -To successfully complete of the build, you must have following prerequisites preinstalled (packages are named as in Debian GNU/Linux 10 "buster", please found the corresponding packages for your distribution): +To successfully complete of the build, you need to have the following packages to be installed +(packages are named as in Debian GNU/Linux 10 "buster", please found the corresponding packages for your distribution): * libjson-c-dev * libsqlite3-dev @@ -52,22 +53,23 @@ Get into directory with cellframe-node and execute the following commands *-j$(nproc)* nrpoc parameter depends on your machine capacity - number of processor cores. As a result, you should be able to fine make files in your build folder which will be used by cpack command to create an installation package. - - ### Build cellframe-node package - -#### Prepare for installation - Use the following command ```cpack``` from the build directory to create cellframe-node installation package. ##### Install from local package -If everyting went well you should be able to find the following file in your build folder ```cellframe-node_2.11-4-buster_amd64.deb``` +If everyting went well you should be able to find the following file in your build folder ```cellframe-node-2.14-9-Debian-10-amd64-buster.deb``` Please use ```dpkg``` command to install it: ``` sudo dpkg -i ./cellframe-node_2.11-4-buster_amd64.deb ``` -##### Install from DemLabs official public repository - why do we need this section??? what does it stand for? Should that be moved to a separate md document? + +In some cases there is a following command required to be executed +``` +sudo apt --fix-broken install +``` + +##### Install from DemLabs official public repository * Create file /etc/apt/sources.list.d/demlabs.list with command ```sudo nano /etc/apt/sources.list.d/demlabs.list``` one line below for Debian 10: ``` @@ -79,7 +81,7 @@ sudo dpkg -i ./cellframe-node_2.11-4-buster_amd64.deb ``` * Then download public signature and install it: ``` - wget https://debian.pub.demlabs.net/debian.pub.demlabs.net.gpg - this link is not working - 404 error + wget https://debian.pub.demlabs.net/debian.pub.demlabs.net.gpg sudo apt-key add demlabskey.asc ``` * Then update your apt cache and install the package: @@ -88,10 +90,10 @@ sudo dpkg -i ./cellframe-node_2.11-4-buster_amd64.deb sudo apt-get install cellframe-node ``` -During installation it asks some questions - some questions?? really? +During installation it asks some questions #### Debian package questions -All this could be changed after in configs - could be? or must be? how critical is that? will cellfame-node work without it? if yes, I would suggest to remove this +All this could be changed after in configs * Auto online @@ -269,3 +271,9 @@ More details about order operations you could find with call ```sudo /opt/cellfr More details about cellframe node commands in call ```sudo /opt/cellframe-node/bin/cellframe-node-cli help``` +#### Remove cellframe-node + +In order to remove cellframe-node, use the following command +``` +sudo apt-get remove cellframe-node +``` diff --git a/cellframe-sdk b/cellframe-sdk index 36b2f507b2cb1b2dd9e1800d415edf3a228d0de3..ccfd290079cf297e6dec462958cd417b4271bfb4 160000 --- a/cellframe-sdk +++ b/cellframe-sdk @@ -1 +1 @@ -Subproject commit 36b2f507b2cb1b2dd9e1800d415edf3a228d0de3 +Subproject commit ccfd290079cf297e6dec462958cd417b4271bfb4 diff --git a/cellframe-sdk-python b/cellframe-sdk-python new file mode 160000 index 0000000000000000000000000000000000000000..2f2ae8b1f8185c161cf93c980b8c79b0e324375c --- /dev/null +++ b/cellframe-sdk-python @@ -0,0 +1 @@ +Subproject commit 2f2ae8b1f8185c161cf93c980b8c79b0e324375c diff --git a/dist/etc/network/core-t/chain-0.cfg b/dist/etc/network/core-t/chain-0.cfg new file mode 100644 index 0000000000000000000000000000000000000000..08e128fcd1ec453a96f4d59a479691711dd6b8bb --- /dev/null +++ b/dist/etc/network/core-t/chain-0.cfg @@ -0,0 +1,29 @@ +[chain] +id=0x0000000000000000 +shard_id=0x0000000000000000 +name=zerochain +load_priority=1 +# Possible values [token, emission, transaction] +datum_types=[token,emission,shard,ca] +consensus=dag_poa + +[files] +storage_dir=/opt/cellframe-node/var/lib/network/core-t/zerochain/ + +[dag] +is_single_line=true +is_celled=false +is_add_directly=true +datum_add_hashes_count=1 + +# Switched off to false because hash symbols below are not well recognized + +is_static_genesis_event=false +static_genesis_event=0xEB2152E716245D067BEA80E8CB6D7C35859B2E0E91AF4201486BB443F6AEE7FF + +[dag-poa] +auth_certs_prefix=core-t.root +auth_certs_number=5 +auth_certs_number_verify=1 #4 +auth_certs_dir=/opt/cellframe-node/share/ca + diff --git a/dist/etc/network/core-t/chain-plasma.cfg b/dist/etc/network/core-t/chain-plasma.cfg new file mode 100644 index 0000000000000000000000000000000000000000..e7a33d95266d5182fdf57fecf8cb82e2da134490 --- /dev/null +++ b/dist/etc/network/core-t/chain-plasma.cfg @@ -0,0 +1,27 @@ +[chain] +id=0x0000000000000001 +name=plasma +load_priority=2 +# Possible values [token, emission, transaction] +datum_types=[transaction,ca] +consensus=dag_pos + +[dag] +is_single_line=false +is_celled=true +is_add_directly=true +datum_add_hashes_count=3 + +# Proof-of-State consensus config +[dag-pos] +# Tokens hold and hold_value must be equel size +# KELT - test token, KEL - main tokem +tokens_hold=[CFNT] +# 1000 coins for both +tokens_hold_value=[1000000000000] +# Confirmations minimum +confirmations_minimum=3 + +[files] +storage_dir=/opt/cellframe-node/var/lib/network/core-t/plasma + diff --git a/dist/share/configs/network/core-t.cfg.tpl b/dist/share/configs/network/core-t.cfg.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f3575d955b2e083a4e00921605f11230d0e10333 --- /dev/null +++ b/dist/share/configs/network/core-t.cfg.tpl @@ -0,0 +1,19 @@ +# Core testnet +# General section +[general] +id=0xffffffffffffffff +name=core-t +# Possible values: light, full, archive, master, root +node-role={NODE_TYPE} +node_addr_type=auto +bootstrap_hostnames=[ random.bootstrap.core-t.cellframe.net:80, reserved.bootstrap.core-t.cellframe.net:80 ] + +#[role-master] +#proc_chains=[0x00000001] + +#[dag-poa] +#events-sign-cert=mycert + +#[dag-pos] +#events-sign-wallet=mywallet + diff --git a/dist/share/configs/network/kelvin-testnet.cfg.tpl b/dist/share/configs/network/kelvin-testnet.cfg.tpl index 8803019c3a4d76b148f246728db28fd4c1f73f8e..aa25832b6681408fccb0286f2df866827d29bb69 100644 --- a/dist/share/configs/network/kelvin-testnet.cfg.tpl +++ b/dist/share/configs/network/kelvin-testnet.cfg.tpl @@ -1,18 +1,10 @@ -# Kelvin Blockchain: development network +# Kelvin Testnet # General section [general] id=0x0000000000000001 name=kelvin-testnet # Possible values: light, full, archive, master, root node-role={NODE_TYPE} -#node-alias=addr-%node_addr% -#node-addr=1234::1234::1234::1234 -gdb_groups_prefix=kelvin-testnet -# node addr exired time in hours (168h=1w 720h=1m 8760h=1y), by default 720h(1week) -#node-addr=0x10 -#node-addr-expired=168 -# type of node addr [auto, static, dinamic] -node_addr_type=auto seed_nodes_hostnames=[0.root.testnet.klvn.io,1.root.testnet.klvn.io,2.root.testnet.klvn.io,3.root.testnet.klvn.io,4.root.testnet.klvn.io] seed_nodes_aliases=[kelvin.testnet.root.0,kelvin.testnet.root.1,kelvin.testnet.root.2,kelvin.testnet.root.3,kelvin.testnet.root.4] diff --git a/prod_build/linux/debian/essentials/config b/prod_build/linux/debian/essentials/config index c941cee25f7c6c2f015e533bf2b315023dd34f40..4032c7340fd64da810039f0ffb4985c899f4c5ca 100755 --- a/prod_build/linux/debian/essentials/config +++ b/prod_build/linux/debian/essentials/config @@ -19,6 +19,12 @@ reconfigure|configure) db_input critical cellframe-node/server_port || true db_go || true + db_input critical cellframe-node/core_t_enabled || true + db_go || true + + db_input critical cellframe-node/core_t_node_type || true + db_go || true + db_input critical cellframe-node/kelvin_testnet_enabled || true db_go || true diff --git a/prod_build/linux/debian/essentials/postinst b/prod_build/linux/debian/essentials/postinst index c92199fbc5d250caa778f01850abdbeddb74d722..406cdcb660bf372e51b31b4e3e8fe8a6ba28dfd6 100755 --- a/prod_build/linux/debian/essentials/postinst +++ b/prod_build/linux/debian/essentials/postinst @@ -41,11 +41,33 @@ db_get cellframe-node/server_addr || true sed -i "s/{SERVER_ADDR}/$RET/" $DAP_CFG || true +# Init core testnet +NET_NAME="core-t" + +db_get cellframe-node/core_t_enabled || true +if [ "$RET"="true" ]; then + DAP_CFG_NET="$DAP_PREFIX/etc/network/$NET_NAME.cfg" + DAP_CFG_NET_TPL="$DAP_PREFIX/share/configs/network/$NET_NAME.cfg.tpl" + DAP_NET_CFG="" + if [ -e "$DAP_CFG_NET" ]; then + DAP_NET_CFG="$DAP_PREFIX/etc/network/$NET_NAME.cfg.dpkg-new" + else + DAP_NET_CFG="$DAP_PREFIX/etc/network/$NET_NAME.cfg" + fi + + cat $DAP_CFG_NET_TPL > $DAP_NET_CFG || true + db_get cellframe-node/core_t_node_type || true + NODE_TYPE=$RET + sed -i "s/{NODE_TYPE}/$NODE_TYPE/" $DAP_NET_CFG || true + echo "[*] Enabled core testnet" +fi + + # Init kelvin-testnet NET_NAME="kelvin-testnet" -db_get cellframe-node/kelvin_testnet_enable || true +db_get cellframe-node/kelvin_testnet_enabled || true if [ "$RET"="true" ]; then DAP_CFG_NET="$DAP_PREFIX/etc/network/$NET_NAME.cfg" DAP_CFG_NET_TPL="$DAP_PREFIX/share/configs/network/$NET_NAME.cfg.tpl" @@ -60,6 +82,7 @@ if [ "$RET"="true" ]; then db_get cellframe-node/kelvin_testnet_node_type || true NODE_TYPE=$RET sed -i "s/{NODE_TYPE}/$NODE_TYPE/" $DAP_NET_CFG || true + echo "[*] Enabled kelvin testnet" fi mkdir -p $DAP_PREFIX/var/log || true @@ -72,8 +95,10 @@ echo "[*] Check /etc/systemd/system/$DAP_APP_NAME.service file..." if [ -L /etc/systemd/system/$DAP_APP_NAME.service ]; then echo "[*] Restarting $DAP_APP_NAME to implement changes" systemctl --system stop $DAP_APP_NAME >> /dev/null|| true + echo "[*] Stopped $DAP_APP_NAME" systemctl daemon-reload || true systemctl --system start $DAP_APP_NAME || true + echo "[*] Started $DAP_APP_NAME" else echo "[!] Installing $DAP_APP_NAME as systemd service (haven't found /etc/systemd/system/$DAP_APP_NAME.service)" ln -sf $DAP_PREFIX/share/$DAP_APP_NAME.service /etc/systemd/system/$DAP_APP_NAME.service || true diff --git a/prod_build/linux/debian/essentials/templates b/prod_build/linux/debian/essentials/templates index d02bd1144cd63498e6ce1c7f7d312455e36628b4..2aaf3d010feb2eaa6f83d5c6911245e2295c177f 100755 --- a/prod_build/linux/debian/essentials/templates +++ b/prod_build/linux/debian/essentials/templates @@ -32,6 +32,26 @@ Description: Server address Server address to listen on +Template: cellframe-node/core_t_enabled +Default: false +Choices: true, false +Type: select +Description: Core-T (Testnet): Enable network + Core Testnet: Enable network auto load on start + +Template: cellframe-node/core_t_node_type +Type: select +Default: full +Choices: full, light, master, archive, root +Description: Core Testnet: Node role + Select node role:. + Light - syncronize only local wallets + full - sync all its cell + master - allow to store values in chains and take comission, sync all shards that will need to be synced + archive - Sync all the network + root - Special predefined root nodes, usualy produces zerochain and act like archive as well + + Template: cellframe-node/kelvin_testnet_enabled Default: true Choices: true, false diff --git a/sources/main.c b/sources/main.c index a76cce6ae7843b5f65f0b4658854b12acc661c04..84a2f1ca90006dd0d29251239e60867ff7ac33c3 100755 --- a/sources/main.c +++ b/sources/main.c @@ -90,6 +90,7 @@ #include "dap_chain_global_db.h" #include "dap_chain_mempool.h" +#include "dap_chain_node.h" #include "dap_chain_node_cli.h" #include "dap_stream_session.h" @@ -368,6 +369,11 @@ int main( int argc, const char **argv ) } #endif + if (dap_chain_node_mempool_init()) { + log_it( L_CRITICAL, "Can't init automatic mempool processing" ); + return -13; + } + save_process_pid_in_file(s_pid_file_path); bServerEnabled = dap_config_get_item_bool_default( g_config, "server", "enabled", false ); @@ -479,6 +485,7 @@ failure: dap_http_deinit(); dap_server_deinit(); dap_enc_ks_deinit(); + dap_chain_node_mempool_deinit(); dap_config_close( g_config ); dap_common_deinit();