1 unstable release
new 0.1.0 | Feb 20, 2025 |
---|
#2617 in Cryptography
56KB
900 lines
mind-sdk-randgen-rust
mind_sdk_randgen
is a Native Rust SDK by Mind Network.
Quick Start
Install
[dependencies]
mind_sdk_randgen = "*
build
cargo build --debug
cargo build --release
run
cd msn
cargo build && ./target/debug/mind_sdk_randgen --log-level=info check-hot-wallet-address
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn.toml register 0x06eF5C5ba427434bf36469B877e4ea9044D1b735
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_1.toml register 0x2F8aCe76a34e50943573826A326a8Eb8DC854f84
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_2.toml register 0x3df4b66E1895E68aB000f1086e9393ca1937Cd8b
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn.toml vote-loop-random
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_1.toml vote-loop-random
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_2.toml vote-loop-random
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn.toml check-registration
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_1.toml check-registration
cargo build && ./target/debug/mind_sdk_randgen --log-level=debug --node-config-file=./config/config_fvn_2.toml check-registration
CLI Help
# ./bin/randgen --help
FHE Randen Voter Node Cli
Usage: fvn [OPTIONS] <COMMAND>
Commands:
check-hot-wallet-address check hot wallet address, by default will use ./config/config_fvn.toml
check-gas-balance check hot wallet gas balance, need gas fee to vote
check-registration check if hot wallet has registered with a particular voter wallet
register register voter address
vote-once-given think a number and vote once
vote-once-random generate a random number and vote once
vote-loop-random continue voting by using random number
check-vote-rewards check voting rewards
check-vote check voting tx history on the explore
help Print this message or the help of the given subcommand(s)
Options:
--node-config-file <NODE_CONFIG_FILE>
fvn config file, contains all the config to run fvn [default: ./config/config_fvn.toml]
--log-level <LOG_LEVEL>
control level of print, useful for debug, default is info [default: info] [possible values: debug, info, warn, error]
--hot-wallet-private-key <HOT_WALLET_PRIVATE_KEY>
fvn wallet private key is needed if to load a different wallet from config_fvn.toml to sign the message onchain, by default load from ./config/config_fvn.toml
-h, --help
Print help
-V, --version
Print version
CLI Example
## command
./bin/randgen --log-level=info check-hot-wallet-address
{
"app": "randgen",
"command": "check-hot-wallet-address",
"arg": "",
"status": true,
"result": "0x64FF17078669A507D0c831D9E844AF1C967604Dd",
"note": ""
}
## command
./bin/randgen --log-level=info check-gas-balance
{
"app": "randgen",
"command": "check-gas-balance",
"arg": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": true,
"result": "197015375000000",
"note": ""
}
## command
./bin/randgen --log-level=info check-registration
{
"app": "randgen",
"command": "check-registration",
"arg": "0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": false,
"result": "",
"note": "hot wallet is not registered with any voter wallet"
}
## command
./bin/randgen --log-level=info check-vote-rewards
{
"app": "randgen",
"command": "check-vote-rewards",
"arg": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": false,
"result": "0",
"note": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd, voter_wallet: , vote_rewards: 0"
}
## command
./bin/randgen --log-level=info register 0x06eF5C5ba427434bf36469B877e4ea9044D1b735
{
"app": "randgen",
"command": "register",
"arg": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd, voter_wallet: 0x06eF5C5ba427434bf36469B877e4ea9044D1b735",
"status": true,
"result": "registration successful !",
"note": "is_registered: true, hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd, voter_wallet: 0x06eF5C5ba427434bf36469B877e4ea9044D1b735"
}
## command
./bin/randgen --log-level=info vote-once-given 5
{
"app": "randgen",
"command": "vote-once-given",
"arg": "number: 5, hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": true,
"result": "0x42d78185e4779dd3105598ac4f2786998c5059f8381a55daec12e4ffcc952a56",
"note": "vote once with given number: 5, gas_sued: 304749, block_number: 26373, tx_hash: 0x42d78185e4779dd3105598ac4f2786998c5059f8381a55daec12e4ffcc952a56"
}
## command
./bin/randgen --log-level=info vote-once-random
{
"app": "randgen",
"command": "vote-once-random",
"arg": "number: random, hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": true,
"result": "0xf955ea0f294da93ae14481e4d819d7acc0d1be9a874a90c6590c2dd9767e1038",
"note": "vote once with random number, gas_sued: 333053, block_number: 26417, tx_hash: 0xf955ea0f294da93ae14481e4d819d7acc0d1be9a874a90c6590c2dd9767e1038"
}
## command
./bin/randgen --log-level=info check-vote-rewards
{
"app": "randgen",
"command": "check-vote-rewards",
"arg": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": true,
"result": "206095238095238095",
"note": "hot_wallet: 0x6224F72f1439E76803e063262a7e1c03e86c6Dbd, voter_wallet: 0x06eF5C5ba427434bf36469B877e4ea9044D1b735, vote_rewards: 206095238095238095"
}
## command
./bin/randgen --log-level=info check-vote
{
"app": "randgen",
"command": "check-vote",
"arg": "0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"status": true,
"result": "check on the explore: testnet: https://explorer-testnet.mindnetwork.xyz/address/0x6224F72f1439E76803e063262a7e1c03e86c6Dbd, mainnet: https://explorer.mindnetwork.xyz/address/0x6224F72f1439E76803e063262a7e1c03e86c6Dbd",
"note": ""
}
License
This project is licensed under the MIT License.
Contact
For questions or support, please contact Mind Network Official Channels.
Dependencies
~81MB
~1.5M SLoC