klayr-core
v4.1.5
Published
Klayr blockchain application platform
Downloads
38
Maintainers
Readme
Klayr Core
Klayr is a next-generation crypto-currency and decentralized application platform, written entirely in TypeScript forked from the Lisk application platform. The official documentation about the entire ecosystem can be found at https://docs.klayr.xyz/.
Klayr Core is the program that implements the Klayr Protocol. In other words, Klayr Core is what every machine needs to set-up to run a node that allows for participation in the network.
This document details how to install Klayr Core from source and from npm registry, but there are two other ways to participate in the network: binaries and Docker images. If you have satisfied the requirements from the Pre-Installation section, you can jump directly to the next section Installation Steps.
Index
Installation
Dependencies
The following dependencies need to be installed in order to run applications created with the Klayr SDK:
| Dependencies | Version | | ------------ | ------- | | NodeJS | 18.20.2 |
You can find further details on installing these dependencies in our pre-installation setup guide. Clone the Klayr Core repository using Git and initialize the modules.
From Source
git clone https://github.com/klayrhq/klayr-core.git
cd klayr-core
git checkout main
nvm install
npm i -g yarn
yarn install --frozen-lockfile
npm run build
./bin/run --help
From NPM
$ npm install -g klayr-core
$ klayr-core COMMAND
running command...
$ klayr-core (-v|--version|version)
klayr-core/4.1.5 darwin-x64 node-v18.20.2
$ klayr-core --help [COMMAND]
USAGE
$ klayr-core COMMAND
...
Command Topics
klayr-core autocomplete
- display autocomplete installation instructionsklayr-core block
- Commands relating to Klayr Core blocks.klayr-core blockchain
- Commands relating to Klayr Core blockchain data.klayr-core config
- Commands relating to Klayr Core node configuration.klayr-core console
- Klayr interactive REPL session to run commands.klayr-core endpoint
- Invokes the provided endpoint.klayr-core generator
- Disable block generation for given validator address.klayr-core genesis-block
- Creates genesis block file.klayr-core hash-onion
- Create hash onions to be used by the forger.klayr-core help
- Display help for klayr-core.klayr-core keys
- Return keys corresponding to the given passphrase.klayr-core passphrase
- Commands relating to Klayr Core passphrases.klayr-core sdk
- Commands relating to Klayr SDK development.klayr-core start
- Start Blockchain Node.klayr-core system
- Commands relating to Klayr Core node.klayr-core transaction
- Commands relating to Klayr Core transactions.klayr-core version
Managing Klayr Node
System requirements
The following system requirements are recommended for validator nodes:
Memory
- Machines with a minimum of 8 GB RAM for the Mainnet.
- Machines with a minimum of 8 GB RAM for the Testnet.
Storage
- Machines with a minimum of 40 GB HDD.
OS
- Ubuntu 22
- Ubuntu 20
- MacOS 13
To start a Klayr Core node as a background process, we recommend using a process management tool, such as PM2.
Example using PM2
nvm install
npm i -g pm2
pm2 start "klayr-core start" --name klayr-mainnet
pm2 status
pm2 logs klayr-mainnet
For a more advanced options refer to PM2 documentation.
Configuring Klayr Node
klayr-core start
supports flag and environment variable options to configure a node.
In addition, custom configuration through the JSON file can be made available through the --config, -c
flag.
NOTE: As a security measure, access to all the methods on the node over the IPC and HTTP API by default are disabled. To allow access, the
rpc.allowedMethods
property within the custom node config file may be configured as shown below.
rpc.allowedMethods: ["system_getNodeInfo"]
- Expose specific methodsrpc.allowedMethods: ["system", "token"]
- Expose all the registered methods under the specified namespacesrpc.allowedMethods: ["*"]
- Expose all available registered methods under all the namespaces
Example
With custom config file ./custom-config.json
below:
{
"system": {
"dataPath": "~/.klayr",
"logLevel": "debug",
"keepEventsForHeights": -1
},
"rpc": {
"modes": ["ipc"],
"port": 7887,
"host": "127.0.0.1",
"allowedMethods": ["*"]
},
"generator": {
"keys": {
"fromFile": "./config/dev-validators.json"
}
},
"network": {
"port": 7667,
},
"transactionPool": {
"maxTransactions": 8096,
"maxTransactionsPerAccount": 1024,
},
"plugins": {
"reportMisbehavior": {
"encryptedPrivateKey": "kdf=argon2id&cipher=aes-256-gcm&version=1&ciphertext=fb564e463ce46efab010f21b06d01acc62f705049563b58628d4ca23053ba6bdce5be39cb5c0624bd75735ee10a8a12b9c7876d86fc3646d036b414701dc6b01217102480cd327f5eec31b2cf209ea8b6c64505ab8bab81ed315c12c33feaaef982facec63c876def26eeefd1c0d9a5b7dce5e604622c704106a64c27b71eff7&mac=429c65daf7f6e9dba5e105be55fb7a450c74e424ff9a20cd5cb614c31fb8b010&salt=19a15ea6d5925d7104b4db0c8b0ca73a&iv=b5ec03e61586b202a1f4e9aa&tag=82ca4b682f89daa642a13edae085feea&iterations=1¶llelism=4&memorySize=2024"
},
"chainConnector": {
"receivingChainIPCPath": "~/.klayr/sidechain",
"ccuFee": "5000000",
"encryptedPrivateKey": "kdf=argon2id&cipher=aes-256-gcm&version=1&ciphertext=f962147c16450604456db731156a31b5fa07bc1a55c32f243f59795414b75fbfcbe13a54426976c98fe21c0a9d918b80fb956d280ceff8a7ca35db29eb77ecfd0afbd359233a863425766815c84d5d20ba17ca0edd07e0eacaa3324e53ade573f7f647097dffaf64368cf40be05636bee58318389843d1f29b587d58c71e34ab&mac=bbe4120b758ba7c541cfb39d1ea9b6a781054cdaffbd4b5e724d375fc5367543&salt=20fdfa08a8e6d158fc1f8b70672f43aa&iv=22cb20bdf0a9f06124a7b53a&tag=37cbecb09493581e476dd4439e8ef1fc&iterations=1¶llelism=4&memorySize=2024",
"password": "lisk"
}
},
}
Running a command will overwrite the default config and use the specified options.
klayr-core start -n devnet -c ./custom-config.json --overwrite-config
For a more detailed understanding of configuration read this online documentation.
Tests
Automated tests
All automated tests will run with the below command.
npm test
Running a local development node
In order to run a node for a local test, in a root folder of klayr-core, run below command.
./bin/run start -n devnet --data-path ./devnet-data --port 3333 --api-ipc --enable-forger-plugin
This command will start a klayr-core node using data path ./devnet-data
with Forger Plugins.
Data on the node can be obtained by commands like
./bin/run endpoint invoke system_getNodeInfo --pretty
./bin/run system node-info --data-path ./devnet-data
./bin/run block:get 3 --data-path ./devnet-data
Contributors
https://github.com/klayrhq/klayr-core/graphs/contributors
License
Copyright 2024 Klayr Holding BV. Copyright 2016-2024 Lisk Foundation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.