---
# System prepended metadata

title: Veramo Ethr Meta Transactions

---

# Veramo Ethr Meta Transactions

Meta Transactions: https://soliditydeveloper.com/meta-transactions

## Implementation Plan

- DID document interaction:
    - Lowest Contract Calling Library:
        - https://github.com/decentralized-identity/ethr-did-resolver/blob/master/src/controller.ts
    - Library which wraps the contract lib
        - https://github.com/uport-project/ethr-did/blob/master/src/index.ts
    - Veramo usage
        - https://github.com/uport-project/veramo/blob/877c513a5bc253ed30c74ace00ce988197d12a2d/packages/did-provider-ethr/src/ethr-did-provider.ts#L89

- ethr-did-resolver new functions
    - meta transaction functions (placed in plugin):
        - changeOwnerSigned
        - addDelegateSigned
        - revokeDelegateSigned
        - setAttributeSigned
        - revokeAttributeSigned
    - crypto material functions (placed in identifier):
        - generate hash, V, R, S parameters

## v,r,s signature madness

Delegation Signatures rely on validating a signed hash in contract. These contract methods need additional parameters for this to work. Namely v,r and s which are parts of a signature. The signature is created on a keccak hash of a encoded packed payload.

For verification purposes, this hash gets also constructed in the ethr did registry coomputes the hash as following:

```
bytes32 hash = keccak256(abi.encodePacked(bytes1(0x19), bytes1(0), this, nonce[identityOwner(identity)], identity, "changeOwner", newOwner));
````

We need to do the same. Thankfully, ethers (lib) has some [util function](https://docs.ethers.io/v5/api/utils/hashing/#utils--solidity-hashing) for this.

After it, we need to sign it.

See: https://github.com/uport-project/ethr-did-registry/blob/develop/contracts/EthereumDIDRegistry.sol#L84


- Keymaterial of the Delegator (Wallet)
    - Signs and actually creates the transaction
    - Pays gas fees
- Keymaterial of the DID Owner
    - Creates signature of action to take

Changes in ethr-did-resolver: 
- Add signed method calling the signed method of the contract
    - Has 4 new params than it's non signed counterpart
    - identity we want to change (normally this.address)
    - v, r and s signature parameters


### Message Veramo

