/safe-did-dis

Experimental Safe fallbackHandler to add decentralized identity support via did:dis

Primary LanguageSolidityMIT LicenseMIT

Safe Decentralized Identity System

An experimental fallbackHandler to add the did:dis DID prototype to Safe Smart Wallets.

Why?

The did:pkh DID standard isn't scalable, because you can't update the underlying DID document. It's static. And that's bad because you're stuck with one signing/verifying key. Very (very) bad UX in the land of Web3.

The proposed did:dis DID standard overcomes these limits, while minimizing the cost of generation. Using EIP-3886 the smart contract can communicate with an offchain service, which hosts the DID document and thus not requiring any onchain transactions to update.

overview

Usage

This is a list of the most frequently needed commands.

Build

Build the contracts:

$ forge build

Clean

Delete the build artifacts and cache directories:

$ forge clean

Compile

Compile the contracts:

$ forge build

Coverage

Get a test coverage report:

$ forge coverage

Deploy

Deploy to Anvil:

$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545

For this script to work, you need to have a MNEMONIC environment variable set to a valid BIP39 mnemonic.

For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.

Format

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm lint

Test

Run the tests:

$ forge test

Generate test coverage and output result to the terminal:

$ pnpm test:coverage

Generate test coverage with lcov report (you'll have to open the ./coverage/index.html file in your browser, to do so simply copy paste the path):

$ pnpm test:coverage:report

Notes

  1. Foundry uses git submodules to manage dependencies. For detailed instructions on working with dependencies, please refer to the guide in the book
  2. You don't have to create a .env file, but filling in the environment variables may be useful when debugging and testing against a fork.

Related Efforts

License

This project is licensed under MIT.