DEV Community

Cover image for WAX Testnet Setup
Ivan Montiel
Ivan Montiel

Posted on • Edited on

WAX Testnet Setup

Introduction

In this section, we will go over creating a WAX testnet account, fund that account with some WAXP, and then add that account to our Anchor wallet as well as our development wallet.

Creating a testnet user

You will need a testnet account for the rest of the class. While you can create an account easily via the command line when running a local blockchain, we will need to use waxsweden to created a testnet account: https://waxsweden.org/create-testnet-account/.

Create an account

In the example following, I’ll be using an account I created called waxcourse123 since wax names must be 12 characters long.

Once you create an account, save the credentials you are given. Never share these credentials with anyone.

Fund your wallet with WAXP

Now we can also use the waxsweden facet to give our account some testnet WAX.

Go to the same link above ( https://waxsweden.org/create-testnet-account/) and scroll down to “Get some tokens”. Simply enter your account name and you will get some testnet WAX funded to it.

An example link that funds the above wallet I created on the testnet: https://faucet.waxsweden.org/get_token?waxcourse123

Successfully created an account

Add the account to Anchor

Anchor is a desktop wallet and dApp browser for the WAX blockchain. It provides an easy-to-use interface for managing WAX accounts, tokens, and smart contracts, and allows users to securely sign transactions using their private keys. We’ll be using it throughout the tutorials for interacting with our contracts.

Anchor supports both the WAX mainnet and testnet, and is available for Windows, Mac, and Linux.

Go to the Anchor website at https://greymass.com/en/anchor/.

Welcome to Anchor

Click the "Download" button for the version of Anchor you want to install (Windows, Mac, or Linux). Follow the instructions provided by the installer to complete the installation process. Once Anchor is installed, open it and follow the on-screen instructions to create a new WAX account or import an existing one.

Let’s add the account we created on the testnet to Anchor. Add a blockchain, and find the WAX Testnet in the list:

WAX Testnet

Let’s import our private key that we saved into the wallet:

Import Private Key

Add your private key and add the matching account:

Found a match

Success, you’ll see your account and the funds for that account in Anchor!

Successfully added an account

Add your account to your Docker container

While using Anchor is great for interacting with Smart Contracts that have already been deployed, we will need to add our contract to our Docker container that we ran in the previous section so that we can deploy contracts to the testnet instead of our local blockchain.

If you have been following along, then you should have a wallet called testwallet in your Docker container.

We can add our on-chain account to our local wallet by using the following commands:

cleos wallet import -n testwallet --private-key {YOUR ACTIVE_KEY PRIVATE_KEY}

Enter fullscreen mode Exit fullscreen mode

Add your active_key private key from the response you received waxsweden website. Keep your owner keys secure.

You can verify that you now have two active keys in your wallet:

cleos wallet keys
Enter fullscreen mode Exit fullscreen mode

This will list your public keys, which should include your local account and now the newly added account you added.

Real examples

For Dark Emblem NFT, we commonly use testnet accounts to validate our Smart Contract before deploying any changes to the mainnet. This helps us validate that the contract works as expects, and doesn’t contain any security issues – such as accounts being able to run actions they should not have authorization to run.

Conclusion

In this section, we went over creating and funding a testnet account. We added this account to Anchor and to our CLI wallet. We’ll be able to use both of these methods in following sections as we start to built Smart Contracts, deploy them, and interact with them on the web.

Next post: WAX Hello World Smart Contract

E-book

Get this entire WAX tutorial as an e-book on Amazon.

Additional Links

Top comments (0)