Skip to content
A MetaMask-fork to support pluggable identity contracts.
JavaScript CSS Other
Branch: metamonk/devel…
Clone or download
Pull request Compare This branch is 23 commits ahead, 1220 commits behind MetaMask:develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci circleci: Replace nsp with npm audit Dec 6, 2018
.github encourage stackexchange in issue templates (MetaMask#5737) Nov 13, 2018
.storybook
app Fix UI break during merges Dec 18, 2018
development
docs
mascara
notices
old-ui
test Ensures that advanced tab gas limit reflects tx gas limit Dec 12, 2018
ui
.babelrc Minimum Browsers Supported (MetaMask#4873) Aug 22, 2018
.dockerignore
.editorconfig
.eslintignore
.eslintrc
.gitattributes
.gitignore
.nvmrc nvm: Bump Node version to 8.13 Nov 21, 2018
.stylelintignore [WIP] Add packages and tasks for linting scss Aug 14, 2017
.stylelintrc Lint and cleanup all scss Aug 14, 2017
.travis.yml
CHANGELOG.md Version 5.2.2 RC1 Dec 13, 2018
CONTRIBUTING.md
Dockerfile
ISSUE_TEMPLATE
LICENSE
MISSION.md
README.md
USER_AGREEMENT.md
auto-changelog.sh
docker-compose.yml mascara - fix words and enviroment vars Nov 2, 2017
fonts
gentests.js
gulpfile.js
gulpfile.js.git-diff add the patch for Chrome-only build Dec 17, 2018
images
package-lock.json
package.json

README.md

MetaMonk - A MetaMask-fork to support pluggable identity contracts.

Introduction

This repository contains a modified, working-in-progress MetaMask that supports "pluggable identities".

(left) A link to switch on/off proxy mode
(right) When proxy mode is on, the "identity" in the gray box will be shown to Dapps instead.

Motivation

As MetaMask users, we often want programmable interfaces that a plain wallet account cannot provide. Wallet contracts, for example, is the simplest way to storage and transfer ethers in practice. It works like a typical wallet when holding ethers, but its behaviors can be customized.

However, when it comes to interacting with other contracts or DApp, users may find it much difficult to actaully interact with them. Take Multisignature wallet Gnosis as example. Although it is equipped with built-in ERC20 interface, but in the case of ERC721 or ENS, you will have to manually enter contract ABI and composed function payload in order to interact with external smart contract.

gnosis

(description) Gnosis wallet external smart contract interaction interface.

Proposal

This fork introduces the concept of "identity", and "pluggable" means that it is an opt-in feature. When the proxy mode is enabled, a user can switch to one of its identities on-the-fly, just like it can switch to different account/network before. It can make transactions to an address, and this MetaMask-fork can transparently transform it to a suitable function call to the proxy contract on behalf of the original user. The proxy contract is expected to use that information to perform the requested transaction afterwards. Multisig contracts, for example, do not execute transactions immediately until other owners' confirmations.

Test builds

The MetaMask-fork provides testing builds (Chrome and Firefox only) as zip packages. It is strongly encouraged to use a clean environment to minimize the interferences.

🔴🔴🔴 Disclaimer: Use at your own risk! 🔴🔴🔴

Implementation

MetaMask exposes the wallet address of the selected account after unlocking (in MetaMask < 5). Dapps can access it (from web3.currentProvider.accounts or web3.eth.getAccounts(), etc.), and use this address, the identity of the user, to issue signing requests or transactions. In Metamonk, the address can be replaced with the proxy address if set, and further modifications are required to make this possible.

For example, there is an assert in the code that the "from" address of a transaction must match the selected address in MetaMask, to ensure that the user is able to sign that transaction later (reference). If we consider a proxy contract also an identity of a user, this restriction no longer applies. As a result, we implement this feature as outlined:

  1. The user turns on the proxy mode option by toggling it in a dropdown menu
  2. The user adds a proxy contract (nickname, proxy address, function hash) and switch to this identity in the side menu
  3. MetaMask changes the exposed address to the address of the selected identity (contract address)
  4. If the Dapp wants to initialize a transaction, modify its destination to the address of the proxy contract, and encode parameters according to the type of that proxy contract, supplied by the user
  5. A popup is displayed as normal. The only differences are transformed amount and data
  6. The user clicks "sign", signing the transaction with the original account
  7. The transaction is sent as before

If (1) the user turns off the proxy mode option, or (2) it selects the non-contract address, no data is transformed, and the workflow should be identical as if this feature has not exist. This switch ensures its backward-compatibility.

The technical notes made while developing can be found here (on Notion).

Building / Deploying

Basically this is identical to the original documentation of MetaMask.

You can’t perform that action at this time.