TL;DR

  • The EVM (Ethereum Virtual Machine) on Dock can read from native modules using precompiles
  • This makes the communication between EVM and native chain bidirectional.
  • With this new release, the EVM smart contracts can now read data like DIDs, revocation statuses, accumulator values, etc.
  • EVM smart contracts can thus verify signatures from DIDs and verify credentials as well
  • EVM contracts could also use information like participation in governance or staking in a DAO contract, for example

Background

Dock blockchain's features are organized in different modules (called pallets in Substrate). Eg, the DID module stores all DIDs, their public keys, service endpoints, etc. The revocation module stores revocation registries and statuses. The staking module stores who all have staked for whom and how much. And so on.

To deploy smart contracts on Dock, we have the EVM (Ethereum Virtual Machine) module (announcement) that allows developers to deploy contracts written in Solidity (the most popular smart contract language) for any custom logic in their dApp. However, it wasn't possible for the EVM module to read the data of other modules. E.g. your smart contract couldn't read the public key of a DID or couldn't check the revocation status. The native chain modules could read EVM storage but the opposite wasn't possible. This changes with our new release. With the new release, EVM contracts can read data stored in any module by using our storage-reader precompile.

Technical Details

The contracts can call the precompile with the module name and storage entry name (in that module) (many variations available) to read the corresponding storage. It is the contract's responsibility to parse that storage data to create a meaningful data structure, thus the contract should be aware of the data structure of the storage its reading. The precompile can read various storage structures like without keys, maps and double maps and allow reading from an offset and limit the amount of data read.

We are releasing 2 precompiles, one for reading storage as raw bytes and the other which is type-aware and will use defaults. It's recommended to use the latter if you are unsure of which to pick. The raw storage reader precompile is at address 0x000000000000000000000000000000000000000F and the type-aware is at address 0x000000000000000000000000000000000000000E.

Here is the code in the blockchain node repo and the tests in the SDK repo.

Applications

This new feature allows developers to build richer dApps which not only have the flexibility of smart contracts but can also use Dock's native features like DIDs. Say a contract requires a DID's approval and thus requires a signature to verify. The contract on receiving the signature, reads the public key from the DID module and verifies.

Contracts can also verify credentials by checking the signature and revocation status however care must be taken to do it for only those credentials which don't violate the privacy of the user. So anonymous credentials can be verified by reading the BBS+ public key and accumulator (for revocation) from the chain. Contracts could also use other information like an account's participation in staking or governance like a DAO that only allows accounts that have nominated some validators (by staking tokens) or play a role in governance like they being a council member, etc.

About Dock

Dock is a Verifiable Credentials provider that offers Dock Certs, a highly secure and scalable no-code platform, and Certs API to enable organizations to efficiently issue and verify digital credentials using blockchain technology. The credentials are tamper-resistant and instantly verifiable, and the technology is easy to integrate so users can provide Verifiable Credential support quickly.


Learn More