Posts

Moonbeam Upgrades Its TestNet to Moonbase Alpha v5

Introduces a Staking Mechanism and Adds Significant Infrastructure and User Experience Improvements.

Boston, MA – January 21, 2021 – Moonbeam, the Ethereum-compatible smart contract platform on Polkadot, announced today a new version of its TestNet, Moonbase Alpha. This latest version introduces significant infrastructure updates and adds staking features, opening the door for collators that actively participate in producing blocks on the network. This update is an essential step toward the launch of Moonriver, the network’s Kusama deployment, which is currently expected in late March 2021. 

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to create multi-chain applications. By minimizing the changes required to run existing Solidity smart contracts, Ethereum devs can replicate their dApps and implement them on Moonbeam using familiar developer tools like MetaMask, Truffle, Remix, among others.

The staking mechanism being introduced for testing and development purposes only powers the selection of collators and protocol level rewards for providing collation services to the network. The Moonbeam team continues to work on other technical improvements designed to make it easier for Ethereum based projects to expand to Polkadot:

  • Improvement in the gas computation.
  • Support for querying pending transactions while they are yet to be processed.
  • Queries that accept multiple addresses for past events.

Moonbase Alpha v5 also includes significant improvements to the TestNet infrastructure. It can now support externally accessible full nodes and collators, enabling partners and users to participate in the network directly. Additionally, it also includes improvements to the quality of the code, standardization of libraries, and optimizations, making it 15-50 times faster than the previous version.

The complete list of updates included in Moonbase Alpha v5 can be found here.

Moonbeam Alpha was created for development purposes; the engineering team will continue to develop and improve it. More information on Moonbase Alpha, including the features currently available, can be found on the project documentation site.

Learn how to get started by joining our Discord channel or visiting the project website: moonbeam.network.

 

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently, in active development by PureStake, Moonbeam is expected to reach MainNet by mid-2021. Learn more: https://moonbeam.network/.

 

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder, and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/.

 

Moonbeam Announces Grant Program

Open registrations for projects that develop Web3 software and contribute to the growth of the Moonbeam ecosystem.

Boston, MA – January 04, 2021 – Moonbeam, the Ethereum-compatible smart contract platform on Polkadot, announced the Moonbeam Grants Program today. The Moonbeam Grants Program is part of Moonbeam’s multi-chain vision. This program aims to fund Web3 software development and projects that contribute to the growth of the Moonbeam ecosystem.

Moonbeam is a smart contract platform that makes the implementation process easier for Ethereum developers and projects that want to expand to Polkadot. By minimizing the changes required to run existing Solidity smart contracts on the new network, Ethereum projects can simply replicate their dApp and deploy it to Moonbeam using MetaMask, Truffle, Remix, and other familiar tools.

The Moonbeam Grants program is looking for passionate teams that want to contribute to Web3 applications and projects that significantly impact the growth of the Moonbeam ecosystem. There are two categories of projects that can apply:

  • Tools and infrastructure: Projects that support tools and infrastructure development that other Moonbeam developers need. The program is also looking for projects that can fill existing tool gaps to increase the portfolio of tools and maximize benefits for users. Some examples include wallets, browsers, and API services.
  • Ecosystem projects: Projects that support the development of the ecosystem in Moonbeam through a wide range of use cases such as DeFi, NFT, identity, games, insurance, and more. This category aims to seed the Moonbeam ecosystem by providing useful services and utility on the web.

These are some benefits that the Moonbeam Grant Program offers:

  • Funding with native Moonbeam tokens (Glimmer – GLMR). The token is not released yet.
  • Developer tools and resources.
  • Communication and direct support.
  • End to end support from the building process to the technical and commercial strategy.
  • Recognition as Grant Winner.

Registrations for the first cohort of projects are now open until the end of March 2021. Learn more about the program and apply here.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/

Moonbeam and Band Protocol Team Up to Bring Secure, Scalable Oracle to Polkadot

Developers Building on Moonbeam Can Now Request Data
From the Decentralized Oracle Infrastructure of Band Protocol

Boston, MA – December 22, 2020 – Moonbeam, the Ethereum-compatible smart contract platform on Polkadot, has implemented Band Protocol as a decentralized oracle in its TestNet. The Sequoia Capital-backed Band Protocol specializes as a scalable cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.

This implementation brings significant benefits to developers building on the Moonbase Alpha TestNet, who will now have access to Band Protocol-based oracle data and be able to request data to integrate into their applications.

The Moonbeam smart contract platform team is continuously working to simplify the implementation process for Ethereum developers who want to expand to Polkadot. By integrating Band Protocol into Moonbeam, developers will be able to retrieve institutional-grade data from premium, secure providers including Brave New Coin and CryptoCompare, among others. With the Band Protocol implementation, Moonbeam developers will be able to:

  • Get asset prices for a long list of supported tokens from a standard dataset currently supporting price feeds for over 125+ crypto assets, two commodities (gold and silver) and 13 exchange rates.
  • Query data through the Band Protocol smart contracts on Moonbeam by implementing the StdReference contract interface, which exposes the getReferenceData and getReferenceDataBulk functions.
  • Use the JavaScript auxiliary library, which bypasses the blockchain and fetches data directly from the Band Protocol API.

Moonbeam chose to integrate Band Protocol for a number of reasons:

  • Customer Demand for a Decentralized Oracle Network With Reputable Validator Nodes
    The BandChain decentralized oracle network is secured by 71 validator nodes composed of the top blockchain enterprises, DevOps, and security firms.
  • Developer Friendliness & Blockchain Agnostic Nature
    Band Protocol offers a plug-n-play solution for developers to connect to their own customized oracle scripts or obtain premium quality price data secured by a publicly verifiable oracle network.
  • Scalable & Easily Customizable Oracles
    Band Protocol has a highly modular and flexible design, allowing developers and teams building on Moonbeam to create custom decentralized oracles on BandChain, specify any external data source to connect to (including premium and paywall APIs), and update intervals or security parameters.

The Moonbeam team has also created new tutorials for the Band Protocol integration, demonstrating how to leverage the new oracle system using Moonbase Alpha, Moonbeam’s TestNet. The tutorials are available on the official documentation site.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/

Moonbeam Integrates Chainlink Into TestNet

Moonbeam Network Has Integrated the Chainlink Oracle Network on TestNet

Developers on Moonbeam Can Now Use Chainlink Oracles
with Solidity Smart Contracts on Polkadot Parachain

Boston, MA – December 17, 2020 – PureStake, the company developing the Moonbeam smart contract platform, has completed an integration of Chainlink into the Moonbeam TestNet environment. This integration brings Chainlink’s market-leading oracle functionality to Moonbeam, enabling developers to build smart contracts using any external data resource—all without leaving the Polkadot ecosystem. The initial integration includes the deployment of Chainlink’s widely used Price Feeds on Moonbeam, giving dApps access to the largest collection of on-chain market data backed by secure, reliable, and already live decentralized oracle networks.

Chainlink is the most widely-adopted oracle network on Ethereum and an essential DeFi infrastructure component. By deploying Chainlink to the Moonbeam TestNet — and eventually to its Kusama and Polkadot parachain deployments — new protocols launching in the Moonbeam ecosystem will have built-in access to Chainlink.

As a TestNet integration, projects are able to:

To learn more about the Chainlink integration, view the tutorials on the Moonbeam documentation website.

The integration of Chainlink Price Feeds on Moonbeam provides developers with a multitude of key features needed for DeFi applications, including:

  • High-Quality Data: Price data is sourced from premium off-chain data aggregators, allowing users to mitigate flash loans as each price point reflects a volume-adjusted aggregate from all trading environments as opposed to a single exchange.
  • Secure Oracle Nodes: Oracle networks are made up of independent, security-reviewed nodes run by leading security and blockchain DevOps teams, protecting users against Sybil attacks.
  • Decentralized Computation: Each Price Feed is decentralized at the oracle and data source level, leading to highly available and manipulation resistant data and oracle services.
  • Proven Oracle Infrastructure: Chainlink secures billions of dollars in value for top DeFi applications, proving its ability to secure real value live on MainNet.

“Moonbeam has quickly become a destination for Solidity projects that want to easily expand to Polkadot,” said Derek Yoo, CEO of PureStake and head of the Moonbeam project. “The integration of Chainlink’s decentralized technology adds significant functionality to our smart contract platform and gives developers immediate access to secure and reliable price data for their DeFi applications.”

Since Moonbeam was designed as an easy on-ramp to Polkadot with complete Ethereum compatibility, the existing Chainlink smart contracts were able to be deployed to the Moonbeam TestNet without the need for refactoring or changes. This is made possible by Moonbeam’s additional support for Solidity smart contracts that goes beyond the EVM to include Ethereum-standard tools, account formats, and signatures. Once parachain functionality is live on Polkadot, this will allow Solidity developers to re-deploy existing contracts to the network without hiring new developers or significantly rewriting their codebase.

To start building on the Moonbeam TestNet, Moonbase Alpha, visit the official project documentation site or join us on our Discord server.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/

About Chainlink

Chainlink is the most widely used and secure way to power universal smart contracts. With Chainlink, developers can connect any blockchain with high-quality data sources from other blockchains as well as real-world data. Managed by a global, decentralized community of hundreds of thousands of people, Chainlink is introducing a fairer model for contracts. Its network currently secures billions of dollars in value for smart contracts across the decentralized finance (DeFi), insurance and gaming ecosystems, among others.

Chainlink is trusted by hundreds of organizations to deliver definitive truth via secure, reliable data feeds. To learn more, visit chain.link, subscribe to the Chainlink newsletter, and follow @chainlink on Twitter.

Docs | Discord | Reddit | YouTube | Telegram | Events | GitHub | Price Feeds | DeFi | VRF

Moonbeam Launches Ambassador Program

Registration open for community members who want to be part of the Moonbeam Project.

Boston, MA – November 25, 2020 – PureStake, the company that develops the Moonbeam smart contract platform, announced the Moonbeam Ambassador Program today. This program is open to all people who are part of the Ethereum, Polkadot, and other ecosystems that want to be part of the Moonbeam Project.

The Moonbeam project aims to make building web3 projects on Polkadot as convenient as possible. It is a platform that helps Ethereum-based projects pursue a multi-chain deployment strategy, extending their application to Polkadot by leveraging their existing codebase and using familiar tools.

The Moonbeam Ambassador Program is for community members who want to be part of the Moonbeam Project and its development. Join the Moonbeam Ambassador Program if you:

  • Are passionate and believe in Polkadot.
  • Want access to the team building Moonbeam.
  • Are interested in networking with other people in the Polkadot community.
  • Are excited to impact the growth of the Moonbeam network.

Moonbeam Ambassadors can directly contribute to the success of the network in both technical and non-technical ways, including:

  • Organizing meetups around the globe
  • Contributing code or contributing to project documentation
  • Running workshops for dApp developers who are considering Moonbeam
  • Designing infographics to help amplify the message and positioning
  • Writing blogs about Moonbeam, your project, or the larger multi-chain vision

We’re now accepting applications.  Click here to learn more and apply to the Moonbeam Ambassador Program.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently, in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder, and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/.

Moonbeam Truffle Box Now Available for Solidity Developers

Helps Ethereum Projects Quickly Deploy Smart Contracts to Moonbeam

Boston, MA – November 3, 2020PureStake, the company developing the Moonbeam smart contract platform, has launched the Moonbeam Truffle Box. Truffle is one of the most popular development tools on Ethereum, and Truffle Boxes are pre-configured packages that help reduce the time it takes to create and deploy code to supported networks. With this release, developers will use a boilerplate setup on Truffle to quickly extend their project to Moonbeam.

Moonbeam, an Ethereum-compatible smart contract platform on the Polkadot network, makes it easy to build multi-chain applications. With the Moonbeam Truffle Box, Ethereum developers can easily deploy smart contracts on Moonbeam, opening new user experiences and assets. Devs will leverage Truffle’s development environment that also offers a testing framework (with Mocha and Chai) and a full asset pipeline on Moonbeam. 

The Moonbeam Truffle Box is pre-configured with two networks: dev (for a standalone Moonbeam node) and Moonbase (for the Moonbase Alpha TestNet). An example ERC-20 token contract and simple test script is included as well as examples. The setup will feel familiar to users that have experience with Truffle. 

Moonbeam Truffle Box has also incorporated the Moonbeam Truffle plugin, a quick and easy solution to start developing in local environments, by introducing support for a docker based standalone node image. It streamlines the process of setting up a local node, which can take up to 40 minutes when building its binary from source.

Click here to get started and learn how to use the Moonbeam Truffle Box.

See a Demo of the Moonbeam Truffle Box at TruffleCon 2020!

Moonbeam is an official sponsor of TruffleCon 2020. As part of our “Making a dApp Multi-Chain: Deploying Solidity Smart Contracts to Moonbeam” talk on Saturday, November 7, we will be showcasing the new Moonbeam Truffle Box. Alberto Viera and Joshy Orndorff from the PureStake team will be presenting. Register for free to watch this and other developer-focused talks: https://trfl.co/tcon2020.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/

Moonbeam Monthly Dispatch: October 2020

We’ve got a lot of news this month, so let’s dive in.

Moonbase Alpha TestNet Upgrade

We introduced the Moonbase Alpha TestNet three weeks ago, and now we’re releasing our first feature upgrade.

Announced yesterday, Moonbase Alpha v2 adds several new features, including publish-subscribe capabilities and precompiles.

This functionality is a big step forward in making our smart contract platform as similar to Ethereum as possible. By minimizing the changes needed to run existing Solidity smart contracts on the new network, Ethereum projects can simply replicate their dApp and deploy it to Moonbeam using Truffle, Remix, and other popular developer tools.

Pub/Sub

Publish-subscribe is an asynchronous messaging service that acts as a middleware between the publishers of messages, and applications that subscribe to them. Commonly referred to as pub/sub, this messaging pattern makes it possible for dApps, like wallets and block explorers, to receive updates about on-chain transactions, balances, and other critical data without needing to issue new queries.

Check out a recent blog that dives into this functionality in more detail.

Precompiled Contracts

Moonbase Alpha now includes some of the precompiled contracts that are natively available on Ethereum: ecrecover, sha256, ripemd-160 and the identity function. If you’d like to learn how to use them, I recommend this tutorial from my colleague Alberto.

You can find the full release notes for Moonbase Alpha v2 here.

SushiSwap Proposal Progresses to Next Stage

You may have seen our recent proposal to extend Sushiswap to Polkadot via Moonbeam. A Moonbeam-based SushiSwap deployment would make DOT, KSM, and other Polkadot-based assets available to users of the platform. We received significantly positive feedback on this proposal, and are progressing to the next stage.

For the unacquainted, SushiSwap is an Ethereum-based DEX that has created an amazing community, achieved significant market presence, and attracted a large amount of liquidity in a very short amount of time. We see SushiSwap as a testament to the power of blockchains to create and organize new kinds of grassroots-led communities.

The next stage will involve a Sushi-weighted community vote, followed by a grant and deployment milestones (assuming the vote is successful).

Welcome Aboard, Joshy Orndorff

If you’ve been following Polkadot for the past couple of years, you’ve likely attended a live or virtual event featuring Joshy Orndorff, a developer advocate at Parity.

We’ve been fortunate enough to bring Joshy into the fold as a Senior Blockchain Engineer for Moonbeam. While his main focus will be on development, he will continue to speak and present at ecosystem events. Feel free to drop him a line on our Discord server.

Speaking of which…

Upcoming Events

Our dance card is full for the next month. Here’s where you can catch us giving a behind-the-scenes look at Moonbeam.

Sub0 – October 15, 2020

Parity’s twice-yearly developer conference dedicated to the Substrate framework.

Join us for a workshop showcasing how to build an Ethereum-compatible blockchain on Substrate, including a deep-dive into the Frontier project which we helped build.

Register for Free

 

 

Web3 Forum – October 29-30, 2020

An in-person event (they still exist!) in Shanghai showcasing what’s happening in Web3.

Our CEO, Derek Yoo, will appear via video to talk about how Moonbeam is making it easier than ever to bring Ethereum applications into the Polkadot ecosystem.

Register Now

 

 

 

TruffleCon – November 6-7, 2020

The premier event for blockchain developers dedicated to tooling and technology.

We’re sponsoring TruffleCon this year, and we’re thrilled to be hosting a talk on Moonbeam. Join us to learn more about how easy the path from Ethereum to Moonbeam can be (using Truffle).

Sign Up for Free

 

 

You can keep track of which events we’re attending here: https://moonbeam.network/events/

Gitcoin Bounties: Hello World! By Polkadot

On Thursday, the Web3 Foundation team is kicking off the Hello World! By Polkadot competition on Gitcoin, offering DOT and KSM for completing up to 23 challenges ranging from beginner to advanced, including Moonbeam challenges!

Categories and Prizes

In total, there are 23 different challenges over four categories: 7 Beginner, 3 Intermediate, 4 Advanced and 9 Ecosystem. Ecosystem challenges include Moonbeam, Acala, Phala, and Plasm. All challenges will come with extensive resources to guide you along the way.

Each challenge has been capped at maximum 50 submissions, so move quickly to be in the first 50 valid submissions to get your prize. Prizes per challenge are as follows:

  • Beginner – 3 DOT
  • Intermediate – 1 KSM
  • Advanced – 10 DOT
  • Ecosystem Challenges – 5 DOT

There will also be an extra prize for the first 50 people that manage to complete 18 or more challenges: 150 DOT!

Head over to Gitcoin to sign up.

That’s it for this month! As always, you can keep in touch via Discord, Twitter, or our email newsletter (sign up below).

Subscribe to This Newsletter

Want to receive these updates via email? Enter your email below to sign up for our Moonbeam Monthly Dispatch newsletter.

Moonbase Alpha Now Available with Pub-Sub

Moonbeam Network Upgrades TestNet to Moonbase Alpha v2

Introduces Ethereum-Style Publish-Subscribe Capabilities

Boston, MA – October 13, 2020 – PureStake, the company developing the Moonbeam smart contract platform, has released the latest version of its TestNet, Moonbase Alpha, and added new functionality that includes publish-subscribe support for the Web3 RPC. This marks the first significant upgrade and feature release since Moonbase Alpha was introduced three weeks ago.

Currently in active development, Moonbeam is a smart contract platform that aims to simplify the deployment process for Ethereum developers that want to expand to Polkadot. By minimizing the changes needed to run existing Solidity smart contracts on the new network, Ethereum projects can simply replicate their dApp and deploy it to Moonbeam using Truffle, Remix, and other popular developer tools.

The publish-subscribe functionality closes the last significant functional gap in Moonbeam creating an Ethereum-like environment. Commonly referred to as pub/sub, this messaging pattern makes it possible for dApps, like wallets and block explorers, to receive updates about on-chain transactions, balances, and other critical data without needing to issue new queries.

In total, the new functionality introduced in Moonbase Alpha v2 includes:

  • Event subscription support (pub/sub) in the Web3 RPC, which is commonly used by dApp developers
  • Support for pre-compiles including ecrecover, sha256, ripemd160, and the identity function
  • GPLv3 licenses

You can find the full release notes here.

Moonbase Alpha was created purely for development purposes — it will continue to undergo development and enhancements from our engineering team. More information about Moonbase Alpha, including the currently available features and architecture, can be found on the project documentation site: docs.moonbeam.network/networks/testnet/.

Learn how to get started by joining our Discord or visiting the project website: moonbeam.network.

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/

Moonbase Alpha Now Available with Pub-Sub

New in Moonbase Alpha v2: Contract Events and Pub/Sub Capabilities

With the release of Moonbase Alpha v2, which was just announced by PureStake, we are adding some new and exciting features that help Moonbeam move closer to its primary goal of providing a seamless experience for projects from Ethereum on the Polkadot ecosystem. One of the main features being added is the ability to subscribe to Ethereum smart contracts events, and other blockchain information.

Contract events are a super important part of dApps in Ethereum, as they facilitate communication between smart contracts and their user interfaces. Events can be considered asynchronous triggers with data. When a contract emits an event, this can subsequently result in an action on the front-end side.

Use Cases for Events

A simple example of an event you could track is a transfer. Let’s say a transfer is initiated by a user using the front-end of a dApp, where a transaction hash is obtained once this is submitted. But to assure the user that the payment was sent, the dApp can listen for an event (emitted by the contract) when the transaction is committed to the blockchain. This can consequently trigger a display message to the user notifying them that their action was successful.

Another powerful use case of events is cheaper storage. On average, logs cost 8 gas per byte, whereas contract storage costs 20,000 gas per 32 bytes. Therefore, events can serve as a tool to save and retrieve necessary information such as transfer logs as well. However, they can’t be used as storage for all use cases, because they can’t be accessed by other smart contracts, for example.

The Significance of Pub/Sub

Given all this context, now we are ready to talk about pub/sub.

Publish-subscribe, or pub/sub for short, is an asynchronous messaging service that acts as a middleware between the publishers of messages, and people that subscribe to them. In general terms, publishers categorize these messages into classes and publish them without really knowing who is subscribed to them. Similarly, subscribers enroll in the classes that are of interest, receiving only messages associated with that class, without knowing who their publisher is.

With the release of Moonbase Alpha v2, a pub/sub service compatible with Ethereum-style events is now available.

Tutorial: How to Use Pub/Sub on Moonbeam

Since a picture is worth a thousand words, let’s jump into some examples to showcase how pub/sub works on Moonbeam.

To follow this demo, you will need the following:

    • Have MetaMask installed and connected to Moonbase
    • Have an account with funds, which you can get from Mission Control
    • Deploy your own ERC20 token on Moonbase, which you can do following our Remix tutorial but first pointing MetaMask to Moonbase
    • Install NodeJS and the Web3 JS library. For systems on Ubuntu 18.04 or similar, you can follow the first part of this tutorial

Subscribing to Event Logs in Moonbase Alpha v2

Any contract that follows the ERC-20 token standard emits an event related to a transfer of tokens, that is, event Transfer(address indexed from, address indexed to, uint256 value). For this example, we will subscribe to the logs of such events. Using the Web3 JS library, we need the following piece of code:

const Web3 = require('web3');
const web3 = new Web3('wss://wss.testnet.moonbeam.network');

web3.eth.subscribe('logs', {
    address: 'ContractAddress',
    topics: ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef']
}, (error, result) => {
    if (error)
        console.error(error);
})
    .on("connected", function (subscriptionId) {
        console.log(subscriptionId);
    })
    .on("data", function (log) {
        console.log(log);
    });

Note that we are connecting to the WebSocket endpoint of Moonbase Alpha. We use the web3.eth.subscribe(‘logs’, options [, callback]) method to subscribe to the logs, filtered by the given options. In our case, the options are the contract’s address where the events are emitted from, and the topics used to describe the event. More information about topics can be found in this Medium post. If no topics are included, you subscribe to all events emitted by the contract. But in order to filter only the Transfer event, we need to include the signature of the event, calculated as:

EventSignature = keccak256(Transfer(address,address,uint256))

The result of the previous calculation is what’s shown in the code snippet from before. We’ll go back to filtering by topics later on. The rest of the code handles the callback function. Once we execute this code, we’ll get a subscription ID, and the terminal will wait for any event through that subscription:

Next, an ERC20 token transfer will be sent with the following parameters:

  • From address: 0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b
  • To address: 0xfcB0B397BB28046C01be6A3d66c7Eda99Fb0f344
  • Value (tokens): 10000000000000000000 – that is 10 with 18 zeros

Once we send the transaction, the log of the event emitted by the transaction will appear in the terminal:

A lot of information is provided in the logs, but you might ask yourself: where is the information in the emitted event? And the answer is: in the logs!

Our target event sends two pieces of indexed information, the “from” and “to” addresses (in that order), which are treated like topics. The other piece of data shared by our event is the number of tokens, that is not indexed. Therefore, there is a total of three topics (the maximum is four), which correspond to the opcode LOG3:

Consequently, you can see that the “from” and “to” addresses are contained inside the topics returned by the logs. Ethereum addresses are 40 hex characters long (1 hex character is 4 bits, hence 160 bits or H160 format). Thus, the extra 24 zeros are needed to fill the gap to H256, which are 64 hex characters long.

What about the number of tokens? Unindexed data is returned in the “data” field of the logs, but this is encoded in bytes32/hex. To decode it we can use for example, this online tool, and verify that the “data” is in fact 10 (plus 18 zeros).

If the event returns multiple unindexed values, these will be appended one after the other in the same order the event emits them. Therefore, each value is then obtained by deconstructing data into separate 32 bytes (or 64 hex character long) pieces.

This example showed how we could subscribe only to event logs of a specific contract. But the Web3 JS library provides other subscription types that we’ll go over in the following sections.

Subscribe to Incoming Pending Transactions

In order to subscribe to pending transactions, we can use the web3.eth.subscribe(‘pendingTransactions’, [, callback]) method, implementing the same callback function to check for the response. This is much simpler than our previous example, and it returns the transaction hash of the pending transactions.

We can verify that this transaction hash is the same as that shown in MetaMask (or Remix).

Subscribe to Incoming Block Headers

Another type available under the Web3 JS library is to subscribe to new block headers. To do so, we use the web3.eth.subscribe('newBlockHeaders' [, callback]) method, implementing the same callback function to check for the response. This subscription provides incoming block headers and can be used to track changes in the blockchain.

Note that only one block header is shown in the image. These messages are displayed for every block produced, so they can fill up the terminal quite quickly.

Check If the Node is Synchronized With the Network

With pub/sub it is also possible to check whether a particular node, which you are subscribed to, is currently synchronized with the network. For that, we can leverage the web3.eth.subscribe(‘syncing' [, callback]) method, implementing the same callback function to check for the response. This subscription will return an object when the node is synced with the network.

Current Limitations

The pub/sub implementation in Frontier is still in active development. This first version allows dApp developers (or users in general) to subscribe to specific event types, but there are still some limitations. From the previous examples, you might have noticed that some of the fields are not showing proper information, and that is because certain properties are yet to be supported by Frontier.

Another limitation is related to the logs of the event. On Ethereum, you can use wildcards and pass in multiple input addresses, for example, to filter specific logs. Let’s say we would like to subscribe to all events of a contract that have two specific addresses in the “topic_1” field (remember that topic_0 is reserved to the event signature). Then we could pass in the following topic as input:

topics: [null, [address1, address2]]

Here, by using the wildcard null in place for the event signature, we are listening to all events emitted by the contract that we subscribed to. But with this configuration, we can also use a second input field, that is topic_1, to define a filter by address as mentioned before.

The current Frontier implementation does not support these features. As an alternative, you can create multiple subscriptions for all the events of the contract and the different addresses, but this increases the number of operations to be carried out. However, this is expected to be supported in future versions of the Moonbase TestNet.

Contact Us

If you have any feedback regarding the Moonbase Alpha v2, pub/sub, or any other Moonbeam related topic, feel free to reach out through our official development Discord server.

Moonbeam Funding Announcement

PureStake Closes $1.4M Seed Round for Moonbeam Network

Company Will Use Funding to Launch the Ethereum-Compatible
Smart Contract Platform as a Parachain on Polkadot

Boston, MA – September 23, 2020 – PureStake, the company developing the Moonbeam smart contract platform, announced the completion of a $1.4 million seed round led by Hypersphere Ventures, a venture firm focused on Polkadot founded by Polkadot co-founder Robert Habermeier. Other notable participants include Arrington XRP Capital, HashKey, KR1, Bitcoin.com Exchange, and Du Capital. The funding will be used to accelerate development of the Moonbeam network, a Polkadot parachain focused on interoperability.

“Polkadot was designed to enable the creation of many blockchains, each one specialized and optimized for specific purposes,” says Robert Habermeier, Co-Founder of the Polkadot Network and Partner at Hypersphere Ventures. “Moonbeam is a great example of this principle: their smart contract platform is specialized to be accessible to a large segment of developers already familiar with Ethereum developer tools and will serve as an on-ramp to Polkadot for this community.”

BetProtocol, an Esports betting and crypto-casino protocol, will develop an implementation of their system on the Moonbeam Kusama and Polkadot networks, to allow entrepreneurs to launch blockchain betting apps with no coding required.

“Moonbeam gives us quick and easy access to users and assets in the quickly-growing Polkadot ecosystem,” says Rui Pedro Teixeira, Co-Founder of BetProtocol. “And we can develop our application using Solidity and Web3 — skills we already have — rather than needing to learn Rust and develop our own parachain using Substrate.”

Linear Finance, the first cross-chain compatible, decentralized delta-one asset protocol, is also working on projects that will leverage Moonbeam smart contracts.

“We are truly impressed by the Moonbeam team’s technological expertise in cross-chain integration and easy-to-use developer tools that allow us to quickly integrate and deploy on Polkadot with the existing Ethereum codebase,” said Drey Ng, Co-Founder and Product Lead at Linear Finance. “Users can enjoy a familiar dApp environment with a better user experience. We are excited for this partnership and see long-term value in this collaboration.”

Announced earlier this year and currently in active development, Moonbeam is a smart contract platform on Polkadot that is focused on Ethereum compatibility. This compatibility includes the ability to run Solidity smart contracts and applications built using the Web3 API. Further, Moonbeam supports popular Ethereum development tools like Truffle, Remix, and MetaMask, which allows Ethereum developers to quickly deploy applications to the Polkadot network.

The Moonbeam team received a grant from the Web3 Foundation in August 2020 for their work developing a Web3-compatible RPC library.

“From the start, we’ve been inspired by the idea of an open, interoperable blockchain ecosystem,” says Derek Yoo, CEO of PureStake. “The growth we’ve seen in our community and this investment are both expressions of support for the vision of a multi-chain future. We will be using these funds to expand the team and to help us deliver a strong Polkadot MainNet deployment next year.”

Moonbeam launched its first TestNet earlier this year and expects to deliver a parachain deployment on Polkadot in Q2 2021.

Visit the Moonbeam website for more information and updates: https://moonbeam.network/

About the Moonbeam Network

Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by early 2021. Learn more: https://moonbeam.network/

About PureStake

PureStake’s team has extensive experience building technology companies and complex software platforms. Led by Derek Yoo, former Fuze Founder and CTO, PureStake provides protocol implementation services and creates developer tools for next-generation blockchain networks. Learn more: https://www.purestake.com/