WAX Testnet Setup
Tags: wax, blockchain, tutorial
Published: 2023-07-22 02:49:03

## 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/](https://waxsweden.org/create-testnet-account/).


![Create an account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0od1l2exr0oj3ymz17f9.png)


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/](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](https://faucet.waxsweden.org/get_token?waxcourse123)


![Successfully created an account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lhexzsajpvfhme2b6l2.png)



## 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/](https://greymass.com/en/anchor/).


![Welcome to Anchor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmnqmgou7g6zv48x1b4b.png)


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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cbd8cyv39nkxfh2e9j8.png)

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

![Import Private Key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n83m7dm46i6bybi5t14m.png)

Add your private key and add the matching account:


![Found a match](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/noe7d354ql65nggzzk0d.png)


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

![Successfully added an account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rroii4jbk33e4cpmy6d.png)


## 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:

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

```

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:

```cpp
cleos wallet keys
```

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](https://dev.to/idmontie/wax-hello-world-contract-c72)

## E-book

Get this entire WAX tutorial as an [e-book on Amazon](https://amzn.to/3ZjwaK7).

## Additional Links

- [Create a testnet account](https://waxsweden.org/create-testnet-account/)
- Photo by [Goran Ivos](https://unsplash.com/@goran_ivos?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/photos/idmvPhF8t4E?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)