Skip to content

Deploy Your WAX RNG Contract

In this example, we'll use WAX-CDT tools to deploy your Lucky Number Generator smart contract. Refer to WAX-CDT Deploy for more information.

  1. First we will need to create a self-custodied account on testnet or mainnet to deploy the smart contract. For our example we will assume that the account is called mywaxrngtest.

Note: You can use the WAXSweden team tools to create the testnet account and supply it with funds that you will need to purchase the RAM required for the smart contract deployment. :::

  1. From Docker, we open and unlock the wallet we created in the tutorials about how to create the development environment.
cleos wallet open -n mywallet && cleos wallet unlock -n mywallet --password {wallet.pwd}

and import the mywaxrngtest active private key

cleos wallet import --private-key {mywaxrngtest_active_private_key}
  1. To run the inline requestrand action on the orng.wax smart contract, you'll need to give your new mywaxrngtest@active permission the additional eosio.code permission. This permission enhances security and allows your smart contract to send inline actions. From the command line, run the cleos set account permission command, and include the literal --add-code parameter.
cleos -u [chain-api-url] set account permission mywaxrngtest active --add-code

To verify the new permission, use the cleos get account command:

cleos -u [chain-api-url] get account mywaxrngtest
  1. Buy some RAM to depoy the smart contract:
cleos -u [chain-api-url] push action eosio buyram '["mywaxrngtest", "mywaxrngtest", "200.00000000 WAX"]' -p mywaxrngtest@active
  1. Finally, set your contract with the cleos set contract command:
cleos -u [chain-api-url] set contract mywaxrngtest mycontracts/rngtest/build/rngtest -p mywaxrngtest@active