Moonbeam Plugin for Remix
Remix now has a plugin for Moonbeam. This plugin lets Solidity devs build on Moonbeam, and gain access to the greater Polkadot ecosystem.
The instructional part of this article (below) is short because deploying to a Moonbeam chain is pretty straightforward. In fact, the Moonbeam plugin’s design is a streamlined version of the usual Remix development process because the compile and deploy functionality are in a single place.
You may not have heard about Moonbeam…
Moonbeam is an Ethereum-compatible smart contract platform that is a parachain on Polkadot. Existing Ethereum-based projects can port and maintain their protocols without any code changes while continuing to use familiar services and tools (like uhhh Remix).
Moonbeam is not a riff off Frank Zappa’s daughter’s name, Moon Unit. It’s actually a riff off the song Frank Sinatra made popular, Polka Dots and Moonbeams.
You’ve probably heard of Polkadot, but here’s a little blurb…
Polkadot is a Layer Zero metaprotocol that unites heterogeneous shards (AKA parachains). You can’t deploy smart contracts directly to Polkadot, instead you deploy them to parachains, wherein you have access to the entire Polkadot network. And Moonbeam is a popular parachain.
Ethereum and EVM-compatible chains—like Moonbeam and Moonbeam’s Canary chain, Moonriver—use H160 accounts and ECDSA signatures. But the interesting thing is that Polkadot does not use this same account system. So Moonbeam becomes the interface users can employ to interact with Substrate-based assets while still using their existing H160 accounts.
Moonbeam is the name of the Moonbeam network’s parachain on Polkadot. Like Polkadot, Moonbeam was first deployed as a “canarynet” on Kusama called Moonriver. For Moonbeam and Moonriver, you’ll need appropriate tokens to spend on transaction fees. There is a testnet called Moonbase Alpha (which seems not to be named after a song) and new users can get DEV tokens via a faucet.
For those who are interested in building on Moonbeam or Moonriver, go to the documentation site.
Instructions for Using the Moonbeam Plugin in Remix
Activating the Moonbeam Remix Plugin…
- Go to the Plugin Manager tab
- Search for “Moonbeam”
- Press “Activate” and the Moonbeam Remix Plugin will be added directly above the Plugin Manager tab
Once you’ve added the plugin, a Moonbeam logo will appear on the left hand side, representing the Moonbeam Remix Plugin tab.
Getting Started with the Moonbeam Remix Plugin
Grab a contract to work with. You can use one of the default Remix contracts in the contracts folder of a workspace, or if you want to try this process with an ERC-20 contract, generate one with the Open Zeppelin Wizard and click the Open in Remix button.
Then in Remix, go to the Moonbeam plugin to connect to the Moonbase Alpha network by clicking the Connect to Moonbase Alpha button:
Or if you want to connect to the Moonriver network, use the following data in Metamask’s Custom RPC section:
- Network Name: Moonriver
- RPC URL: https://rpc.moonriver.moonbeam.network
- ChainID: 1285 (hex: 0x505)
- Symbol (Optional): MOVR
But for Moonriver, you’ll need its tokens.
Compiling and Deploying in the Moonbeam Plugin
- Press “Connect” to connect your MetaMask to the Remix IDE
- Ensure you’re on the correct network. In this example, we’re on Moonbase Alpha
- Press Compile or choose Auto-Compile if you prefer
- Press Deploy and confirm the transaction in MetaMask
Only four steps — not bad for deploying a contract that will be readable on Polkadot’s network.
Here’s a video by the Moonbeam team, showing the plugin’s operation:
Once the contract is deployed, you’ll see the address and all available read/write methods to interact with it. You might need to scroll down to see the deployed instance:
When using the Moonbeam Remix Plugin, you can switch between using the traditional Remix Compile and Deploy Plugins and the Moonbeam Remix Plugin. The Moonbeam Plugin manages the compilation and deployment, all in the same place.
So try it out, and learn what you can do with this network!