cip: xx
title: Safe DID Method Specification
author: Richard Meissner (@rmeissner), Joel Thorstensson (@oed)
discussions-to: <https://github.com/ceramicnetwork/CIP/issues/xx>
status: Draft
category: Standards
type: RFC
created: 2021-03-24
The Safe DID Method converts any instance of the Gnosis Safe smart contract system, deployed on any blockchain, into a DID. The list of owners from the OwnerManager.sol module gets converted into a list of controller DIDs in the resolved DID document. This is achieved by using the Chain Agnostic Improvement Proposals to describe the smart contract address, as well as the Ceramic network to find the DID associated with the owners of the Safe contract.
The name string that shall identify this DID method is: safe.
A DID that uses this method MUST begin with the following prefix: did:safe. Per the DID specification, this string MUST be in lowercase. The remainder of the DID, after the prefix, is specified below.
The method specific identifier is simply a CAIP-10 Account ID where the : character has been replaced by . and the @ character replaced by _, in order to comply with the DID spec.
In the example below we see a
did:safe:0xff6229bc3655cf0204e850b54397d3651f5198c4_eip155.1
In this section the CRUD operations for an Safe DID are defined.
Create a Gnosis safe contract on any EVM chain.
Extract the Account ID from the method specific identifier. From it you can learn which Safe contract on which blockchain to look up the owners. Once you have the owner's accounts convert them to CAIP-10 Account ID by combining it with the Chain ID from the Account ID from the safe DID. Using the Ceramic caip10-link doctype we can now look up the DID(s) which these account(s) points to.
Here's and example of how to make this lookup using the javascript Ceramic api. This function will return either null or the DID related to the given account id.
async function getControllerDid(accountId: string) {
const caip10Doc = await ceramic.createDocument('caip10-link', {
metadata: {
controllers: [accountId]
}
})
return caip10Doc?.content
}