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. Using cleos or an EOSIO compatible wallet, create a new public/private key pair for your smart contract.

    
    cleos wallet create_key
    
  2. From the command line, use cleos system newaccount. The example below uses dAppWAXacct1 as the primary WAX Account holder and creates a new smart contract account named waxrng.

    
    cleos -u https://chain.wax.io system newaccount dAppWAXacct1 waxrng EOS7jEb46pDiWvA39faCoFn3jUdn6LfL51irdXbvfpuSko86iNU5x --stake-net '0.50000000 WAX' --stake-cpu '0.50000000 WAX' --buy-ram-kbytes 32
    
  3. To run the inline requestrand action on the orng.wax smart contract, you’ll need to give your new [email protected] 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 https://chain.wax.io set account permission waxrng active --add-code
    

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

    
     cleos -u https://chain.wax.io get account waxrng
    

    The active permission now displays the new [email protected] permission.

    
    created: 2019-08-22T16:13:29.500
    permissions:
     owner     1:    1 EOS7jEb46pDiWvA39faCoFn3jUdn6LfL51irdXbvfpuSko86iNU5x
     active    1:    1 EOS7jEb46pDiWvA39faCoFn3jUdn6LfL51irdXbvfpuSko86iNU5x, 1 [email protected]
    
  4. Finally, set your contract with the cleos set contract command:

    
    cleos -u https://chain.wax.io set contract waxrng mycontracts/waxrng/build/waxrng waxrng.wasm waxrng.abi