PREREQUISITES
- Download and install IntelliJ IDEA CE editor.
- JDK 12+
- Create a Hedera account on the portal.
CREATE A TOKEN SMART CONTRACT IN SOLIDITY
- Create a token smart contract in solidity. There is one example_token.sol file with the project which can be modified according to your needs.
- Compile the file using REMIX browser which is used significantly used for compiling .sol files.
- Get the bytecode of the .sol file and save it.
CHANGE THE CREDENTIALS
- Change the .env file variables with your Hedera account credentials (MY_ACCOUNT_ID & MY_PRIVATE_KEY).
CREATE A FILE ON HEDERA NETWORK
- Open PublishFile.java inside the src/main/java folder and replace the byteCodeHex variable with your bytecode of the smart contract compiled with REMIX.
- Run PublishFile.java.
- When it finishes running, it outputs a file id.
- Replace the FILE_ID variable in the .env file with the output.
DEPLOY THE SMART CONTRACT
- Open DeploySmartContract.java inside src/main/java folder.
- Run DeploySmartContract.java.
- When it finishes running, it outputs a smart contract id.
- Replace the CONTRACT_ID variable in the .env file with the output.
CREATE ACCOUNT ON THE HEDERA NETWORK
- Open CreateAccount.java inside src/main/java folder.
- Run CreateAccount.java.
- When it finishes running, it outputs a new account id, private key and public key. Save those results.
- Replace the SECOND_ACCOUNT_ADDRESS variable in the .env file with the account id from the result.
QUERY THE SMART CONTRACT AND TRANSFER TOKENS
- Open QuerySmartContract.java inside src/main/java folder.
- Run QuerySmartContract.java.
- When it finishes running, it outputs the balance of the main account, transfer some tokens to other account and outputs the balance of the other account.
CREATE A TOKEN ON HEDERA NETWORK WITHOUT SOLIDITY SMART CONTRACT
- Open CreateToken.java inside src/main/java folder.
- Run CreateToken.java.
- When it finishes running, it outputs the token id for the token created on the Hedera network.# hederatokenexample