Skip to main content

Single Nominator Pool

Using mytonctrl

Currently mytonctrl supports single_nominator contracts, but firstly you need to install mytonctrl 2.0.

mytonctrl 2.0

If you already have installed mytonctrl just use command update mytonctrl2. If you have no mytonctrl installed, follow these steps:

  1. Download installation script:
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/mytonctrl2/scripts/install.sh
  1. Run installation script:
sudo bash ./install.sh -b mytonctrl2

Set up single-nominator

After you have created and activated validator's wallet, follow these steps:

  1. Enable single nominator mode
MyTonCtrl> enable_mode single-nominator
  1. Create pool
MyTonCtrl> new_single_pool <pool-name> <owner_address>
  1. Type pools_list to display pool addresses

  2. Send 1 TON to the pool and activate it

MyTonCtrl> activate_single_pool <pool-name>

Now you can work with this pool via mytonctrl like with a standard nominator pool.

Without mytonctrl

Prepare launched Validator

If you have mytonctrl installed and validator running:

  1. Stop validation and withdraw all funds.

Prepare from the beginning

If you had no Validator before, do the following:

  1. Run a Validator and make sure it's synced.
  2. Stop validation and withdraw all funds.

Prepare single_nominator

  1. Install nodejs v.16 and later and npm (detailed instructions)
  2. Install ts-node and arg module
$ sudo apt install ts-node
$ sudo npm i arg -g
  1. 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
  1. Run test to make sure everything is set up properly:
$ npm run test
  1. Replace mytonctrl nominator-pool scripts: https://raw.githubusercontent.com/orbs-network/single-nominator/main/mytonctrl-scripts/install-pool-scripts.sh

Create single_nominator Pool

  1. Get Toncenter API key from a Telegram @tonapibot
  2. 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>
  1. Create deployer address:
$ npm run init-deploy-wallet
Insufficient Deployer [EQAo5U...yGgbvR] funds 0
  1. Topup deployer address with 2.1 TON
  2. Deploy pool contract, you will get pool address: Ef-kC0..._WLqgs:
$ npm run deploy
  1. Convert address to .addr:
$ fift -s ./scripts/fift/str-to-addr.fif Ef-kC0..._WLqgs

(Saving address to file single-nominator.addr)

  1. Backup deployer private key "./build/deploy.config.json" and "single-nominator.addr" files
  2. Copy "single-nominator.addr" to "mytoncore/pools/single-nominator-1.addr"
  3. Send stake from owner address to single nominator address

Withdrawals from Single Nominator

Using wallets to withdraw from single_nominator Fift:

  1. Create "withdraw.boc" request with amount:
$ fift -s ./scripts/fift/withdraw.fif <withdraw_amount>
  1. 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
  1. 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>
  1. Send request to single nominator address:

a.

$ tons wallet transfer <my-wallet> <single_nominator_address> <amount=1> --body withdraw.boc
tonkeeper

b.

npm link typescript

c.

npx ts-node scripts/ts/withdraw-deeplink.ts <single-nominator-addr> <withdraw-amount>

d. Open deeplink on the owner's phone

See Also