Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Polkadot Wiki Migration] Proxy Accounts #13

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions tutorials/.pages
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: Tutorials
nav:
- index.md
- accounts
4 changes: 4 additions & 0 deletions tutorials/accounts/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: Accounts
nav:
- index.md
- proxy-accounts.md
7 changes: 7 additions & 0 deletions tutorials/accounts/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Accounts
description: This section contains tutorials that explain how to manage accounts on the Polkadot network. Learn how to interact with the Polkadot network by doing different operations with your accounts.
hide:
- feedback
template: subsection-index-page.html
---
138 changes: 138 additions & 0 deletions tutorials/accounts/proxy-accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
title: Proxy Accounts
description: TODO
---

# Proxy Accounts

Blockchain networks often require users to maintain a delicate balance between security and participation. [Proxy accounts](https://wiki.polkadot.network/docs/learn-proxies){target=\_blank} offer a practical solution to this challenge.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Terms] Use 'blockchain' instead of 'Blockchain'.


With proxies, users can delegate their account's participation to a separate, "proxy" account. This proxy account can then perform a limited set of actions related to specific substrate pallets on behalf of the user's main account. The key benefit is that the user's primary account can be kept in a more secure state, while the proxy account acts as an interface with the network.
The weight and influence of the tokens held in the user's cold storage account are still leveraged through the proxy, allowing for efficient delegation without exposing the sensitive primary account. This approach helps minimize the number of transactions made by the main account further enhancing its protection.

While the relationship between a proxy and its proxied account may be discoverable, proxies still provide an effective way to drive attention away from the user's main account.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'proxied'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'proxied'?


For more information about using proxies, check the following videos:

- [Proxy Accounts Tutorial](https://www.youtube.com/watch?v=1tcygkq52tU){target=\_blank}
- [Proxy Accounts Advanced Tutorial](https://www.youtube.com/watch?v=Qv_nJVcvQr8&t=4437s){target=\_blank}

For detailed information on the specific capabilities of proxies, including the calls and pallets they can access, consult the runtime source code of the blockchain you're using.

In Polkadot's case, the available proxy types are defined as follows:

```rust
pub enum ProxyType {
Any = 0,
NonTransfer = 1,
Governance = 2,
Staking = 3,
// Skip 4 as it is now removed (was SudoBalances)
// Skip 5 as it was IdentityJudgement
CancelProxy = 6,
Auction = 7,
NominationPools = 8,
}
```

The scope and permissions of each proxy type are defined in the Polkadot runtime source code. For the most current implementation details, you can refer to the [Polkadot runtime repository](https://github.com/polkadot-fellows/runtimes/blob/e220854a081f30183999848ce6c11ca62647bcfa/relay/polkadot/src/lib.rs#L1106){target=\_blank}.

## Create a Proxy

To create a proxy account, you need to call the `proxy.addProxy` extrinsic. For step-by-step instructions on creating a proxy account using Polkadot.js Apps, refer to the "Setting Proxies" section in the [How to Create a Proxy Account](https://support.polkadot.network/support/solutions/articles/65000182179-how-to-create-a-proxy-account#Setting-Proxies){target=\_blank} article.

## Remove a Proxy

To remove a proxy account, you can either remove individual proxy accounts by calling the `proxy.removeProxy` extrinsic or clear all proxies at once by calling `proxy.removeProxies`. For detailed instructions on removing a proxy account using Polkadot.js Apps, refer to the "Removing Proxies" section in the [How to Create a Proxy Account](https://support.polkadot.network/support/solutions/articles/65000182179-how-to-create-a-proxy-account#Removing-Proxies){target=\_blank} article.

## View your Proxies

There are two ways to check your existing proxy accounts:

### Account Manager

1. In Polkadot.js Apps, navigate to the **Accounts** dropdown and select the **Accounts** option
![](/images/tutorials/accounts/proxy-accounts/proxy-accounts-1.webp)

2. Hover over the blue icon next to the account you have proxied, then click **Managed proxies**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'proxied'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'proxied'?

![](/images/tutorials/accounts/proxy-accounts/proxy-accounts-2.webp)

3. This will open a modal where you can view all the proxies associated with that account and manage them
![](/images/tutorials/accounts/proxy-accounts/proxy-accounts-3.webp)

### Chain State Query

1. In Polkadot.js Apps, navigate to the **Developer** dropdown and select the **Chain state** option.
![](/images/tutorials/accounts/proxy-accounts/proxy-accounts-4.webp)

2. Query proxy accounts

1. Select the **proxy** pallet
2. Choose the **proxies** call
3. Select the account you want to check
4. Click the **+** button to execute the query
5. The results will show the proxies associated with the selected account
![](/images/tutorials/accounts/proxy-accounts/proxy-accounts-5.webp)

## Set-up and Use of Time-delayed Proxies

Proxies can be enhanced with an additional layer of security through the use of a time delay. This delay, measured in blocks, provides a window of time during which any malicious actions can be detected and reverted.

The process works as follows:

1. The proxy account uses the `proxy.announce` extrinsic to announce the intended action, including the hash of the function call
2. The announced action is then delayed for a specified number of blocks
3. During this time delay window, the announced action can be canceled by either the proxy account itself using `proxy.removeAnnouncement`, or by the proxied account using `proxy.rejectAnnouncement`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'proxied'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'proxied'?

4. After the time delay has elapsed, the proxy can then execute the announced call using the `proxy.proxyAnnounced` extrinsic

It's important to note that regular `proxy.proxy` calls do not work with time-delayed proxies. You must use the announce-and-execute process described above.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Papermoon.NotContractions] Use 'don't' instead of 'do not'.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [vale] reported by reviewdog 🐶
[Papermoon.WordSwapList] Use 'preceding' instead of 'above'.


For a detailed walkthrough on setting up and using time-delayed proxies, refer to the video tutorial linked below:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'walkthrough'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'walkthrough'?


- [Learn about Time-delayed Proxies on Polkadot](https://www.youtube.com/watch?v=3L7Vu2SX0PE){target=\_blank}

## Proxy Calls

Proxy calls are the mechanism used by proxy accounts to invoke actions on behalf of the accounts they represent. These proxy calls are essential, especially for "pure" proxies.

In the case of pure proxies, any attempt to directly sign transactions with the proxy account will fail. Instead, the proxy must use the appropriate proxy call extrinsics to interact with the network on behalf of the proxied account.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'proxied'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'proxied'?


For more details on pure proxy accounts, see the dedicated [Pure Proxy Accounts](/polkadot-docs/tutorials/accounts/pure-proxy-accounts.md) section.

### Nested Proxy Calls

Nested proxy calls refer to the concept of proxy calls within proxy calls. This scenario arises when the proxied account is itself a proxy account.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'proxied'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'proxied'?


Consider the example illustrated in the diagram below:

```mermaid
%%{
init: {
'themeVariables': {
'lineColor': '#FF2670'
}
}
}%%
graph LR;
A[Bob] -->|proxy.proxy| B[Charly];
A ~~~|"Any Proxy"| A;
B -->|proxy.proxy| C[P-C];
B ~~~|"Any Proxy"| B
C -->|proxy.proxy| D[Alice];
C ~~~|"Staking Proxy"| C
D ~~~|"Any Proxy"| D

classDef default fill:#FF2670,stroke-width:2px,color:#fff;
classDef active fill:#FF2670,stroke-width:2px,color:#fff;

linkStyle default stroke:#FF2670,stroke-width:1.5px,color:#FF2670,fill:none !important;
```

Alice has a stash account that has a staking proxy account, P-C. P-C is a pure proxy, originally spawned by Charly and now an any proxy acting on P-C's behalf.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly'?


To bond more funds, Charly needs to submit a `proxy.proxy` extrinsic to P-C. P-C will then submit a `proxy.proxy` extrinsic to Alice's account, including a `staking.bondExtra` extrinsic that specifies the extra tokens to be bonded.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly'?


If Charly wants to leave, a new account can take their place as the any proxy of P-C, without the need to change the staking proxy account P-C. Alice is the only one who can remove P-C as the staking proxy, and P-C can only perform staking-related tasks, not send funds out of Alice's account.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly'?


In the example diagram, submitting the proxy call from P-C to Alice will automatically request Charly's signature, as Charly is the only any proxy of P-C, and P-C cannot sign anything on its own.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly's'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly's'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly'?

However, if you want to use Bob's account instead of Charly's, you would need to submit all three proxy calls individually.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Charly's'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Papermoon.CustomDictionary] Did you really mean 'Charly's'?

Loading