Skip to content

WAX-CDT Deploy

In this guide, you'll use the cleos set contract command to deploy your smart contract to the WAX mainnet.

Before you begin, you'll need to compile your smart contract and have your WASM and ABI files ready. Refer to Smart Contract Quickstartor WAX-CDT Build Toolsfor more information.

You'll also need to:

  • Create a self-managed WAX Blockchain Account.
  • Make sure you have enough WAX staked in your account to allocate resources.

To deploy your smart contract to the WAX mainnet:

  1. Open and unlock your wallet.

    shell
    cleos wallet open -n mywallet && cleos wallet unlock -n mywallet --password {wallet.pwd}
  2. Generate a public/private key pair that's used to create your smart contract's blockchain account. From the command line, use the cleos create key command:

    shell
    cleos wallet create_key -n mywallet

TIP

You can also use an EOSIO compatible wallet (e.g., Scatter).

  1. From the command line, use cleos system newaccount to create your smart contract's account. To run this command, you'll need to have the proper authority. This means that the wallet containing your primary account must be opened and unlocked.

    ParameterExampleDescription
    -u-u chain-api-urlThis is the WAX Blockchain URL.
    systemsystemSends the system contract action to the WAX Blockchain.
    newaccountnewaccountCommand to create a new account.
    primaryAccountwaxdappacct1Your self-managed WAX Blockchain Account with staked WAX tokens.
    contractAccountHelloWorld10Name of your smart contract's account. Exactly 12 characters from (a-z1-5).
    newPublicKeyEOS7jEb46pDiWvA39faCoFn3jUdn6LfL51irdXbvfpuSko86iNU5xThis is the public key you created in Step 1.
    stake-net--stake-net '0.50000000 WAX'Amount of WAX to stake for NET.
    stake-cpu--stake-cpu '0.50000000 WAX'Amount of WAX to allocate for CPU.
    buy-ram-kbytes--buy-ram-kbytes 32Amount of RAM to allocate.

    Example

    shell
    cleos -u chain-api-url system newaccount waxdappacct1 HelloWorld10 EOS7jEb46pDiWvA39faCoFn3jUdn6LfL51irdXbvfpuSko86iNU5x --stake-net '0.50000000 WAX' --stake-cpu '0.50000000 WAX' --buy-ram-kbytes 32

TIP

You'll need to repeat Steps 1 and 2 for each of your contracts.

  1. Deploy. From the command line, set your contract with the cleos set contract command:

    ParameterExampleDescription
    -u-u chain-api-urlThis is the WAX Blockchain URL.
    contractAccountHelloWorld10Your smart contract's account (created in Step 2).
    fullPathd/wax-blockchain/wax-cdt/mycontracts/wax/buildThe full path to your WASM and ABI files.
    wasmNamewaxName of your WASM file.
    abiNamewaxName of your ABI file.
    shell
    cleos -u chain-api-url set contract HelloWorld10 d/wax-blockchain/wax-cdt/mycontracts/wax/build wax.wasm wax.abi

Your dApp is now live on WAX!

TIP

Depending on how your dApp's onboarding process is built, your customers may need to create a WAX Account to use your dApp on WAX.