MetaMask Snaps — extend wallet infrastructure

Volodymyr Pavlyshyn
7 min readSep 8, 2023

--

Why Metamask

The last thing that I want to do in my life is to build yet another crypto wallet but quite often i need one. One simple thing — adoption . it is one of the most widely used wallets even and btw one of the widely used extension on market

Key Metamask Statistics 2023

  • There are more than 21 million monthly active users of Metamask
  • Metamask is owned by ConsenSys AG
  • ConsenSys AG is valued at $3.2 billion
  • This is a 38-times increase from 2020
  • Metamask connects you to more than 3700 apps. Metamask makes Ethereum more accessible.

Read more at EarthWeb: Metamask Statistics 2023: How Many People use Metamask? https://earthweb.com/metamask-statistics/

So it is really widely adopted and trusted. It is scary me that we have a company behind a propject but we have a good part — it is open code base at list for now.

It is open

The codebase is publicly available, allowing anyone to review, contribute to, or fork the project. This open-source nature is crucial for several reasons:

Transparency:

Being open-source means that the code is available for public scrutiny. This is particularly important for software that handles sensitive operations like cryptographic key management and blockchain transactions. Users and developers can audit the code to ensure it meets security standards.

Community Contributions:

The open-source model allows for contributions from the developer community at large. This can lead to faster identification of bugs, more robust security features, and the development of new functionalities, like the aforementioned MetaMask Snaps.

Trust:

In the realm of cryptocurrencies and blockchain, trust is paramount. Open-source software is generally considered more trustworthy because it undergoes public scrutiny. This is especially important for a tool like MetaMask, which acts as a gateway to decentralized applications (dApps) and handles private keys.

MetaMask Snaps

Metamask community made a smart move. So to prevent a forks and fragmentation of community and products folks just made a project extandable and plugable. So you actually could simply buld on top instead of forking

MetaMask Snaps is an extensibility framework for the MetaMask browser extension, which is widely used for interacting with Ethereum-based decentralized applications (dApps). The Snaps framework allows developers to extend MetaMask’s functionality by creating custom plugins, often referred to as “Snaps.” These plugins can introduce new features, protocols, or even layer-2 solutions directly into the MetaMask user interface. This makes it easier for users to interact with a broader range of blockchain technologies without having to leave the MetaMask environment.

Why Are MetaMask Snaps Important?

User Experience: By integrating additional features directly into MetaMask, users can enjoy a more seamless and enriched experience. They don’t have to juggle multiple extensions or platforms to interact with various blockchain technologies.

  • Developer Flexibility: Developers can create custom solutions tailored to their dApps or protocols. This can include anything from custom transaction logic to integrating new cryptographic methods.
  • Interoperability: Snaps can facilitate better interoperability between different blockchain protocols and layer-2 solutions, making it easier for users to navigate the increasingly complex blockchain ecosystem.
  • Security: Since MetaMask is a well-trusted platform, extending its functionality through Snaps can offer a more secure way for users to try out new features or protocols.
  • Innovation: The extensibility allows for rapid experimentation and deployment of new blockchain technologies, accelerating the pace of innovation in the space.

How do MetaMask Snaps work?

Snaps are implemented as JavaScript/TypeScript applications where developers implement one or more of three functionalities (transaction insights, RPC requests, cron jobs) as JavaScript/TypeScript methods.

Because a Snap can consist of arbitrary code that can access a user’s MetaMask wallet, all Snaps are run in a special environment that is designed with security in mind. Thus, they differ in several ways from ordinary JavaScript or TypeScript code that would be found on, say, a web page or a Node.js application. In particular, the code will be executed in a “sandbox” that limits the JavaScript APIs that can be accessed.

Furthermore, to prevent Snaps from hogging system resources, all Snaps are meant to be “short-lived” in that they do not take too long to generate transaction insights or process RPC requests. Snaps that time out will be terminated by the MetaMask extension.

We refer the interested reader to the official documentation for more details on how Snaps work.

Not only Ethereum

While MetaMask is primarily associated with Ethereum, the Snaps framework opens up possibilities for extending its functionality beyond the Ethereum ecosystem. Here are some non-Ethereum use-cases where MetaMask Snaps could be beneficial:

1. Cross-Chain Interoperability

Snaps could facilitate seamless interactions between Ethereum and other blockchains like Bitcoin, Polkadot, or Binance Smart Chain. This could include features like cross-chain asset swaps or tracking portfolio balances across multiple chains.

2. Decentralized Identity (DID)

Given your interest in Self-Sovereign Identity (SSI), Snaps could be used to integrate decentralized identity protocols like Sovrin or Veres One. This would allow users to manage their digital identities directly within MetaMask, enhancing data privacy and control.

3. Decentralized Storage

Snaps could integrate decentralized file storage solutions like IPFS or Filecoin, enabling users to upload, manage, and share files without relying on centralized services.

4. Layer-2 Solutions

While these are often Ethereum-related, some layer-2 solutions aim to be blockchain agnostic. Snaps could provide interfaces for interacting with these solutions, making it easier for users to benefit from faster and cheaper transactions.

5. Data Analytics and Visualization

Snaps could offer data analytics tools that aggregate information from various blockchains, decentralized exchanges, or other data sources. This would allow users to get a comprehensive view of their activities and assets.

6. Privacy Enhancements

Snaps could integrate privacy-focused technologies like zero-knowledge proofs or mixers that work across multiple blockchains, allowing users to make private transactions or shield their identities.

7. Social Networking

Decentralized social networks like NOSTR could be integrated into MetaMask via Snaps, allowing users to manage their social interactions and digital assets in one place.

8. IoT Integration

Snaps could facilitate interactions with Internet of Things (IoT) devices that use blockchain for secure data transmission and storage. This could include smart home controls, supply chain tracking, or even healthcare devices.

9. NFT Platforms

While NFTs are popular on Ethereum, they also exist on other blockchains like Flow or Tezos. Snaps could allow users to manage and interact with NFTs across multiple platforms.

10. Decentralized Governance

Snaps could integrate voting mechanisms from DAOs (Decentralized Autonomous Organizations) that exist on blockchains other than Ethereum, enabling users to participate in governance without leaving the MetaMask interface.

What can you do with MetaMask Snaps for Ethereum

So it solve a UI and adoption problem of Acount Abstraction. There are many other use cases of MetaMask Snaps, but the main use case that is emphasized by MetaMask themselves is the ability to use Snaps to build user interfaces for account abstraction-style on-chain wallet smart contracts.

Account abstraction gives developers a lot of freedom to create a wallet with whatever custom authentication schemes, access controls, or other features that can be used to control transactions from the wallet.

But actually accessing the custom wallet functionality would require the user to construct and send non-trivial transactions to the wallet smart contract. A Web3 developer could create a Snap that serves as the user interface for such a wallet so that users don’t have to care about technical details — similar to how a bank might create a phone app that talks to the bank’s servers.

Discover From a community

It is already a big list of cool comunity project https://snaps.directory/ give you safe and curated list of snaps

I personaly reaaly keen on:

Try It yourself, build yourself

If your idea is still not implemented — make your hands dirty Good workshop intro with a step by step guide

GitHub from workshop https://github.com/ziad-saab/metamask-snaps-transaction-insights-workshop

Developer Resources

To learn more and go deeper

Examples

Templates

--

--

Volodymyr Pavlyshyn
Volodymyr Pavlyshyn

Written by Volodymyr Pavlyshyn

I believe in SSI, web5 web3 and democratized open data.I make all magic happens! dream & make ideas real, read poetry, write code, cook, do mate, and love.

No responses yet