Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dd360ec7a | |||
| 1b619b38a7 | |||
| 74433415b7 | |||
| 443b95998b | |||
| 2bff66e2c7 | |||
| cb3e73fbd7 |
Generated
+2
-10
@@ -4280,7 +4280,7 @@ dependencies = [
|
||||
"rw-stream-sink",
|
||||
"soketto",
|
||||
"url",
|
||||
"webpki-roots 0.22.6",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8014,7 +8014,6 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots 0.25.2",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
@@ -9177,7 +9176,7 @@ dependencies = [
|
||||
"time",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"webpki-roots 0.22.6",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9824,7 +9823,6 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"rustls 0.21.10",
|
||||
"tokio",
|
||||
"tungstenite",
|
||||
]
|
||||
@@ -10842,12 +10840,6 @@ dependencies = [
|
||||
"webpki 0.22.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
|
||||
|
||||
[[package]]
|
||||
name = "webrtc"
|
||||
version = "0.6.0"
|
||||
|
||||
+3
-3
@@ -159,7 +159,7 @@ log = "0.4"
|
||||
once_cell = "1.7.2"
|
||||
parking_lot = "0.12.1"
|
||||
rand = "0.8.5"
|
||||
reqwest = { version = "0.11.22", default_features = false, features = ["rustls-tls"] }
|
||||
reqwest = { version = "0.11.22", default_features = false }
|
||||
schemars = "0.8.1"
|
||||
serde = "1.0.152"
|
||||
serde_json = "1.0.91"
|
||||
@@ -169,9 +169,9 @@ time = "0.3.30"
|
||||
thiserror = "1.0.48"
|
||||
tokio = "1.33.0"
|
||||
tokio-util = "0.7.10"
|
||||
tokio-tungstenite = { version = "0.20.1", features = ["rustls"] }
|
||||
tokio-tungstenite = { version = "0.20.1" }
|
||||
tracing = "0.1.37"
|
||||
tungstenite = { version = "0.20.1", default-features = false, features = ["rustls"] }
|
||||
tungstenite = { version = "0.20.1", default-features = false }
|
||||
ts-rs = "7.0.0"
|
||||
utoipa = "3.5.0"
|
||||
utoipa-swagger-ui = "3.1.5"
|
||||
|
||||
@@ -71,6 +71,8 @@ pub trait NymContractsProvider {
|
||||
// SPs
|
||||
fn name_service_contract_address(&self) -> Option<&AccountId>;
|
||||
fn service_provider_contract_address(&self) -> Option<&AccountId>;
|
||||
// swapper
|
||||
fn swapper_contract_address(&self) -> Option<&AccountId>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -87,6 +89,7 @@ pub struct TypedNymContracts {
|
||||
|
||||
pub service_provider_directory_contract_address: Option<AccountId>,
|
||||
pub name_service_contract_address: Option<AccountId>,
|
||||
pub swapper_contract_address: Option<AccountId>,
|
||||
}
|
||||
|
||||
impl TryFrom<NymContracts> for TypedNymContracts {
|
||||
@@ -130,6 +133,10 @@ impl TryFrom<NymContracts> for TypedNymContracts {
|
||||
.name_service_contract_address
|
||||
.map(|addr| addr.parse())
|
||||
.transpose()?,
|
||||
swapper_contract_address: value
|
||||
.swapper_contract_address
|
||||
.map(|addr| addr.parse())
|
||||
.transpose()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,9 @@ impl<C, S> NymContractsProvider for NyxdClient<C, S> {
|
||||
fn name_service_contract_address(&self) -> Option<&AccountId> {
|
||||
self.config.contracts.name_service_contract_address.as_ref()
|
||||
}
|
||||
fn swapper_contract_address(&self) -> Option<&AccountId> {
|
||||
self.config.contracts.swapper_contract_address.as_ref()
|
||||
}
|
||||
|
||||
fn service_provider_contract_address(&self) -> Option<&AccountId> {
|
||||
self.config
|
||||
|
||||
@@ -33,6 +33,7 @@ pub struct NymContracts {
|
||||
pub ephemera_contract_address: Option<String>,
|
||||
pub service_provider_directory_contract_address: Option<String>,
|
||||
pub name_service_contract_address: Option<String>,
|
||||
pub swapper_contract_address: Option<String>,
|
||||
}
|
||||
|
||||
// I wanted to use the simpler `NetworkDetails` name, but there's a clash
|
||||
@@ -140,6 +141,7 @@ impl NymNetworkDetails {
|
||||
))
|
||||
.with_name_service_contract(get_optional_env(var_names::NAME_SERVICE_CONTRACT_ADDRESS))
|
||||
.with_explorer_api(get_optional_env(var_names::EXPLORER_API))
|
||||
.with_swapper_contract(get_optional_env(var_names::SWAPPER_CONTRACT_ADDRESS))
|
||||
}
|
||||
|
||||
pub fn new_mainnet() -> Self {
|
||||
@@ -170,6 +172,7 @@ impl NymNetworkDetails {
|
||||
ephemera_contract_address: parse_optional_str(mainnet::EPHEMERA_CONTRACT_ADDRESS),
|
||||
service_provider_directory_contract_address: None,
|
||||
name_service_contract_address: None,
|
||||
swapper_contract_address: None,
|
||||
},
|
||||
explorer_api: parse_optional_str(mainnet::EXPLORER_API),
|
||||
}
|
||||
@@ -289,6 +292,12 @@ impl NymNetworkDetails {
|
||||
self.explorer_api = endpoint.map(Into::into);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_swapper_contract<S: Into<String>>(mut self, endpoint: Option<S>) -> Self {
|
||||
self.contracts.swapper_contract_address = endpoint.map(Into::into);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
||||
|
||||
@@ -21,6 +21,7 @@ pub const GROUP_CONTRACT_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeu
|
||||
pub const MULTISIG_CONTRACT_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
|
||||
pub const COCONUT_DKG_CONTRACT_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
|
||||
pub const EPHEMERA_CONTRACT_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
|
||||
pub const SWAPPER_CONTRACT_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
|
||||
pub const REWARDING_VALIDATOR_ADDRESS: &str = "n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy";
|
||||
|
||||
pub const STATISTICS_SERVICE_DOMAIN_ADDRESS: &str = "https://mainnet-stats.nymte.ch:8090/";
|
||||
@@ -106,6 +107,10 @@ pub fn export_to_env() {
|
||||
var_names::EPHEMERA_CONTRACT_ADDRESS,
|
||||
EPHEMERA_CONTRACT_ADDRESS,
|
||||
);
|
||||
set_var_to_default(
|
||||
var_names::SWAPPER_CONTRACT_ADDRESS,
|
||||
SWAPPER_CONTRACT_ADDRESS,
|
||||
);
|
||||
set_var_to_default(
|
||||
var_names::REWARDING_VALIDATOR_ADDRESS,
|
||||
REWARDING_VALIDATOR_ADDRESS,
|
||||
@@ -151,6 +156,10 @@ pub fn export_to_env_if_not_set() {
|
||||
var_names::COCONUT_DKG_CONTRACT_ADDRESS,
|
||||
COCONUT_DKG_CONTRACT_ADDRESS,
|
||||
);
|
||||
set_var_conditionally_to_default(
|
||||
var_names::SWAPPER_CONTRACT_ADDRESS,
|
||||
SWAPPER_CONTRACT_ADDRESS,
|
||||
);
|
||||
set_var_conditionally_to_default(
|
||||
var_names::EPHEMERA_CONTRACT_ADDRESS,
|
||||
EPHEMERA_CONTRACT_ADDRESS,
|
||||
|
||||
@@ -19,6 +19,7 @@ pub const GROUP_CONTRACT_ADDRESS: &str = "GROUP_CONTRACT_ADDRESS";
|
||||
pub const MULTISIG_CONTRACT_ADDRESS: &str = "MULTISIG_CONTRACT_ADDRESS";
|
||||
pub const COCONUT_DKG_CONTRACT_ADDRESS: &str = "COCONUT_DKG_CONTRACT_ADDRESS";
|
||||
pub const EPHEMERA_CONTRACT_ADDRESS: &str = "EPHEMERA_CONTRACT_ADDRESS";
|
||||
pub const SWAPPER_CONTRACT_ADDRESS: &str = "SWAPPER_CONTRACT_ADDRESS";
|
||||
pub const REWARDING_VALIDATOR_ADDRESS: &str = "REWARDING_VALIDATOR_ADDRESS";
|
||||
pub const STATISTICS_SERVICE_DOMAIN_ADDRESS: &str = "STATISTICS_SERVICE_DOMAIN_ADDRESS";
|
||||
pub const SERVICE_PROVIDER_DIRECTORY_CONTRACT_ADDRESS: &str =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[book]
|
||||
title = "Nym Docs"
|
||||
title = "Nym Operators Guide"
|
||||
authors = ["Max Hampshire, Serinko, Alexia Lorenza Martinel"]
|
||||
description = "Nym technical documentation"
|
||||
description = "Everything needed to run Nym Mixnet components"
|
||||
language = "en"
|
||||
multilingual = false # for the moment - ideally work on chinese, brazillian portugese, spanish next
|
||||
src = "src"
|
||||
@@ -31,7 +31,7 @@ assets_version = "3.0.0" # do not edit: managed by `mdbook-admonish install`
|
||||
minimum_rust_version = "1.66"
|
||||
wallet_release_version = "1.2.8"
|
||||
# nym-vpn related variables
|
||||
nym_vpn_latest_binary_url = "https://github.com/nymtech/nym/releases/tag/nym-vpn-alpha-0.0.3"
|
||||
nym_vpn_latest_binary_url = "https://github.com/nymtech/nym/releases/tag/nym-vpn-alpha-0.0.4"
|
||||
nym_vpn_form_url = "https://opnform.com/forms/nymvpn-user-research-at-37c3-yccqko-2"
|
||||
|
||||
[preprocessor.last-changed]
|
||||
@@ -44,6 +44,9 @@ renderer = ["html"]
|
||||
# more pre-processor plugins to look into from https://github.com/rust-lang/mdBook/wiki/Third-party-plugins & https://lib.rs/keywords/mdbook-preprocessor
|
||||
# mdbook-i18n
|
||||
|
||||
# [preprocessor.api-call]
|
||||
# command = "$(tokens=$(curl -L https://api.nymtech.net/cosmos/staking/v1beta1/pool | jq 'values[\"pool\"][\"bonded_tokens\"]') && echo ${tokens:0:2},${tokens:2:2})"
|
||||
|
||||
#########
|
||||
# BUILD #
|
||||
#########
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
- [Automatic Node Upgrade: Nymvisor Setup and Usage](nodes/nymvisor-upgrade.md)
|
||||
- [Troubleshooting](nodes/troubleshooting.md)
|
||||
|
||||
# Token Economics
|
||||
|
||||
<!-- - [Fair Mixnet](tokenomics/fair-mixnet.md) -->
|
||||
<!-- - [Mixnet: Nym Node Rewards](tokenomics/mixnet-rewards.md) -->
|
||||
- [Nyx: Validator Rewards](tokenomics/validator-rewards.md)
|
||||
|
||||
# FAQ
|
||||
|
||||
- [Mix Nodes](faq/mixnodes-faq.md)
|
||||
|
||||
@@ -23,7 +23,7 @@ systemctl start <NODE>.service
|
||||
journalctl -f -u <NODE>.service # to monitor log of you node
|
||||
```
|
||||
|
||||
If these steps are too difficult and you prefer to just run a script, you can use [ExploreNYM script](https://github.com/ExploreNYM/bash-tool) or one done by [Nym developers](https://gist.github.com/tommyv1987/4dca7cc175b70742c9ecb3d072eb8539).
|
||||
If these steps are too difficult and you prefer to automate the process, try to setup your flow with [Nymvisor](nymvisor-upgrade.md).
|
||||
|
||||
> In case of a Network Requester this is all, the following step is only for Mix Nodes and Gateways.
|
||||
|
||||
@@ -98,4 +98,3 @@ The most common reason for your validator being jailed is that your validator is
|
||||
Running the command `df -H` will return the size of the various partitions of your VPS.
|
||||
|
||||
If the `/dev/sda` partition is almost full, try pruning some of the `.gz` syslog archives and restart your validator process.
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
stake_unyx=$(curl -s -L https://api.nymtech.net/cosmos/staking/v1beta1/pool | jq 'values["pool"]["bonded_tokens"]')
|
||||
stake_unyx=$(python -c "print(int($stake_unyx))")
|
||||
stake_nyx=$(python -c "print($stake_unyx / 1000000)")
|
||||
voting288k_percent=$(python -c "print(288000 / $stake_nyx * 100)")
|
||||
echo ${voting288k_percent:0:4}%
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
stake=$(curl -s -L https://api.nymtech.net/cosmos/staking/v1beta1/pool | jq 'values["pool"]["bonded_tokens"]')
|
||||
echo ${stake:1:2}.${stake:3:3}
|
||||
@@ -0,0 +1,55 @@
|
||||
# Nyx Validator Rewards
|
||||
|
||||
## Summary
|
||||
|
||||
* Nyx Validators are rewarded in NYM tokens from the Nym mixmining pool and increasingly from apps that run on the Nym mixnet, the first of which is the NymVPN.
|
||||
* Validators are rewarded for two different types of work: signing blocks in the Nyx chain and running the NymAPI to monitor mixnet routing and sign zk-nym credentials.
|
||||
* New validators can join via a NYM-to-NYX swap contract. The contract will not allow more than 1% of total stake increase per month to prevent sudden hostile takeovers. Current stake is <!-- cmdrun ../scripts/nyx-total-stake.sh --> million Nyx. Rate: 1:4.8 ~ 288k NYX for 60k NYM => <!-- cmdrun ../scripts/nyx-percent-stake.sh --> voting power
|
||||
* NYX tokens serve no other purpose than self-delegation for voting power and governance. All rewards are in NYM and distributed directly to the validators self-delegation address and are not distributed to stakers.
|
||||
* The contract will only allow swapping NYM to NYX and will **not** allow exchanging NYX back to NYM. A NYX holder who wishes to sell their NYX stake will have to do so via OTC trades.
|
||||
|
||||
## Validator Rewards
|
||||
|
||||
Nyx Validators perform two types of work for which they will be rewarded:
|
||||
|
||||
### 1. Signing blocks in the Nyx chain
|
||||
|
||||
A “block signing monitor" monitors blocks being produced on the Nyx chain and gathers the signatures present on every block. After an epoch ends, the monitor will assess performance of a validator and distribute tokens (to the self-delegation wallet) proportional to the voting period and uptime of the validator.
|
||||
|
||||
### 2. Running the NymAPI to monitor Mixnet routing and sign zk-nyms (Nym’s anonymous credentials)
|
||||
|
||||
Validator rewards initially come from the Nym mixmining pool with additional rewards increasingly coming from paid applications running on the Nym mixnet. The first paid application is the NymVPN. Nyx validators will be rewarded for their work directly in NYM tokens to their validator self-delegation address.
|
||||
|
||||
1. **From mixmining pool** - at a rate of 1000 NYM per hour, of which 2/3 are distributed for signing blocks and 1/3 for zk-nyms. These are stable in NYM, and therefore will fluctuate in their fiat value depending on exchange rate.
|
||||
|
||||
2. **From vpn user subscriptions** - the rate is tied to the growth of NymVPN subscriptions and will be stable in fiat, fluctuating in NYM depending on exchange rate. 1/3 will be distributed for signing blocks and 2/3 for zk-nyms.
|
||||
|
||||
| Source | Signing blocks | Running NymAPI | Currency |
|
||||
| :-- | --: | --: | :---: |
|
||||
| Mixmining pool | 2/3 | 1/3 | NYM |
|
||||
| NymVPN | 1/3 | 2/3 | fiat |
|
||||
|
||||
#### zk-nyms
|
||||
|
||||
The zk-nyms enable people to anonymously prove access rights to the upcoming NymVPN client without having to reveal payment details that might compromise their privacy. This is the first of what we imagine to be many possible use-cases for the zk-nym scheme.
|
||||
|
||||
### Allocation of Rewards from Nym mixmining pool
|
||||
|
||||
Rewards for validators will be distributed at an hourly rate from the mixmining pool. The amount is 1000 NYM per hour to be distributed among all validators. The fraction of mixmining rewards received by each individual validator is proportional to its contributions to the network.
|
||||
|
||||
Two thirds of the available rewards (670 NYM per hour) are distributed proportionally to each validator’s share when signing blocks in the chain, for which tx fees are also received in the same proportion; while the last third (330 NYM per hour) is allocated to validators running the NymAPI, proportionally to their contribution to signing zk-nym credentials.
|
||||
|
||||
The rewards are stable in NYM and fluctuate in their fiat value depending on the exchange rate of NYM tokens.
|
||||
|
||||
## Permissionless Nyx Chain
|
||||
|
||||
To allow new validators to join Nyx chain a new smart contract will be set up to release NYX in exchange for NYM. This contract allows a limited amount of NYM tokens to be deposited per month. The deposited NYM tokens are added to the mixmining pool and thus contribute to future rewards of all nodes and validators.
|
||||
|
||||
The smart contract will have two parameters:
|
||||
|
||||
1. the maximum amount of NYX available for purchase per month
|
||||
2. the NYM-to-NYX exchange rate offered by the contract
|
||||
|
||||
### Maximum Amount of NYX Available for Purchase per Month
|
||||
|
||||
The contract will not allow more than 1% of total stake increase per month to prevent sudden hostile takeovers. Current stake level is <!-- cmdrun ../scripts/nyx-total-stake.sh --> million Nyx.
|
||||
@@ -18,6 +18,7 @@ GROUP_CONTRACT_ADDRESS=n1rw8fw2mpcpzzq3jpa4e52ufawnmj5a4u68p35umvgskewuw0nlzsaa5
|
||||
MULTISIG_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
COCONUT_DKG_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
EPHEMERA_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
SWAPPER_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
REWARDING_VALIDATOR_ADDRESS=n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy
|
||||
STATISTICS_SERVICE_DOMAIN_ADDRESS="https://mainnet-stats.nymte.ch:8090"
|
||||
NYXD="https://rpc.nymtech.net"
|
||||
|
||||
@@ -19,6 +19,7 @@ COCONUT_DKG_CONTRACT_ADDRESS=n1hk7jy0m6ec5gventvgsx8skrz8mrudhqhun0ufg5gaa3mrr83
|
||||
REWARDING_VALIDATOR_ADDRESS=n1rfvpsynktze6wvn6ldskj8xgwfzzk5v6pnff39
|
||||
NAME_SERVICE_CONTRACT_ADDRESS=n1qum2tr7hh4y7ruzew68c64myjec0dq2s2njf6waja5t0w879lutqadamme
|
||||
SERVICE_PROVIDER_DIRECTORY_CONTRACT_ADDRESS=n13ehuhysn5mqjeaheeuew2gjs785f6k7jm8vfsqg3jhtpkwppcmzq6m2hmz
|
||||
SWAPPER_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
|
||||
STATISTICS_SERVICE_DOMAIN_ADDRESS="https://mainnet-stats.nymte.ch:8090"
|
||||
EXPLORER_API=https://qa-network-explorer.qa.nymte.ch/api
|
||||
|
||||
@@ -19,6 +19,7 @@ MULTISIG_CONTRACT_ADDRESS=n1q3zzxl78rlmxv3vn0uf4vkyz285lk8q2xzne299yt9x6mpfgk90q
|
||||
COCONUT_DKG_CONTRACT_ADDRESS=n1jsz20ggp5a6v76j060erkzvxmeus8htlpl77yxp878f0gf95cyaq6p2pee
|
||||
NAME_SERVICE_CONTRACT_ADDRESS=n12ne7qtmdwd0j03t9t5es8md66wq4e5xg9neladrsag8fx3y89rcs36asfp
|
||||
SERVICE_PROVIDER_DIRECTORY_CONTRACT_ADDRESS=n1ps5yutd7sufwg058qd7ac7ldnlazsvmhzqwucsfxmm445d70u8asqxpur4
|
||||
SWAPPER_CONTRACT_ADDRESS=n1e65nvg9dntgjmfl5ptgpqtlrl89ergakn0zchz68cklhjz6hrnxsmjs5rd
|
||||
EPHEMERA_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0
|
||||
|
||||
STATISTICS_SERVICE_DOMAIN_ADDRESS="http://0.0.0.0"
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ rust-version = "1.58.1"
|
||||
axum = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
bs58 = { workspace = true }
|
||||
clap = { workspace = true, features = ["cargo", "derive", "env"] }
|
||||
clap = { workspace = true, features = ["cargo", "derive"] }
|
||||
colored = "2.0"
|
||||
cupid = "0.6.1"
|
||||
dirs = "4.0"
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::env::vars::*;
|
||||
use clap::Args;
|
||||
use nym_bin_common::bin_info_owned;
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
|
||||
#[derive(Args)]
|
||||
pub(crate) struct BuildInfo {
|
||||
#[clap(short, long, default_value_t = OutputFormat::default(), env = MIXNODE_OUTPUT_ARG)]
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use super::DEFAULT_MIXNODE_ID;
|
||||
use crate::commands::try_load_current_config;
|
||||
use crate::env::vars::*;
|
||||
use crate::node::node_description::NodeDescription;
|
||||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
@@ -13,7 +11,7 @@ use std::io::Write;
|
||||
#[derive(Args)]
|
||||
pub(crate) struct Describe {
|
||||
/// The id of the mixnode you want to describe
|
||||
#[clap(long, default_value = DEFAULT_MIXNODE_ID, env = MIXNODE_ID_ARG)]
|
||||
#[clap(long)]
|
||||
id: String,
|
||||
|
||||
/// Human readable name of this node
|
||||
|
||||
@@ -1,52 +1,46 @@
|
||||
// Copyright 2020-2024 - Nym Technologies SA <contact@nymtech.net>
|
||||
// Copyright 2020-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use super::OverrideConfig;
|
||||
use super::DEFAULT_MIXNODE_ID;
|
||||
use crate::commands::override_config;
|
||||
use crate::config::{
|
||||
default_config_directory, default_config_filepath, default_data_directory, Config,
|
||||
};
|
||||
use crate::env::vars::*;
|
||||
use crate::node::MixNode;
|
||||
use clap::Args;
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
use nym_config::defaults::{
|
||||
DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT,
|
||||
};
|
||||
use nym_config::helpers::inaddr_any;
|
||||
use nym_crypto::asymmetric::{encryption, identity};
|
||||
use std::net::IpAddr;
|
||||
use std::{fs, io};
|
||||
|
||||
#[derive(Args, Clone, Debug)]
|
||||
#[derive(Args, Clone)]
|
||||
pub(crate) struct Init {
|
||||
/// Id of the mixnode we want to create config for
|
||||
#[clap(long, default_value = DEFAULT_MIXNODE_ID, env = MIXNODE_ID_ARG)]
|
||||
#[clap(long)]
|
||||
id: String,
|
||||
|
||||
/// The host on which the mixnode will be running
|
||||
#[clap(long, alias = "host", default_value_t = inaddr_any(), env = MIXNODE_LISTENING_ADDRESS_ARG)]
|
||||
listening_address: IpAddr,
|
||||
#[clap(long)]
|
||||
host: IpAddr,
|
||||
|
||||
/// The port on which the mixnode will be listening for mix packets
|
||||
#[clap(long, default_value_t = DEFAULT_MIX_LISTENING_PORT, env = MIXNODE_MIX_PORT_ARG)]
|
||||
mix_port: u16,
|
||||
#[clap(long)]
|
||||
mix_port: Option<u16>,
|
||||
|
||||
/// The port on which the mixnode will be listening for verloc packets
|
||||
#[clap(long, default_value_t = DEFAULT_VERLOC_LISTENING_PORT, env = MIXNODE_VERLOC_PORT_ARG)]
|
||||
verloc_port: u16,
|
||||
#[clap(long)]
|
||||
verloc_port: Option<u16>,
|
||||
|
||||
/// The port on which the mixnode will be listening for http requests
|
||||
#[clap(long, default_value_t = DEFAULT_HTTP_API_LISTENING_PORT, env = MIXNODE_HTTP_API_PORT_ARG)]
|
||||
http_api_port: u16,
|
||||
#[clap(long)]
|
||||
http_api_port: Option<u16>,
|
||||
|
||||
/// Comma separated list of nym-api endpoints of the validators
|
||||
// the alias here is included for backwards compatibility (1.1.4 and before)
|
||||
#[clap(long, alias = "validators", value_delimiter = ',', env = MIXNODE_NYM_APIS_ARG)]
|
||||
#[clap(long, alias = "validators", value_delimiter = ',')]
|
||||
nym_apis: Option<Vec<url::Url>>,
|
||||
|
||||
#[clap(short, long, default_value_t = OutputFormat::default(), env = MIXNODE_OUTPUT_ARG)]
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
@@ -54,10 +48,10 @@ impl From<Init> for OverrideConfig {
|
||||
fn from(init_config: Init) -> Self {
|
||||
OverrideConfig {
|
||||
id: init_config.id,
|
||||
listening_address: Some(init_config.listening_address),
|
||||
mix_port: Some(init_config.mix_port),
|
||||
verloc_port: Some(init_config.verloc_port),
|
||||
http_api_port: Some(init_config.http_api_port),
|
||||
host: Some(init_config.host),
|
||||
mix_port: init_config.mix_port,
|
||||
verloc_port: init_config.verloc_port,
|
||||
http_api_port: init_config.http_api_port,
|
||||
nym_apis: init_config.nym_apis,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ use nym_crypto::bech32_address_validation;
|
||||
use std::net::IpAddr;
|
||||
use std::process;
|
||||
|
||||
pub const DEFAULT_MIXNODE_ID: &str = "nym-mixnode";
|
||||
|
||||
mod build_info;
|
||||
mod describe;
|
||||
mod init;
|
||||
@@ -56,7 +54,7 @@ pub(crate) enum Commands {
|
||||
// Configuration that can be overridden.
|
||||
struct OverrideConfig {
|
||||
id: String,
|
||||
listening_address: Option<IpAddr>,
|
||||
host: Option<IpAddr>,
|
||||
mix_port: Option<u16>,
|
||||
verloc_port: Option<u16>,
|
||||
http_api_port: Option<u16>,
|
||||
@@ -81,7 +79,7 @@ pub(crate) async fn execute(args: Cli) -> anyhow::Result<()> {
|
||||
|
||||
fn override_config(config: Config, args: OverrideConfig) -> Config {
|
||||
config
|
||||
.with_optional(Config::with_listening_address, args.listening_address)
|
||||
.with_optional(Config::with_listening_address, args.host)
|
||||
.with_optional(Config::with_mix_port, args.mix_port)
|
||||
.with_optional(Config::with_verloc_port, args.verloc_port)
|
||||
.with_optional(Config::with_http_api_port, args.http_api_port)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Copyright 2021-2024 - Nym Technologies SA <contact@nymtech.net>
|
||||
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use super::DEFAULT_MIXNODE_ID;
|
||||
use crate::commands::try_load_current_config;
|
||||
use crate::env::vars::*;
|
||||
use crate::node::MixNode;
|
||||
use clap::Args;
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
@@ -11,7 +9,7 @@ use nym_bin_common::output_format::OutputFormat;
|
||||
#[derive(Args)]
|
||||
pub(crate) struct NodeDetails {
|
||||
/// The id of the mixnode you want to show details for
|
||||
#[clap(long, default_value = DEFAULT_MIXNODE_ID, env = MIXNODE_ID_ARG)]
|
||||
#[clap(long)]
|
||||
id: String,
|
||||
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
|
||||
+14
-12
@@ -2,45 +2,47 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use super::OverrideConfig;
|
||||
use super::DEFAULT_MIXNODE_ID;
|
||||
use crate::commands::{override_config, try_load_current_config, version_check};
|
||||
use crate::env::vars::*;
|
||||
use crate::node::MixNode;
|
||||
use anyhow::bail;
|
||||
use clap::Args;
|
||||
use log::error;
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
use nym_config::helpers::SPECIAL_ADDRESSES;
|
||||
use nym_validator_client::nyxd;
|
||||
use std::net::IpAddr;
|
||||
|
||||
#[derive(Args, Clone)]
|
||||
pub(crate) struct Run {
|
||||
/// Id of the nym-mixnode we want to run
|
||||
#[clap(long, default_value = DEFAULT_MIXNODE_ID, env = MIXNODE_ID_ARG)]
|
||||
#[clap(long)]
|
||||
id: String,
|
||||
|
||||
/// The custom host on which the mixnode will be running
|
||||
#[clap(long, alias = "host", env = MIXNODE_LISTENING_ADDRESS_ARG)]
|
||||
listening_address: Option<IpAddr>,
|
||||
#[clap(long)]
|
||||
host: Option<IpAddr>,
|
||||
|
||||
/// The wallet address you will use to bond this mixnode, e.g. nymt1z9egw0knv47nmur0p8vk4rcx59h9gg4zuxrrr9
|
||||
#[clap(long)]
|
||||
wallet_address: Option<nyxd::AccountId>,
|
||||
|
||||
/// The port on which the mixnode will be listening for mix packets
|
||||
#[clap(long, env = MIXNODE_MIX_PORT_ARG)]
|
||||
#[clap(long)]
|
||||
mix_port: Option<u16>,
|
||||
|
||||
/// The port on which the mixnode will be listening for verloc packets
|
||||
#[clap(long, env = MIXNODE_VERLOC_PORT_ARG)]
|
||||
#[clap(long)]
|
||||
verloc_port: Option<u16>,
|
||||
|
||||
/// The port on which the mixnode will be listening for http requests
|
||||
#[clap(long, env = MIXNODE_HTTP_API_PORT_ARG)]
|
||||
#[clap(long)]
|
||||
http_api_port: Option<u16>,
|
||||
|
||||
/// Comma separated list of nym-api endpoints of the validators
|
||||
// the alias here is included for backwards compatibility (1.1.4 and before)
|
||||
#[clap(long, alias = "validators", value_delimiter = ',', env = MIXNODE_NYM_APIS_ARG)]
|
||||
#[clap(long, alias = "validators", value_delimiter = ',')]
|
||||
nym_apis: Option<Vec<url::Url>>,
|
||||
|
||||
#[clap(short, long, default_value_t = OutputFormat::default(), env = MIXNODE_OUTPUT_ARG)]
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
@@ -48,7 +50,7 @@ impl From<Run> for OverrideConfig {
|
||||
fn from(run_config: Run) -> Self {
|
||||
OverrideConfig {
|
||||
id: run_config.id,
|
||||
listening_address: run_config.listening_address,
|
||||
host: run_config.host,
|
||||
mix_port: run_config.mix_port,
|
||||
verloc_port: run_config.verloc_port,
|
||||
http_api_port: run_config.http_api_port,
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// Copyright 2020-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use super::version_check;
|
||||
use super::DEFAULT_MIXNODE_ID;
|
||||
use crate::commands::{try_load_current_config, validate_bech32_address_or_exit};
|
||||
use crate::env::vars::*;
|
||||
use crate::node::helpers::load_identity_keys;
|
||||
use anyhow::{bail, Result};
|
||||
use clap::{ArgGroup, Args};
|
||||
@@ -15,11 +12,13 @@ use nym_types::helpers::ConsoleSigningOutput;
|
||||
use nym_validator_client::nyxd;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use super::version_check;
|
||||
|
||||
#[derive(Args, Clone)]
|
||||
#[clap(group(ArgGroup::new("sign").required(true).args(&["wallet_address", "text", "contract_msg"])))]
|
||||
pub(crate) struct Sign {
|
||||
/// The id of the mixnode you want to sign with
|
||||
#[clap(long, default_value = DEFAULT_MIXNODE_ID, env = MIXNODE_ID_ARG)]
|
||||
#[clap(long)]
|
||||
id: String,
|
||||
|
||||
/// Signs your blockchain address with your identity key
|
||||
@@ -35,7 +34,7 @@ pub(crate) struct Sign {
|
||||
#[clap(long)]
|
||||
contract_msg: Option<String>,
|
||||
|
||||
#[clap(short, long, default_value_t = OutputFormat::default(), env = MIXNODE_OUTPUT_ARG)]
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
pub mod vars {
|
||||
pub const MIXNODE_ID_ARG: &str = "NYM_MIXNODE_ID";
|
||||
pub const MIXNODE_LISTENING_ADDRESS_ARG: &str = "NYM_MIXNODE_LISTENING_ADDRESS";
|
||||
pub const MIXNODE_MIX_PORT_ARG: &str = "NYM_MIXNODE_MIX_PORT";
|
||||
pub const MIXNODE_VERLOC_PORT_ARG: &str = "NYM_MIXNODE_VERLOC_PORT";
|
||||
pub const MIXNODE_HTTP_API_PORT_ARG: &str = "NYM_MIXNODE_HTTP_API_PORT";
|
||||
pub const MIXNODE_NYM_APIS_ARG: &str = "NYM_MIXNODE_NYM_APIS";
|
||||
pub const MIXNODE_OUTPUT_ARG: &str = "NYM_MIXNODE_OUTPUT";
|
||||
}
|
||||
@@ -18,7 +18,6 @@ use tracing::instrument;
|
||||
|
||||
mod commands;
|
||||
mod config;
|
||||
mod env;
|
||||
pub(crate) mod error;
|
||||
mod node;
|
||||
|
||||
|
||||
Generated
+1
-10
@@ -5516,7 +5516,6 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots 0.25.4",
|
||||
"winreg 0.50.0",
|
||||
]
|
||||
|
||||
@@ -6483,7 +6482,7 @@ dependencies = [
|
||||
"thiserror",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"webpki-roots 0.22.6",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7272,7 +7271,6 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"rustls 0.21.7",
|
||||
"tokio",
|
||||
"tungstenite",
|
||||
]
|
||||
@@ -7454,7 +7452,6 @@ dependencies = [
|
||||
"httparse",
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
"rustls 0.21.7",
|
||||
"sha1",
|
||||
"thiserror",
|
||||
"url",
|
||||
@@ -7898,12 +7895,6 @@ dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "webview2-com"
|
||||
version = "0.19.1"
|
||||
|
||||
Generated
-7
@@ -4444,7 +4444,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
@@ -6272,12 +6271,6 @@ dependencies = [
|
||||
"system-deps 6.1.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "webview2-com"
|
||||
version = "0.19.1"
|
||||
|
||||
@@ -28,6 +28,8 @@ pub(crate) const SERVICE_PROVIDER_DIRECTORY_CONTRACT_ADDRESS: &str =
|
||||
"n13ehuhysn5mqjeaheeuew2gjs785f6k7jm8vfsqg3jhtpkwppcmzq6m2hmz";
|
||||
pub(crate) const NAME_SERVICE_CONTRACT_ADDRESS: &str =
|
||||
"n1qum2tr7hh4y7ruzew68c64myjec0dq2s2njf6waja5t0w879lutqadamme";
|
||||
pub(crate) const SWAPPER_CONTRACT_ADDRESS: &str =
|
||||
"n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
|
||||
|
||||
// -- Constructor functions --
|
||||
|
||||
@@ -64,6 +66,7 @@ pub(crate) fn network_details() -> nym_network_defaults::NymNetworkDetails {
|
||||
SERVICE_PROVIDER_DIRECTORY_CONTRACT_ADDRESS,
|
||||
),
|
||||
name_service_contract_address: parse_optional_str(NAME_SERVICE_CONTRACT_ADDRESS),
|
||||
swapper_contract_address: parse_optional_str(SWAPPER_CONTRACT_ADDRESS),
|
||||
},
|
||||
explorer_api: parse_optional_str(EXPLORER_API),
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ pub(crate) const COCONUT_DKG_CONTRACT_ADDRESS: &str =
|
||||
"n1ahg0erc2fs6xx3j5m8sfx3ryuzdjh6kf6qm9plsf865fltekyrfsesac6a";
|
||||
pub(crate) const EPHEMERA_CONTRACT_ADDRESS: &str =
|
||||
"n1ahg0erc2fs6xx3j5m8sfx3ryuzdjh6kf6qm9plsf865fltekyrfsesac6a";
|
||||
pub(crate) const SWAPPER_CONTRACT_ADDRESS: &str =
|
||||
"n1e65nvg9dntgjmfl5ptgpqtlrl89ergakn0zchz68cklhjz6hrnxsmjs5rd";
|
||||
|
||||
// -- Constructor functions --
|
||||
|
||||
@@ -59,6 +61,7 @@ pub(crate) fn network_details() -> nym_network_defaults::NymNetworkDetails {
|
||||
ephemera_contract_address: parse_optional_str(EPHEMERA_CONTRACT_ADDRESS),
|
||||
service_provider_directory_contract_address: None,
|
||||
name_service_contract_address: None,
|
||||
swapper_contract_address: parse_optional_str(SWAPPER_CONTRACT_ADDRESS),
|
||||
},
|
||||
explorer_api: parse_optional_str(EXPLORER_API),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user