Creating a Decentralized Identity
If you want to benefit from Self-Sovereign Identity, you need to create a Decentralized Identity. This identity consists of many parts that have different functions.
Note that the Iota Identity Framework follows IOTA DID Method Specification.
Identity Generation Process
1. Get Funds to Cover the Storage Deposit
The first thing you will need to generate an identity is an address with enough funds to cover the Storage Deposit. In test networks, you can use a faucet to request funds.
If you want to use the main Shimmer or IOTA networks, you will need an output with actual Shimmer or IOTA funds to create a new Alias Output that represents a DID.
2. Create the Content for the DID Document
As a bare minimum, a DID document needs at least 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.
You can use a placeholder did:iota:0x0000000000000000000000000000000000000000000000000000000000000000
to reference
the DID inside the document.
3. Construct a New Alias Output
Next, you need to construct a new Alias Output that includes the
DID Document in the State Metadata.
The created Alias Output 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 need 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.
4. Publish the generated Alias Output.
The byte cost for the document is 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 another Basic Output which contains the remaining tokens.
The DID is only known once the Alias Output is successfully published,
since the DID's Tag contains the
Alias ID.
Once the transaction is confirmed, the Alias ID
is assigned, and the DID can be derived from it,
the DID Document is stored on the ledger and can be resolved using any node.
Full Example Code
- Rust
- Typescript (Node.js)
loading...
loading...
Running Examples Locally
In order to run the examples, you will need to run the IOTA Sandbox locally.
If you want to use something different, you will need to modify the API and faucet endpoints in the examples to match your setup.