single_nominator quick how-to

single_nominator quick how-to

Dr. Andreas, Dr. Elias

Currently mytonctrl have no native support to single_nominator contract, so here steps how to setup it. Native support will be released in Q4 2023

Step 1

Prepare validator server (mytonctrl install in full mode) and make sure it's synced.

OR (if you have mytonctrl installed and validator running)

stop validation and withdraw all funds

Step 2

Prepare single_nominator

1. Install "nodejs" version 16, "npm": https://github.com/nodesource/distributions#debian-and-ubuntu-based-distributions
2. Install "ts-node" and "arg" module
$ sudo apt install ts-node
$ sudo npm i arg -g
4. Create symlinks:
$ sudo ln -s /usr/bin/ton/crypto/fift /usr/local/bin/fift
$ sudo ln -s /usr/bin/ton/crypto/func /usr/local/bin/func
5. Run test to make sure everything is set up properly:
$ npm run test
6. Replace mytonctrl nominator-pool scripts: https://raw.githubusercontent.com/orbs-network/single-nominator/main/mytonctrl-scripts/install-pool-scripts.sh

Step 3

Create single_nominator pool

0. Get Toncenter API key from a Telegram bot: https://t.me/tonapibot
1. Set env variables:
export OWNER_ADDRESS=<owner_address>
export VALIDATOR_ADDRESS=<validator_wallet_address>
export TON_ENDPOINT=https://toncenter.com/api/v2/jsonRPC
export TON_API_KEY=<toncenter api key>
2. Create deployer address:
$ npm run init-deploy-wallet
Insufficient Deployer [EQAo5U...yGgbvR] funds 0
3. Topup deployer address with 2.1 TON
4. Deploy pool contract, you will get pool address: Ef-kC0..._WLqgs:
$ npm run deploy
5. Convert address to .addr:
$ fift -s ./scripts/fift/str-to-addr.fif Ef-kC0..._WLqgs
(Saving address to file single-nominator.addr)
6. Backup deployer private key "./build/deploy.config.json" and "single-nominator.addr" files
7. Copy "single-nominator.addr" to "mytoncore/pools/single-nominator-1.addr"
8. Send stake from owner address to single nominator address

Using wallets to withdraw from single_nominator

Fift:

1. Create "withdraw.boc" request with amount:
$ fift -s ./scripts/fift/withdraw.fif <withdraw_amount>
2. Create and sign request from owner's wallet:
$ fift -s wallet-v3.fif <my-wallet> <single_nominator_address> <sub_wallet_id> <seqno> <amount=1> -B withdraw.boc
3. Broadcast query:
$ lite-client -C global.config.json -c 'sendfile wallet-query.boc'

tons

1. Create "withdraw.boc" request with amount:
$ fift -s ./scripts/fift/withdraw.fif <withdraw_amount>
2. Send request to single nominator address:
$ tons wallet transfer <my-wallet> <single_nominator_address> <amount=1> --body withdraw.boc

tonkeeper

1. npm link typescript
2. npx ts-node scripts/ts/withdraw-deeplink.ts <single-nominator-addr> <withdraw-amount>
3. Open deeplink on the owner's phone



Report Page