Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge bls #2569

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
path = submodules/taraxa-vrf
url = ../taraxa-vrf.git
ignore = dirty
[submodule "submodules/libBLS"]
path = submodules/libBLS
url = https://github.com/skalenetwork/libBLS.git
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,14 @@ add_custom_target(check-static DEPENDS cpp-check clang-format clang-format-check
# execute command to get git info
include(CMakeModules/git_info.cmake)

# find and include system libraries used in submodues and libraries
include(ExternalProject)

# find and include system libraries used in submodules and libraries
find_package(GMP)
find_package(MPFR)
# used in libraries/aleth & submodules/libBLS
include(ProjectLibFF)

include(ExternalProject)
# use JSONCPP library from conan for JSONRPCCPP build
set(JSONCPP_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_JSONCPP})
include(ProjectJSONRPCCPP)
Expand Down
1 change: 0 additions & 1 deletion libraries/aleth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
### Aleth part
include(ProjectSecp256k1)
include(ProjectLibFF)

add_subdirectory(libdevcore)
add_subdirectory(libdevcrypto)
Expand Down
2 changes: 1 addition & 1 deletion libraries/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(SOURCES

add_library(cli ${SOURCES} ${HEADERS})
target_include_directories(cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(cli PUBLIC config)
target_link_libraries(cli PUBLIC bls config)

install(TARGETS cli
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
1 change: 1 addition & 0 deletions libraries/cli/include/cli/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Config {
static constexpr const char* LOG_CHANNELS_APPEND = "log-channels-append";
static constexpr const char* NODE_SECRET = "node-secret";
static constexpr const char* VRF_SECRET = "vrf-secret";
static constexpr const char* BLS_SECRET = "bls-secret";
static constexpr const char* OVERWRITE_CONFIG = "overwrite-config";
static constexpr const char* ENABLE_TEST_RPC = "enable-test-rpc";
static constexpr const char* ENABLE_DEBUG = "debug";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x84595161401484a000000"
},
"vrf_key": "05fe580fd2d461ee5f762a33bbe669403bb04a851f2e9ed8d2579a9c9b77c3ec"
"vrf_key": "05fe580fd2d461ee5f762a33bbe669403bb04a851f2e9ed8d2579a9c9b77c3ec",
"bls_key": ""
},
{
"address": "0x56e0de6933d9d0453d0363caf42b136eb5854e4e",
Expand All @@ -41,7 +42,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x84595161401484a000000"
},
"vrf_key": "70d34c86787e5f7bd0f266cad291cb521e23176fa37c6efc034858a1620ac69e"
"vrf_key": "70d34c86787e5f7bd0f266cad291cb521e23176fa37c6efc034858a1620ac69e",
"bls_key": ""
},
{
"address": "0x71bdcbec7e3642782447b0fbf31eed068dfbdbb1",
Expand All @@ -52,7 +54,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x84595161401484a000000"
},
"vrf_key": "f8d5c00ce9fa3058341e051b36a1e6ccf69df81fb865568b2bf1507d085691e2"
"vrf_key": "f8d5c00ce9fa3058341e051b36a1e6ccf69df81fb865568b2bf1507d085691e2",
"bls_key": ""
}
]
},
Expand Down Expand Up @@ -105,6 +108,7 @@
"magnolia_hf" : {
"block_num" : 0,
"jail_time": 163459
}
},
"ficus_hf_block_num": 0
}
}
59 changes: 39 additions & 20 deletions libraries/cli/include/cli/config_jsons/devnet/devnet_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "05fe580fd2d461ee5f762a33bbe669403bb04a851f2e9ed8d2579a9c9b77c3ec"
"vrf_key": "05fe580fd2d461ee5f762a33bbe669403bb04a851f2e9ed8d2579a9c9b77c3ec",
"bls_key": ""
},
{
"address": "0x56e0de6933d9d0453d0363caf42b136eb5854e4e",
Expand All @@ -41,7 +42,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "70d34c86787e5f7bd0f266cad291cb521e23176fa37c6efc034858a1620ac69e"
"vrf_key": "70d34c86787e5f7bd0f266cad291cb521e23176fa37c6efc034858a1620ac69e",
"bls_key": ""
},
{
"address": "0x71bdcbec7e3642782447b0fbf31eed068dfbdbb1",
Expand All @@ -52,7 +54,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "f8d5c00ce9fa3058341e051b36a1e6ccf69df81fb865568b2bf1507d085691e2"
"vrf_key": "f8d5c00ce9fa3058341e051b36a1e6ccf69df81fb865568b2bf1507d085691e2",
"bls_key": ""
},
{
"address": "0xac24bc60a491bd0c29414e5f34aa6bbd8d4aa499",
Expand All @@ -63,7 +66,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "aa12507d00c992b95e65d80b21fd2db5b48c4f7ff4393064828d1adc930710b4"
"vrf_key": "aa12507d00c992b95e65d80b21fd2db5b48c4f7ff4393064828d1adc930710b4",
"bls_key": ""
},
{
"address": "0x635d3831ad5d1252a2a07f09b8d3539b3af34df8",
Expand All @@ -74,7 +78,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "bd34898ae0080187c408b5724f05682855c4425fda61d332f5f9d746d4eb753a"
"vrf_key": "bd34898ae0080187c408b5724f05682855c4425fda61d332f5f9d746d4eb753a",
"bls_key": ""
},
{
"address": "0x43af71034ed7fd0b54496a30ba4a5889a94e7088",
Expand All @@ -85,7 +90,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "25d35fed93989c40b4e8685d9d7ee02213230221ea9efcbe8cfccfc788670dba"
"vrf_key": "25d35fed93989c40b4e8685d9d7ee02213230221ea9efcbe8cfccfc788670dba",
"bls_key": ""
},
{
"address": "0x4546f088bf636ed4652d1635c98ef5422805dfa3",
Expand All @@ -96,7 +102,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "55c0bd1af84fb793a5dd7b960e330248d8a0acde566922b3e210f43592700dad"
"vrf_key": "55c0bd1af84fb793a5dd7b960e330248d8a0acde566922b3e210f43592700dad",
"bls_key": ""
},
{
"address": "0x8ca042649a263272442bee8b7209fa19426e54c4",
Expand All @@ -107,7 +114,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "33131367e7279ee51c0f26c6f9b6627848f822d134abef21a88be467dfbaae7b"
"vrf_key": "33131367e7279ee51c0f26c6f9b6627848f822d134abef21a88be467dfbaae7b",
"bls_key": ""
},
{
"address": "0x7d7319df8950546850a01a0d793ee602f6eb390f",
Expand All @@ -118,7 +126,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "da63de37c69a59cb3ebbcfb79ef8d561b18b448b544a14438c62cd56bc0a29f5"
"vrf_key": "da63de37c69a59cb3ebbcfb79ef8d561b18b448b544a14438c62cd56bc0a29f5",
"bls_key": ""
},
{
"address": "0x64c171b9845c15c4555f7a4489895f0e687c496c",
Expand All @@ -129,7 +138,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "337178752602a5ca38928bf0d8d434ec653505c92b280b0edab6c39d5e79f4fd"
"vrf_key": "337178752602a5ca38928bf0d8d434ec653505c92b280b0edab6c39d5e79f4fd",
"bls_key": ""
},
{
"address": "0x614c85fad6f17f03949f735e05b1a24c5155b726",
Expand All @@ -140,7 +150,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "ac08e4ca5f1bcdd61dbefa7551ab839bdd4545e59ee8a4ab5d3aabb71104ab73"
"vrf_key": "ac08e4ca5f1bcdd61dbefa7551ab839bdd4545e59ee8a4ab5d3aabb71104ab73",
"bls_key": ""
},
{
"address": "0xeff3dd2b0a6c29146c46ca01764aae0691ee1744",
Expand All @@ -151,7 +162,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "189b05cca0a816a36f977f0541ef7585218b2087f04b23444ab58d0c755adecc"
"vrf_key": "189b05cca0a816a36f977f0541ef7585218b2087f04b23444ab58d0c755adecc",
"bls_key": ""
},
{
"address": "0xe543a20db4fa1820cc9f00144fc402bb1f31aa29",
Expand All @@ -162,7 +174,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "8e95172f90b68ee753132bf6342ee00b398e2417312f610d58c34729ab0608ee"
"vrf_key": "8e95172f90b68ee753132bf6342ee00b398e2417312f610d58c34729ab0608ee",
"bls_key": ""
},
{
"address": "0x211a5ec33fec843b14319bcd62ab30c2a064745e",
Expand All @@ -173,7 +186,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "959551740ff948d9714f15a2bfb2183c4ead897dd79775a0a18488aa8936e2ba"
"vrf_key": "959551740ff948d9714f15a2bfb2183c4ead897dd79775a0a18488aa8936e2ba",
"bls_key": ""
},
{
"address": "0x5354adf587cad5fe74e4912d4b6c1f754538891d",
Expand All @@ -184,7 +198,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "56b7831cb3e35c1d6d1e3f661de2068d6feeaa54074b3e02709a87d7f0d6c72a"
"vrf_key": "56b7831cb3e35c1d6d1e3f661de2068d6feeaa54074b3e02709a87d7f0d6c72a",
"bls_key": ""
},
{
"address": "0x1473a6c154655fdc1f19d98e5823d3bb3f09a895",
Expand All @@ -195,7 +210,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "e774c519814cbc04008aa958932e7adb82ebbbd6ca69089c0a1458ea34fb4299"
"vrf_key": "e774c519814cbc04008aa958932e7adb82ebbbd6ca69089c0a1458ea34fb4299",
"bls_key": ""
},
{
"address": "0x9588f6457d67792f141424983a93978f44331054",
Expand All @@ -206,7 +222,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "1b15b7bef6a1dbe9aeb2792f2e38d6222d31f8c6c15cff1152f258013d70d933"
"vrf_key": "1b15b7bef6a1dbe9aeb2792f2e38d6222d31f8c6c15cff1152f258013d70d933",
"bls_key": ""
},
{
"address": "0xb48da366e19f141f5647dcdb0960eb88719e1c8d",
Expand All @@ -217,7 +234,8 @@
"delegations": {
"0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0xd3c21bcecceda1000000"
},
"vrf_key": "37bf145ac98e7de7db6e5b933e72737fbf190fd4fb1d193b15cf8b00db30ba30"
"vrf_key": "37bf145ac98e7de7db6e5b933e72737fbf190fd4fb1d193b15cf8b00db30ba30",
"bls_key": ""
}
]
},
Expand Down Expand Up @@ -271,6 +289,7 @@
"magnolia_hf": {
"block_num": 0,
"jail_time": 1000
}
},
"ficus_hf_block_num": -1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,7 @@
"magnolia_hf" : {
"block_num" : 5730000,
"jail_time": 163459
}
},
"ficus_hf_block_num": -1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"magnolia_hf": {
"block_num": 297000,
"jail_time": 163459
}
},
"ficus_hf_block_num": -1
}
}
}
6 changes: 4 additions & 2 deletions libraries/cli/include/cli/tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Json::Value overrideConfig(Json::Value& config, std::string& data_dir, const std
const std::vector<std::string>& log_configurations,
const std::vector<std::string>& boot_nodes_append,
const std::vector<std::string>& log_channels_append);
Json::Value overrideWallet(Json::Value& wallet, const std::string& node_key, const std::string& vrf_key);
Json::Value overrideWallet(Json::Value& wallet, const std::string& node_key, const std::string& vrf_key,
const std::string& bls_key);

std::string getHomeDir();
std::string getTaraxaDefaultDir();
Expand All @@ -49,6 +50,7 @@ std::string getTaraxaDefaultConfigFile();
std::string getTaraxaDefaultWalletFile();
std::string getTaraxaDefaultGenesisFile();
Json::Value createWalletJson(const dev::KeyPair& account, const taraxa::vrf_wrapper::vrf_sk_t& sk,
const taraxa::vrf_wrapper::vrf_pk_t& pk);
const taraxa::vrf_wrapper::vrf_pk_t& pk, const libff::alt_bn128_Fr& bls_secret,
const libff::alt_bn128_G2& bls_pub_key);

} // namespace taraxa::cli::tools
5 changes: 4 additions & 1 deletion libraries/cli/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Config::Config(int argc, const char* argv[]) {
std::vector<std::string> log_channels_append;
std::string node_secret;
std::string vrf_secret;
std::string bls_secret;
bool overwrite_config;

bool destroy_db = false;
Expand Down Expand Up @@ -121,6 +122,8 @@ Config::Config(int argc, const char* argv[]) {

node_command_options.add_options()(VRF_SECRET, bpo::value<std::string>(&vrf_secret), "Vrf secret key to use");

node_command_options.add_options()(BLS_SECRET, bpo::value<std::string>(&bls_secret), "Bls secret key to use");

node_command_options.add_options()(
OVERWRITE_CONFIG, bpo::bool_switch(&overwrite_config),
"Overwrite config - "
Expand Down Expand Up @@ -222,7 +225,7 @@ Config::Config(int argc, const char* argv[]) {
// Override config values with values from CLI
config_json = tools::overrideConfig(config_json, data_dir, boot_nodes, log_channels, log_configurations,
boot_nodes_append, log_channels_append);
wallet_json = tools::overrideWallet(wallet_json, node_secret, vrf_secret);
wallet_json = tools::overrideWallet(wallet_json, node_secret, vrf_secret, bls_secret);

if (light_node) {
config_json["is_light_node"] = true;
Expand Down
Loading
Loading