Set Up a Proxy Account¶
Introduction¶
Proxy accounts can be set up to perform a limited number of actions on behalf of primary accounts and help keep the underlying accounts safe. As a block producer on Tanssi, it's a good idea to take advantage of proxy accounts to interact with the network in place of your block producer account.
The staking proxy type conveniently allows the proxy account to manage staking activities, such as delegating and rotating session keys, on behalf of the primary block producer account, effectively transforming it into a "hot wallet" for performing regular maintenance duties on behalf of your "cold wallet" block producer account. For added safety, you can regularly rotate the proxy account.
Proxy accounts can also help you implement the principle of least privilege for access control. For example, if you have multiple team members, you can give them the minimum access required to carry out their duties via a specific proxy account.
This tutorial will walk you through configuring a staking proxy account on the Tanssi Dancebox TestNet specifically for operations as a block producer. Then, it will demonstrate initiating a delegation using the newly created staking proxy.
Checking Prerequisites¶
To follow along with this tutorial, you will need to have:
- Polkadot.js Apps open and connected to the Tanssi Dancebox TestNet
- Create or have two accounts accessible in Polkadot.js Apps
- Both accounts will need to be funded with
DANCE
tokens, and the block producer account will need at least10,000
DANCE
If you need help importing your accounts into Polkadot.js Apps, please check out the Connecting to Polkadot.js guide.
Creating a Staking Proxy Account¶
There are a couple of ways you can create proxy accounts in Polkadot.js Apps, either from the Extrinsics page or the Accounts page. However, to create a time-delayed proxy, you will need to use the Extrinsics page. A time delay provides an additional layer of security to proxies by specifying a delay period based on the number of blocks. This will prevent the proxy account from executing a transaction until the delay period ends. The delay allows time for the primary account that controls the proxy to review pending transactions and provides a limited period of time to cancel any actions.
You also have the option of creating a proxy of type Any which grants the proxy account full and unrestricted control over the primary account. This means that the proxy account can transfer funds, and perform any arbitrary action. The following demo will showcase configuring a Staking proxy, which is more restrictive than an Any proxy, as it limits functions to activities that pertain to staking, such as delegating, undelegating, and mapping session keys.
To get started creating your proxy account, head to the Developer tab and select Extrinsics from the dropdown. Next, you will need to take the following steps:
- Select the primary account
- From the submit the following extrinsic dropdown, select proxy
- Choose the addProxy extrinsic
- Choose Id from the AccountIdLookupOf dropdown
- Select the delegate account for the proxy
- From the proxyType dropdown, choose Staking
- Optionally, you can add a time delay using a specified number of blocks to add an additional layer of security for the primary account to review the pending transaction
- Click Submit Transaction
You will then be prompted to authorize and sign the transaction. Click Sign and Submit to create the proxy relationship. Once the transaction has been successfully submitted, you will receive some notifications confirming the transaction.
As previously mentioned, you can also create a proxy from the Accounts page. To do so, navigate to the Accounts page and take the following steps:
- Select the three vertical dots next to the primary account
- Select Add proxy
Note
If the account already has a proxy, Manage proxies will be displayed as an option instead of Add proxy.
A pop-up will appear and you can enter the required information, such as the proxied/primary account, the proxy account, and the type of proxy to create a proxy account. First, click Add proxy.
Then, take the following steps:
- Select the account you would like to set as a proxy
- Select the proxy type
- Click Submit and sign the transaction
In the next section, you will learn how to verify that your proxy account was set up successfully.
Verifying Your Proxy Account¶
You can verify that your proxy account has been successfully set up in a couple of ways: either through the Accounts page or via the Chain state page.
To check your proxy accounts from the Chain state page, you can take the following steps:
- From the selected state query dropdown, select proxy
- Choose the proxies extrinsic
- Select your primary/proxied account
- Click on the + button to send the query
The result will appear on the page showing you information about all of your proxies, including the delegate/proxy account address, the proxy type, the delay period if one was specified, and the total bond amount for all of your proxies in Planck.
You can also check your proxy accounts from the Accounts page. To do so, navigate to the Accounts page, and there should be a Proxy symbol next to the primary account. Hover over the icon and click on Manage proxies to review your proxies.
A pop-up will appear where you can see an overview of all of your proxy accounts.
Executing a Proxy Transaction¶
Now that you have created a proxy account and verified that it was successfully set up, you can execute a transaction using the staking proxy account on behalf of your block producer account, also known as the primary account or the account that is being proxied. The following example will demonstrate initiating a self-delegation. The proxy configuration shown is a realistic example of how you might have your own proxy configured for your block producer primary account.
To execute a transaction, you can navigate back to the Extrinsics page and take the following steps:
- Select the proxy account to submit the transaction from the using the select account dropdown
- From the submit the following extrinsic menu, select proxy
- Choose the proxy extrinsic
- Choose Id from the AccountIdLookupOf dropdown
- Select the primary account from the real dropdown
- Select the pooledStaking call
- Choose the requestDelegate extrinsic
- Enter the candidate address, which is the block producer account
- Select AutoCompounding or ManualRewards for the pool field
- Enter the amount to stake. This amount must meet the minimum, which is 10,000 DANCE tokens. You'll need to submit the value in Planck, so for 10,000, you'll need to enter
10000000000000000
- Click Submit Transaction
A pop-up will appear for you to authorize and sign the transaction. Enter your password for the proxy account and click Sign and Submit. To confirm the delegation request, you'll need to execute the pending request after two sessions have passed. Please refer to the instructions for executing pending requests for a step-by-step guide. You can also map your session keys to your block producer account via proxy.
After you've mapped your session keys and executed the pending delegation request, you can verify that your block producer is in the list of eligible candidates.
That's it! You've successfully executed a transaction using a proxy account on behalf of your primary block producer account.
| Created: March 7, 2024