Compare commits
No commits in common. "master" and "sohail/kitabu-aura" have entirely different histories.
master
...
sohail/kit
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,5 +1 @@
|
|||||||
openethereum/.env
|
data
|
||||||
openethereum/key
|
|
||||||
openethereum/data
|
|
||||||
openethereum/password
|
|
||||||
devops/caddy
|
|
61
README.md
61
README.md
@ -1,61 +1,2 @@
|
|||||||
## 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.
|
|
||||||
|
86
contracts/validators/KitabuValidators.sol
Normal file
86
contracts/validators/KitabuValidators.sol
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
rpc.yourdomain {
|
|
||||||
reverse_proxy openethereum:8545
|
|
||||||
}
|
|
||||||
|
|
||||||
ws.yourdomain {
|
|
||||||
@websockets {
|
|
||||||
header Connection *Upgrade*
|
|
||||||
header Upgrade websocket
|
|
||||||
}
|
|
||||||
|
|
||||||
reverse_proxy @websockets openethereum:8546
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
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
|
|
@ -1,2 +0,0 @@
|
|||||||
EXT_IP=
|
|
||||||
ACCOUNT=
|
|
@ -1,37 +0,0 @@
|
|||||||
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,15 +1,47 @@
|
|||||||
|
# File bootnode.toml
|
||||||
|
# enode://2e7f60d1c95e4e5bb0b8e0b60dc2c093d7c270bc80ac9cddf185b33fb59321fb26353d43ef4a623b33f42e90cfdf8dbe0616bb1f6a2ca6189a038f4525146316@159.223.42.214:30303
|
||||||
|
|
||||||
[parity]
|
[parity]
|
||||||
chain = "/root/kitabu.json"
|
chain = "/root/chain-1/kitabu.json"
|
||||||
base_path = "/root/data"
|
base_path = "/root/chain-1/.openethereum/data"
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
max_peers = 25
|
port = 30303
|
||||||
snapshot_peers = 10
|
#reserved_peers = "/root/chain-2/bootnodes.txt"
|
||||||
|
# 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/password"]
|
password = ["/root/chain-2/kitabu.pwd"]
|
||||||
|
|
||||||
[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
|
||||||
@ -20,3 +52,6 @@ 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