Skip to content

holyblock/eosio-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploying C++ Smart Contract to WAX Blockchain

This guide provides step-by-step instructions to deploy a C++ smart contract to the WAX blockchain.

Prerequisites

  1. Install EOSIO software: You need the EOSIO software installed on your system.
  2. Install Nodeos: Nodeos is the core service daemon that runs an EOSIO blockchain.
  3. Install CMake: CMake is used to build the smart contract.
  4. Install CDT (Contract Development Toolkit): EOSIO.CDT is a suite of tools used to build EOSIO smart contracts.

Steps to Deploy C++ Smart Contract to WAX Blockchain

1. Set up WAX Blockchain Environment

  • Set up a local or testnet environment using Nodeos.
  • Create a WAX account and obtain WAX tokens for deployment fees.

2. Write the Smart Contract

Write your smart contract in C++. Ensure it follows EOSIO standards. Example:

#include <eosio/eosio.hpp>

using namespace eosio;

class [[eosio::contract]] example : public contract {
public:
   using contract::contract;

   [[eosio::action]]
   void hi(name user) {
      print("Hello, ", user);
   }
};

EOSIO_DISPATCH(example, (hi))

3. Compile the Smart Contract

Use EOSIO.CDT to compile the smart contract.

eosio-cpp -o example.wasm example.cpp --abigen

4. Deploy the Smart Contract

Deploy the contract using Cleos (command-line tool for interacting with EOSIO-based blockchains).

cleos -u https://testnet.waxsweden.org set contract <account> <path_to_compiled_contract>

5. Test the Smart Contract

Interact with the contract using Cleos or any other tool that allows interaction with the blockchain.

cleos -u https://testnet.waxsweden.org push action youraccount hi '["yourwaxaccount"]' -p youraccount@active

Additional Tools

  • EOSIO.CDT (Contract Development Toolkit): A comprehensive suite for developing EOSIO-based smart contracts.
  • Cleos: Command-line interface for interacting with EOSIO-based blockchains.
  • EOS Studio: An integrated development environment (IDE) specifically for EOSIO smart contract development.
  • Scatter: A wallet and toolkit that can be used for development.
  • Bloks.io: A block explorer and interface that provides interaction capabilities.

Notes

  • Ensure you replace <account> and <path_to_compiled_contract> with your actual account name and path to the compiled contract file.
  • For more information and detailed documentation, refer to the EOSIO Documentation.

  • How to Build -

    • cd to 'build' directory
    • run the command 'cmake ..'
    • run the command 'make'
  • After build -

    • The built smart contract is under the 'waxel' directory in the 'build' directory
    • You can then do a 'set contract' action with 'cleos' and point in to the './build/waxel' directory
  • Additions to CMake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

Generated on {datetime.now().strftime('%Y-%m-%d')}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages