Compare commits
No commits in common. "sohail/kitabu-aura" and "master" have entirely different histories.
sohail/kit
...
master
6
.gitignore
vendored
6
.gitignore
vendored
@ -1 +1,5 @@
|
|||||||
data
|
openethereum/.env
|
||||||
|
openethereum/key
|
||||||
|
openethereum/data
|
||||||
|
openethereum/password
|
||||||
|
devops/caddy
|
61
README.md
61
README.md
@ -1,2 +1,61 @@
|
|||||||
# kitabu-chain
|
## Kitabu Chain
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
_This step assumes you have root access on a Debian or Ubuntu based host OS_
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ apt get update
|
||||||
|
$ apt install chrony curl git
|
||||||
|
$ curl -fsSL https://get.docker.com | bash
|
||||||
|
$ curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||||
|
$ chmod +x /usr/local/bin/docker-compose
|
||||||
|
```
|
||||||
|
|
||||||
|
### Validator node setup
|
||||||
|
|
||||||
|
#### 1. Clone this repo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone https://git.grassecon.net/grassrootseconomics/kitabu-chain
|
||||||
|
$ cd kitabu chain
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. Obtain your private key
|
||||||
|
|
||||||
|
If you have an existing keystore file, rename it to `key` else create a new one:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ openethereum account new --base-path=$(pwd)
|
||||||
|
$ mv keys/ethereum/UTC* ./key
|
||||||
|
$ rm -rf keys
|
||||||
|
```
|
||||||
|
|
||||||
|
Save the password of the key created above in a `password` file. Save the key's public address for the next step.
|
||||||
|
|
||||||
|
#### 3. Setup environmental variables and other configs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Edit the `.env` file:
|
||||||
|
|
||||||
|
- `EXT_IP`: Your server's external IP (`curl ifconfig.me`)
|
||||||
|
- `ACCOUNT`: Your private key's public address
|
||||||
|
|
||||||
|
Edit `docker-compose.yml` or `kitabu.toml` to tweak the Openethereum config as per your own preferences.
|
||||||
|
|
||||||
|
#### 4. Start the validator node
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose up
|
||||||
|
# or...
|
||||||
|
$ docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 5. Reverse proxy setup
|
||||||
|
|
||||||
|
The `devops` folder contains a Caddy config to use as a reverse proxy to further control access to your validator node's API.
|
||||||
|
|
||||||
|
Replace `.yourdomain` in the `Caddyfile` and point it to your server IP.
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
// Author: Mohamed Sohail <mohamedsohailazim@gmail.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
pragma solidity >= 0.6.12;
|
|
||||||
|
|
||||||
contract KitabuValidators {
|
|
||||||
address constant SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
|
|
||||||
address public admissionController = 0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65;
|
|
||||||
|
|
||||||
address[] bootstrapValidators = [
|
|
||||||
0x7c5a36Cb43fC87fbB1de46eb6Cfd231c2ADe147b
|
|
||||||
];
|
|
||||||
|
|
||||||
address[] validators;
|
|
||||||
|
|
||||||
bool public finalized;
|
|
||||||
|
|
||||||
mapping(address => uint256) validatorSetIndex;
|
|
||||||
|
|
||||||
event NewAdmissionController(address indexed old, address indexed newController);
|
|
||||||
event InitiateChange(bytes32 indexed parentHash, address[] newSet);
|
|
||||||
event ChangeFinalized(address[] currentSet);
|
|
||||||
|
|
||||||
modifier onlySystemChange {
|
|
||||||
require(msg.sender == SYSTEM_ADDRESS);
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
modifier alreadyFinalized {
|
|
||||||
require(finalized);
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
modifier onlyAdmissionController {
|
|
||||||
require(msg.sender == admissionController);
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
for (uint i = 0; i < bootstrapValidators.length; i++) {
|
|
||||||
validators.push(bootstrapValidators[i]);
|
|
||||||
validatorSetIndex[bootstrapValidators[i]] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
finalized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNewAdmissionController(address newController) public onlyAdmissionController {
|
|
||||||
emit NewAdmissionController(admissionController, newController);
|
|
||||||
admissionController = newController;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getValidators() public view returns(address[] memory) {
|
|
||||||
return validators;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initiateChange() private {
|
|
||||||
finalized = false;
|
|
||||||
emit InitiateChange(blockhash(block.number - 1), getValidators());
|
|
||||||
}
|
|
||||||
|
|
||||||
function finalizeChange() public {
|
|
||||||
finalized = true;
|
|
||||||
emit ChangeFinalized(validators);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function addValidator(address newValidator) public onlyAdmissionController alreadyFinalized{
|
|
||||||
validators.push(newValidator);
|
|
||||||
validatorSetIndex[newValidator] = validators.length - 1;
|
|
||||||
initiateChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeValidator(address exValidator) public onlyAdmissionController alreadyFinalized{
|
|
||||||
orderedRemoval(validatorSetIndex[exValidator]);
|
|
||||||
delete validatorSetIndex[exValidator];
|
|
||||||
initiateChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
function orderedRemoval(uint index) private {
|
|
||||||
for(uint i = index; i < validators.length-1; i++){
|
|
||||||
validators[i] = validators[i+1];
|
|
||||||
}
|
|
||||||
validators.pop();
|
|
||||||
}
|
|
||||||
}
|
|
12
devops/Caddyfile
Normal file
12
devops/Caddyfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
rpc.yourdomain {
|
||||||
|
reverse_proxy openethereum:8545
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.yourdomain {
|
||||||
|
@websockets {
|
||||||
|
header Connection *Upgrade*
|
||||||
|
header Upgrade websocket
|
||||||
|
}
|
||||||
|
|
||||||
|
reverse_proxy @websockets openethereum:8546
|
||||||
|
}
|
17
devops/docker-compose.yml
Normal file
17
devops/docker-compose.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
caddy:
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: caddy
|
||||||
|
image: caddy:2-alpine
|
||||||
|
volumes:
|
||||||
|
- ./Caddyfile:/etc/caddy/Caddyfile
|
||||||
|
- ./caddy/data:/data
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
|
networks:
|
||||||
|
- openethereum_kitabu
|
||||||
|
networks:
|
||||||
|
openethereum_kitabu:
|
||||||
|
external: true
|
2
openethereum/.env.example
Normal file
2
openethereum/.env.example
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
EXT_IP=
|
||||||
|
ACCOUNT=
|
37
openethereum/docker-compose.yml
Normal file
37
openethereum/docker-compose.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
openethereum:
|
||||||
|
init: true
|
||||||
|
user: root
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: kitabu-openethereum
|
||||||
|
image: openethereum/openethereum:v3.3.3
|
||||||
|
command:
|
||||||
|
--config=/root/kitabu.toml
|
||||||
|
--nat='extip:$EXT_IP'
|
||||||
|
--engine-signer='$ACCOUNT'
|
||||||
|
--jsonrpc-port=8545
|
||||||
|
--jsonrpc-cors=all
|
||||||
|
--jsonrpc-interface=all
|
||||||
|
--jsonrpc-hosts=all
|
||||||
|
--jsonrpc-apis=web3,eth,net,parity
|
||||||
|
--ws-port=8546
|
||||||
|
--ws-interface=all
|
||||||
|
--ws-hosts=all
|
||||||
|
volumes:
|
||||||
|
- ./key:/root/data/keys/kitabu_sarafu/key
|
||||||
|
- ./kitabu.json:/root/kitabu.json
|
||||||
|
- ./kitabu.toml:/root/kitabu.toml
|
||||||
|
- ./password:/root/password
|
||||||
|
- ./data:/root/data
|
||||||
|
expose:
|
||||||
|
- '8545'
|
||||||
|
- '8546'
|
||||||
|
ports:
|
||||||
|
- '30303:30303'
|
||||||
|
- '30303:30303/udp'
|
||||||
|
networks:
|
||||||
|
- kitabu
|
||||||
|
networks:
|
||||||
|
kitabu:
|
||||||
|
driver: bridge
|
File diff suppressed because one or more lines are too long
@ -1,47 +1,15 @@
|
|||||||
# File bootnode.toml
|
|
||||||
# enode://2e7f60d1c95e4e5bb0b8e0b60dc2c093d7c270bc80ac9cddf185b33fb59321fb26353d43ef4a623b33f42e90cfdf8dbe0616bb1f6a2ca6189a038f4525146316@159.223.42.214:30303
|
|
||||||
|
|
||||||
[parity]
|
[parity]
|
||||||
chain = "/root/chain-1/kitabu.json"
|
chain = "/root/kitabu.json"
|
||||||
base_path = "/root/chain-1/.openethereum/data"
|
base_path = "/root/data"
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
port = 30303
|
max_peers = 25
|
||||||
#reserved_peers = "/root/chain-2/bootnodes.txt"
|
snapshot_peers = 10
|
||||||
# reserved_only = true
|
|
||||||
max_peers = 10
|
|
||||||
snapshot_peers = 25
|
|
||||||
nat = "extip:178.128.93.108"
|
|
||||||
#nat = "extip:"
|
|
||||||
|
|
||||||
[rpc]
|
|
||||||
port = 8545
|
|
||||||
apis = [
|
|
||||||
"web3",
|
|
||||||
"eth",
|
|
||||||
"net",
|
|
||||||
"personal",
|
|
||||||
"parity",
|
|
||||||
"parity_set",
|
|
||||||
"traces",
|
|
||||||
"rpc",
|
|
||||||
"parity_accounts",
|
|
||||||
]
|
|
||||||
interface = "all"
|
|
||||||
cors = ["*"]
|
|
||||||
|
|
||||||
[websockets]
|
|
||||||
disable = false
|
|
||||||
port = 8546
|
|
||||||
interface = "all"
|
|
||||||
origins = ["all"]
|
|
||||||
|
|
||||||
[account]
|
[account]
|
||||||
password = ["/root/chain-2/kitabu.pwd"]
|
password = ["/root/password"]
|
||||||
|
|
||||||
[mining]
|
[mining]
|
||||||
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
|
|
||||||
engine_signer = "0xcC66240bAdA17eb4C6313FB3FF83e19dfB20C973"
|
|
||||||
reseal_on_txs = "none"
|
reseal_on_txs = "none"
|
||||||
force_sealing = true
|
force_sealing = true
|
||||||
min_gas_price = 1
|
min_gas_price = 1
|
||||||
@ -52,6 +20,3 @@ tracing = "on"
|
|||||||
pruning = "archive"
|
pruning = "archive"
|
||||||
pruning_history = 256
|
pruning_history = 256
|
||||||
cache_size_db = 2000
|
cache_size_db = 2000
|
||||||
|
|
||||||
[misc]
|
|
||||||
log_file = "/root/chain-1/kitabu.log"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user