Kaya is Zilliqa's RPC server for testing and development. It is personal blockchain which makes developing application easier and faster. Kaya emulates the Zilliqa's blockchain behavior, and follows the expected server behavior as seen in the zilliqa-js
.
The goal of the project is to support all endpoints in Zilliqa Javascript API, making it easy for app developers to build Dapps on our platform.
Kaya is under development. See roadmap here.
Currently, Kaya supports the following functions:
CreateTransaction
GetTransaction
GetRecentTransactions
GetNetworkID
GetSmartContractState
GetSmartContracts
GetBalance
GetSmartContractInit
GetSmartContractCode
Methods that are NOT supported:
GetDsBlock
GetTxBlock
GetLatestDsBlock
GetLatestTxBlock
In addition, the following features are not supported yet:
- Multi-contract calls
- Events
Install the node packages and dependencies: npm install
Scilla files must be processed using the scilla-interpreter
. The Scilla interpreter executable provides a calling interface that enables users to invoke transitions with specified inputs and obtain outputs.
By default, Kaya RPC uses the remote scilla interpreter to process .scilla
files. You do not have to change any configurations.
You can choose to use your own scilla interpreter locally. To do it, you will have to compile the binary yourself from the scilla repository and transfer it to the correct directory within Kaya RPC.
Instructions:
- Ensure that you have installed the related dependencies: INSTALL.md
- Then, run
make clean; make
- Copy the
scilla-runner
from[SCILLA_DIR]/bin
into[Kaya_DIR]/components/scilla/
- Open
config.js
file and set theconfig.scilla.remote
tofalse
Kaya RPC two modes: normal and debug. The server listens on port 4200
by default. You can change the port through the config.js
file.
npm start
: Normal modenpm run debug
: Enables verbosity mode. Display logs about activities. Useful for debugging
Developers can also start Kaya RPC with accounts from a fixtures
file. The fixture file is configurable through config.js
. If you wish to change this file, you will have to follow the format just like account-fixtures.json
.
To start Kaya RPC with accounts from a file, run one of the following commands:
npm run start:fixtures
: Normal modenpm run debug:fixtures
: Greater verbosity. Shows log trail about server activities.
Recommendation: We recommend running npm run debug:fixtures
. Without account fixtures, accounts will be randomly generated at every run. It can be time consuming to change the private keys and addresses each time.
By default, the data states are non-persistent. Once you shut down the node server, state files and transactions will be deleted.
To enable persistence data, use:
node server.js --save
The file containing the state will be stored in the /data
folder. Blockchain-specific information such as transaction logs are stored in data/save/YYYYMMDDhhmmss_blockchain_states.json
.
You can load the files using:
node server.js --load data/save/YYYYMMDDhhmmss_blockchain_states.json
Some of the functions in Kaya RPC are covered under automated testing using jest
. However, scilla related transactions are not covered through automated testing. To test the CreateTransaction
functionalities, you will have to test it manually.
From test/scripts/
, you can use run node DeployContract.js
to test contract deployment.
Then, use node CreateTransaction --key [private-key] --to [contract_addr]
to make transition calls.
You can use the curl
commands stated in the jsonrpc apidocs to test the rest of the functions.
Use --key
to specify a private key. Otherwise, a random privatekey will be generated.
You can also use the --test
flag, which uses default test configurations:
- Start the server using
npm run debug:fixtures
- Deploy a contract using
node DeployContract.js --test
. - Check where the contract is deployed. It should be on the logs if you have enabled
debug
mode, otherwise you can check it through theGetSmartContracts
method. - Send a transaction using
node CreateTransaction.js --test
kaya is released under GPLv3. See license here