HAVAH is a blockchain engine based on ICON. Basic operations such as smart contract creation and distribution, transaction request, and json-RPC interworking are the same as those of ICON.
This document contains the guide for testnet access information and smart contract creation.
HAVAH writes smart contracts in the same way as ICON Java SCORE.
Please check the HAVAH Smart Contract sample document first.
Refer to the document below for the Smart Contract API and utility library (scorex) used when writing smart contracts.
build.gradle
dependencies {
implementation 'foundation.icon:javaee-scorex:0.5.3'
}
optimizedJar {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Only allowed Java methods can be used when writing smart contracts. A list of allow methods can be found at the link below.
Also, you can refer to the ICON JAVA SCORE tutorials.
-
Java Tutorial Part 1: Setting Development Environment and Writing Smart Contract
-
Java Tutorial Part 2: Deploying the Smart Contract and Interacting with the Smart Contract Onchain
HAVAH Scan is block explorer that can check all transactions and blocks, address and token information that occur in the HAVAH blockchain.
If you implement name() in a smart contract, the name of that smart contract will be displayed in the code tab of HAVAH Scan. The name is displayed up to 256 characters.
@External(readonly=true)
public String name() {
return "KIKI Trip";
}
For FT and NFT contracts, a token symbol is displayed after the name.
It is recommended that the length of the smart contract API name be less than 30 characters. In HAVAH Scan, API names are displayed up to 30 characters.
When revert is triggered by calling Context.revert(int,String), an error code and error message can be passed. The error code is displayed in the Status when checking the transaction in HAVAH Scan.
- Reverted(0) : The number in () is the error code passed as the first parameter when calling Context.revert(int,String).
- uint(0x20) : This is the error code delivered by the engine when revert occurs, and the default value is 32 (0x20). When calling revert(), if an error code specified by the user is passed, the value of 32 + the user's error code is passed.
Currently, there is no dedicated SDK for HAVAH. Integration is possible using the ICON SDK.
To use the JSON-RPC API, please refer to the link below.
- https://docs.icon.community/operate-icon/how-to-use-the-json-rpc-api
- https://github.com/havah-project/goloop-havah/blob/main/doc/jsonrpc_v3.md
Vega is the name of the HAVAH testnet. Access information is as follows.
-
JSON-RPC API endpoint
-
nid (network id)
- 0x101
-
Block Explorer (HAVAH Scan)
-
Faucet
The access information of HAVAH mainnet is as follows.
-
JSON-RPC API endpoint
-
nid (network id)
- 0x100
-
Block Explorer (HAVAH Scan)
HAVAH blockchain nodes can be operated using Docker images.
-
HAVAH chain node docker
A keystore file can be created using the goloop CLI. See link below.
Or refer to Tips, 'How to create a keystore file with a private key'.
Due to the delegated nature of the ICON network, there are currently two different types of nodes: API Endpoints and Validators. API Endpoints are also called Citizen nodes.
- Stores full blockchain state
- Read capabilities
- Provides data to users
- Stores full blockchain state
- Read / write capabilities
- Provides data to API Endpoints and other validators
For more information on node types, please refer to the link below.
For information on BTP (Blockchain Transmission Protocol), please refer to the link below.
-
Building in a windows WSL + ubuntu environment, the run directory must be located in the Ubuntu filesystem, not below /mnt/c
-
If the javaee/exec/build/native/ folder is empty after make in the project folder, you need to create a native file by proceeding make in javaee/
-
How to create a keystore file with a private key:
-
Install ICONex chrome web browser extenstion.
-
Select ICONex - 'Access My Wallet' - 'Add Wallets'
-
Select 'Load Wallet' in the Add Wallet dialog.
- Select 'Enter private key' in the Load Wallet dialog.
- Select 'ICON (ICX)' and enter the private key.
- Select the 'Backup wallet' menu of the wallet.
-
Enter Wallet password.
-
You can download the keystore file by selecting 'Download Keystore file(wallet backup file)'.
- Remove BOM from keystore file.
sed -i '' '1s/^\xEF\xBB\xBF//' keystore.json
-
-
When sending a transaction using the goloop CLI tool, you need to add the --estimate option to get an estimated step.
goloop rpc sendtx transfer \
--uri http://localhost:9080/api/v3 \
--key_store ./data/keystore_gov.json --key_password gochain \
--nid 0x110 --step_limit 1000000 \
--to hxb6b5791be0b5ef67063b3c10b840fb81514db2fd \
--estimate \
--value 20000000000000000000
- Transation fee is calculated as step price * number of steps. To get the estimated fee, multiply the stepprice by the estimated step found with the --estimate option. The step price can be obtained by calling getStepPrice of Chain Score (cx0000000000000000000000000000000000000000).
goloop rpc call --to cx0000000000000000000000000000000000000000 \
--uri http://localhost:9080/api/v3 \
--method getStepPrice
Please refer to the ICON DEV PORTAL for more information.