WAX Testnet Quickstart
In this guide, you’ll learn how to create Testnet accounts and deploy your smart contracts to the WAX Testnet.
Tip: Every smart contract requires a blockchain account. It’s recommended that you name your accounts based on your smart contract’s functionality (e.g., mywaxnftgame). Account names must be 12 characters and only contain letters [a-z] and numbers [1-5].
Create and Fund Testnet Accounts
-
Create a Testnet Account. Save your private and public keys in a safe place.
-
From the Testnet homepage, get free WAX Tokens to fund your new account.
-
To deploy your smart contracts, you’ll need to create a wallet using your public and private keys. You can use the wallet features on Bloks.io, or use our Docker images to manage your wallet.
To create a wallet from a Docker container, use the
cleos wallet
command:cleos rm -f ~/eosio-wallet/{account.name}.wallet && cleos wallet create -n {account.name} --to-console && cleos wallet import -n {account.name} --private-key {active.privatekey} && cleos wallet import -n {account.name} --private-key {owner.privatekey}
Store your wallet password in a safe place - you’ll need it to run blockchain commands.
-
Once you have a wallet configured with your Testnet account, you can stake NET, CPU, and RAM from Bloks.io or your Docker container.
Buy RAM:
cleos -u https://testnet.waxsweden.org system buyram {account.name} {account.name} "3.00000000 WAX"
Stake NET and CPU (to yourself, from the same account):
cleos -u https://testnet.waxsweden.org system delegatebw {account.name} {account.name} "4.00000000 WAX" "5.00000000 WAX"
Deploy Smart Contracts to the WAX Testnet
Tip: To complete these steps, make sure that your wallet is opened and unlocked. Refer to Troubleshooting below for more information.
-
From an interactive Docker bash session, navigate to your smart contracts directory and build your smart contract.
eosio-cpp -abigen waxnft.cpp -o waxnft.wasm
-
If you’re calling external contract actions from your smart contract (e.g., WAX RNG or Simple Assets), make sure to elevate your account permissions:
cleos -u https://testnet.waxsweden.org set account permission {account.name} active --add-code
-
Deploy. From the command line, set your contract with the
cleos set contract
command:cleos -u https://testnet.waxsweden.org set contract {account.name} $(pwd) waxnft.wasm waxnft.abi
Your smart contract is now live on the WAX Testnet!
Troubleshooting
If you receive wallet and/or authorization errors, you may need to open and unlock your wallet:
cleos wallet open -n {account.name} &&
cleos wallet unlock -n {account.name} --password {wallet.pwd}