diff --git a/docs/sdk/03_accounts.md b/docs/sdk/03_accounts.md index 6f337eba7..294955a32 100644 --- a/docs/sdk/03_accounts.md +++ b/docs/sdk/03_accounts.md @@ -2,3 +2,87 @@ id: accounts title: Accounts --- + +import TsJsBlock from '@site/src/components/TsJsBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Create + +## Update + +## Delete + +## Query + +Sometimes there is the need to link a DID to an account publicly. +The link makes it possible to lookup a DID for an account. +The other directions is also possible. +With a DID you can lookup a list of linked account. + +Linking accounts can be useful when your account should have an identity. +E.g. as a collator, you might want to provide some public information so that delegator can better decide who earned their stake. + +An account can be linked to a DID in one of two ways. +Either the account that sends the transaction links itself to the DID, or the sender is unrelated to the DID and a third account is linked. +In the latter case, a challenge needs to be signed using the third account, to prove ownership. + +The second option is useful in cases where the account that should be linked doesn't own KILT tokens and the transaction is paid for by a third party. +This option also allows to link account schemes that are not native to the Spiritnet Blockchain. +Right now the only other address scheme supported are ethereum accounts. + +:::warning Don't use linked accounts for asset transfers + +Don't use these linked accounts for asset transfers. +Since these accounts are not limited to KILT accounts, but can be used on any chain, the recipient might not be able to access the transferred asset on other chains. +When a link to an account on a different Polkadot chain is created, this account might only be usable on this specific chain. + +If you want transfer assets to a DID have a look at [the asset transfer service](https://github.com/KILTprotocol/spec-KiltTransferAssetRecipientV1). + +::: + +## Linking the sender to a DID + +Link the sender of the transaction to the DID. +The sender will provide the deposit and pay the fees. +They will also be linked to the DID. + +## Linking an account to a DID + +Link another account to the DID. +The sender will provide the deposit and pay the fees, but will not be linked to the DID in any way. +The account that should be linked must sign a challenge to prove that the account agrees to be linked. + +The proof contains the DID that the account will be linked to and an expiration date (in terms of blocks), to prevent replay attacks. +The proof will only be valid up until the blocknumber is reached. + +With this option you can link addresses that are supported by the Spiritnet blockchain (Sr25519, Ed25519, Ecdsa), but also ethereum addresses. + + + + + +## Query the web3name of an Account + +For accounts that have been linked to DIDs that have claimed a web3name, the linking feature opens the way to a host of possibilities, e.g., showing the web3name of a collator's account on the [KILT Stakeboard][kilt-stakeboard]. + +This section shows how to perform the `account -> web3name` querying both with and without the support of the KILT SDK. + +## Query an Account's web3name with the KILT SDK + +## Query an Account's web3name without the KILT SDK + +[kilt-stakeboard]: https://stakeboard.kilt.io/ + +## Unlink an Account From a KILT DID + +Similar to the way a new account to DID link is created, removing a link can happen in one of three ways: + +1. The DID owner submits a transaction indicating which account to unlink: + +2. The linked account submits a transaction indicating that the link with the DID should be removed: + +3. The deposit payer submits a transaction indicating that they want to reclaim their deposit, which in turn removes the existing link between the specified account and DID: