Earlier this year, the world’s leading cryptocurrency wallet and browser extension, MetaMask, announced Snaps. Built for safety with Agoric Hardened JavaScript, Snaps provide an open, modular approach to extending MetaMask by allowing third parties to add new features like support for entirely new blockchain ecosystems to the wallet’s existing infrastructure. Today, Snaps were released publicly, including a Cosmos Snap that allows MetaMask’s more than thirty million users to quickly and easily access the interchain through the wallet’s familiar interface.
"Snaps is MetaMask's answer to the obviously growing demand their users have for cross-chain accessibility. The team trusted Agoric Hardened JavaScript to ensure Snaps can safely extend their wallet's capabilities. We're eager to see the impact Snaps will have on both the Cosmos and Ethereum ecosystems." - Dean Tribble, CEO of Agoric OpCo
MetaMask allows users to manage, store, and interact with Ethereum-based cryptocurrencies and applications directly from their web browser. It provides users with a secure way to create and manage Ethereum wallets, send and receive ETH and other tokens on the network, making it easier for users to engage with DeFi platforms, NFT marketplaces, and other web3 services. Users can install the MetaMask extension in their browser, set up a wallet, and then use it to interact with smart contracts and applications. Now that same frictionless setup experience is available for anyone who wishes to explore the Cosmos.
Keeping Snaps Extensible but Secure with Agoric Hardened JavaScript
With the introduction of Snaps, the MetaMask platform was open for developers to extend by building programs or customizations. Because Snaps can be developed by anyone, they are classified as “untrusted JavaScript programs that execute safely inside the MetaMask application.” These JavaScript programs can add new API connections, modify existing features, and add support for new blockchain protocols like the Cosmos Snap.
With that much power, MetaMask needed to ensure Snaps didn’t expose users to new vulnerabilities.
The answer? Snaps are isolated from the rest of the MetaMask application in a “fully virtualizable” execution environment built using Hardened JavaScript, the JavaScript framework developed for the Agoric network (occasionally referred to as SES or Secure EcmaScript). Agoric’s scripting language lets MetaMask restrict access to global JavaScript APIs and keep untrusted code separate from other parts of the application. Therefore, Snaps only have access to a limited set of permissions, determined by the user at installation. Hardened JavaScript provided the safe foundation necessary for MetaMask to build Snaps with confidence.
Learn more about Hardened JavaScript, the safer web3 development language
After you read the full announcement from MetaMask, try the Cosmos Snap for yourself, get up to speed on the principles underlying Hardened JavaScript in this video series from Agoric OpCo’s Chief Scientist, Mark S. Miller. Don’t forget to subscribe to the Agoric Developer Newsletter for the latest updates and resources for building blockchain apps with our programmable Hardened JavaScript smart contracts.