Creating a Decentralized Identity
When someone or something wants to benefit from Self-Sovereign Identity, they must first create a Decentralized Identity. This identity consists of many parts that have different functions. This page will cover both the basics and the details about identity creation and publishing.
Creating an Identity
- Rust
- Node.js
loading...
loading...
This examples creates a new address with funds using the faucet on a private network. Next, it creates a new DID Document with a verification method. This DID Document is then published in an Alias Output making the DID available in the ledger state and resolvable by any node.
Note that using the faucet is only possible on private networks or public testnets. Once the Stardust update is released on the Shimmer network or the IOTA network, an output with actual Shimmer or IOTA funds is required to create a new Alias Output that represents a DID.
Updating the identity is also possible, which will be discussed in the next section, but all previous states of the DID Document will still be stored in permanodes or any third party recording the network activity.
Identity Generation Process
In order to create a Alias Output, an existing output is required to make a transaction. For that a new Address is generated and a Basic Output controlled by this address is created using the faucet.
A DID Document is then created which includes one verification method. At this point the DID itself is unknown since the Alias Output is not published yet and didn't get an Alias ID
assigned. For that a placeholder did:iota:0x0000000000000000000000000000000000000000000000000000000000000000
is used to reference the DID inside the document.
An Alias Output is created which contains an encoded version of the DID Document in its State Metadata
and has the state controller and the governor set to the generated Ed25519 address. Note that controllers don't have to be Ed25519 addresses, they can be any type of output. However, they must be unlocked in order perform a state or governance transition when the DID Document is updated or destroyed.
The byte cost for the document is then automatically calculated and a new transaction is published that includes the Basic Output as input and the newly generated Alias Output as output as well as a Basic Output which contains the remaining IOTA coins.
Once the transaction is confirmed, the Alias ID
would be assigned and the DID can be derived from it. Now The DID Document is stored on the ledger and can be resolved using any node. See the further examples for updating and resolving DID.
Running a private network
In order to run the examples, a private network (sometimes also called a private Tangle) needs to run locally. You can refer to Hornet wiki for instructions on how to run a private network.
If your local private network uses different ports than Hornet, modify the API and faucet endpoints in the examples to match your local setup.