Written by: andrej.rakic

Moonbase Alpha Deployment


Moonbeam is a Smart Contract Parachain on Polkadot. Moonbeam provides a full EVM implementation, a Web3-compatible API, and bridges that connect Moonbeam to existing Ethereum networks. This allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes.

Moonbase Alpha is a testnet on Moonbeam. Moonbase Alpha has two endpoints available for users to connect to it: one for HTTPS and one for WSS.

HTTPS DNS: https://rpc.testnet.moonbeam.network  

WSS DNS: wss://wss.testnet.moonbeam.network   (It’s a valid link)

There are three main ways to deploy a smart contract to Moonbase Alpha Testnet:

01 Using Remix IDE

02 Using Truffle & deploy-script.js

03 Using Moonbeam Truffle Box

But, before any deployment one needs to claim some amount of DEV tokens.

00 Claim DEV token (Faucet)

Tokens on Moonbase Alpha, named DEV, needs to be issued on demand via Discord bot

They created a Discord bot that will automatically send a maximum of 10 DEV tokens per hour (per Discord user) when you enter your address. 

To get DEV tokens enter

!faucet send <enter-address-here->

To check your balance enter

!balance <enter-address-here->

01 Deploy Using Remix IDE

First connect your Metamask wallet to Moonbase Alpha testnet using this parameters:

– Network Name: Moonbase Alpha 

– New RPC URL: https://rpc.testnet.moonbeam.network

– ChainID: 43 

– Symbol: DEV

– Block Explorer URL: http://8.9.36.141:4000

https://expedition.dev/?rpcUrl=https%3A%2F%2Frpc.testnet.moonbeam.network (additional Block Explorer)

After that 

  • Navigate to Remix IDE,
  • Connect it with Metamask’s account which is connected to Moonbase Alpha and has some amount of DEV tokens,
  • Compile smart contract
  • Deploy it using Injected Web3 Environment 

Keep in mind that gas price equals 0 DEV for deployment on Moonbase Alpha.

To verify & publish source code on Moonbeam Block Explorer, one need several info:

  • Contract Name
  • Include nightly builds [YES/NO]
  • Compiler
  • EVM Version
  • Optimization [YES/NO]
  • If YES, Optimization runs  (In Remix is 200 by default)
  • Smart Contract Source Code
  • If needed, ABI-encoded Constructor Arguments (Recommended tool)

02 Deploy Using deploy-script.js

  • Init project with Truffle.
  • Write your smart contract.
  • Compile it using truffle compile command.
  • Deploy it using this script. ( node deploy-script.js )
  • Change <CONTRACT_NAME>.json with name of your contract from build folder (after truffle compile)
  • Change <PRIVATE_KEY> with private key of wallet with amount of DEV tokens
  • Change <WALLET_ADDRESS> with address of wallet with amount of DEV tokens

Keep in mind that gas price equals 0 DEV for deployment on Moonbase Alpha.

To verify & publish source code on Moonbeam Block Explorer, one need several info:

  • Contract Name
  • Include nightly builds [YES/NO]
  • Compiler
  • EVM Version
  • Optimization [YES/NO]
  • If YES, Optimization runs  (In Remix is 200 by default)
  • Smart Contract Source Code
  • If needed, ABI-encoded Constructor Arguments (Recommended tool)

03 Deploy Using Moonbeam Truffle Box

⚠️ works only on node version v10.23.0 and later

To get started with the Moonbeam Truffle box, one needs to have Truffle installed globally.

Execute next command:

truffle unbox PureStake/moonbeam-truffle-box

The box is pre-configured with two networks: dev (for a standalone node) and moonbase (Moonbeam TestNet). Included as well, as an example, is an ERC20 token contract, and a simple test script. 

The truffle-config.js file also includes the private key of the genesis account for the standalone node is included as well, the address associated with this key holds all the tokens in this development environment.

For deployments in the Moonbase Alpha TestNet, you need to provide the private key of an address that holds funds.

To deploy smart contract execute next two commands:

  • truffle compile
  • truffle migrate –network moonbase

They are using a custom provider programmed by themselves, instead of the most common ones such as hdwallet-provider. 

The reason behind this is because their custom chain ID was not being included by the library used to sign the transactions. Therefore, the signature is invalid because the chain ID in the transaction blob is missing, and the transaction is rejected. 

Keep in mind that gas price equals 0 DEV for deployment on Moonbase Alpha.

To verify & publish source code on Moonbeam Block Explorer, one need several info:

  • Contract Name
  • Include nightly builds [YES/NO]
  • Compiler
  • EVM Version
  • Optimization [YES/NO]
  • If YES, Optimization runs  (In Remix is 200 by default)
  • Smart Contract Source Code
  • If needed, ABI-encoded Constructor Arguments (Recommended tool)

Final Thoughts: Which one to choose?

It’s really up to you and your preferences. If you are more comfortable deploying your smart contracts using Remix IDE or similar “UI-like” solution, then method number 01 is definitely the best for you.

However, if you are more familiar with truffle framework and deployments via terminal, I strongly recommend the third approach, using pre-configured official Moonbeam Truffle box.

And of course, if you just want a one-click deployment using our custom node.js script, then feel free to go with the second approach.


Guides, articles, and news
Uncategorized

RWA Marketplace Validation Use Case – Tokenized RWAs are yet to take off

As the bull market kicks off, we are seeing exciting new trends taking over the market from DePINs, tokenized RWA,

Uncategorized

ZKSIM – Revolutionizing ZK Circuit Testing

The development of zero-knowledge (ZK) circuits is an intricate process, with testing posing a considerable challenge that often extends timelines

Uncategorized

FHE Project comparison

As the adoption of this transformative technology continues to grow, so does the emergence of innovative projects harnessing its capabilities.

get in touch