diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..7e9dce422 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +variables: + GO_INSTALL_VERSION: go1.17.1 + +stages: + - build + +build-job: + image: ubuntu:18.04 + stage: build + rules: + - if: $CI_COMMIT_TAG + before_script: + - apt update && apt install curl git make gcc musl-dev python3 python3-pip -y + - pip3 install awscli + - aws --version + + script: + - curl -L https://golang.org/dl/$GO_INSTALL_VERSION.linux-amd64.tar.gz | tar -C /usr/local -xvz + - export PATH=$PATH:/usr/local/go/bin + - make geth + - tar -cvzf /tmp/geth.tar.gz build/bin/geth + - ls /tmp + - aws s3 ls + - aws s3 cp /tmp/geth.tar.gz s3://$AWS_S3_BUCKET/$CI_COMMIT_TAG/geth-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz + diff --git a/CHANGELOG.md b/CHANGELOG.md index 14764a63e..f4ef2da7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ # Changelog -## v1.1.0-bkc (Erawan) +## v1.1.0-bkc (Erawan) ### Description v1.1.0-bkc is a **hard fork** release. -v1.1.0-bkc brings **Erawan hard fork** which changes the consensus mechanism from **POA** to **POSA**. The Erawan hard fork is scheduled to occur at block #0000000 on the Bitkub Chain Mainnet (~ August 4th, 2021). +v1.1.0-bkc brings **Erawan hard fork** which changes the consensus mechanism from **PoA** to **PoSA**. The Erawan hard fork is scheduled to occur at block **5519559** on the Bitkub Chain Mainnet (Mar 31th, 2022). -**Users of Bitkubchain must upgrade to this release before the Erawan hard-fork activates to remain in consensus**. +**Users of Bitkub chain must upgrade to this release before the Erawan hard-fork activates to remain in consensus**. ### Changes * Add Erawan hard fork chain configuration and checkpoint function @@ -17,4 +17,4 @@ v1.1.0-bkc brings **Erawan hard fork** which changes the consensus mechanism fro * Use ```Mix.Digest``` instead of ```Coinbase``` for voting signer * Use ```Coinbase```(inherited from miner.etherbase) for store the beneficiary address (the address that received the block reward) -***Note***: All of the changes will be backward compatible ith official go-ethereum until block number reach the ```erawanBlock```. Node runner both Validator node and RPC node must upgrade their geth binary and re-initialize genesis file (erawanBlock enabled) before ```erawanBlock``` to prevent the BAD Blockw +***Note***: All of the changes will be backward compatible with official go-ethereum until block number reach the ```erawanBlock```. Node runner both Validator node and RPC node must upgrade their geth binary and re-initialize genesis file (erawanBlock enabled) before ```erawanBlock``` to prevent the BAD Block \ No newline at end of file diff --git a/README.md b/README.md index f882b333a..d781f69b0 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,48 @@ # Bitkub Chain +Bitkub Chain is an infrastructure of an ecosystem using decentralized technology “Blockchain” which allows anyone to interact with decentralized applications or their digital assets with a very low transaction fee, high-speed confirmation time, trustless and transparency to everyone. -Bitkub Chain is a fork of go-ethereum. When the chain start, it adopts Proof of Authority (PoA) consensus mechanism to allow short block time. Bitkub Chain will soon introduce Proof of Staked Authority (PoSA) according to the published [whitepaper](https://www.bitkubchain.com/docs/EN_Bitkub_Chain_WhitePaper_V2.1.pdf). +Bitkub Chain is a fork of go-ethereum. When the chain starts, it adopts Proof of Authority (PoA) consensus mechanism to allow short block time. Bitkub Chain will soon introduce Proof of Staked Authority (PoSA) according to the published [whitepaper](https://www.bitkubchain.com/docs/EN_Bitkub_Chain_WhitePaper_V2.1.pdf). ## Proof of Staked Authority -The PoSA of Bitkub Chain is composed of two parts. The first part is a set of smart contracts which handle staking and distributing reward. The second part is an extended version of go-ethereum's Clique consensus (PoA). Making it be able to send block's reward to the smart contract. +The PoSA of Bitkub Chain comprises of two parts. The first part is a set of smart contract which handle staking and distributing reward. The second part is an extended version of go-ethereum's Clique consensus (PoA) to make it able to send block's reward to the smart contract. -## Building the source +## Compile the binary -For prerequisites and detailed build instructions please read the [Installation Instructions](https://geth.ethereum.org/docs/install-and-build/installing-geth). +Building `geth` requires both a Go (version 1.17 or later) and a C compiler. You can install them using your favourite package manager. -Building `geth` requires both a Go (version 1.14 or later) and a C compiler. You can install -them using your favourite package manager. Once the dependencies are installed run +* Install Go ```shell -make geth +rm -rf /usr/local/go && curl -L https://golang.google.cn/dl/go1.17.6.linux-amd64.tar.gz | tar -C /usr/local -xz +export PATH=$PATH:/usr/local/go/bin ``` -or, to build the full suite of utilities: +* Clone bkc repository + +```shell +# Will be changed to github +git clone https://gitlab.com/bitkub-blockchain/bitkub-chain/bkc.git && cd bkc +``` +* Build geth binary ```shell -make all +make geth +mv ./build/bin/geth /usr/local/bin/ ``` +## Run from the binary +The binary for a linux x86 architecture is provided in [release](https://github.com/bitkub-chain/bkc/releases/tag/v1.1.0-bkc) + + +## Executables + +The bkc project comes with executable found in the `cmd` directory. + +| Command | Description | +| :-----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **`geth`** | Our Bitkub Chain CLI client. It is the entry point into the BKC network (main-, test- or private net), capable of running as a full node (default), archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the BKC network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` and the [CLI page](https://geth.ethereum.org/docs/interface/command-line-options) for command line options. | + ## Running `geth` Going through all the possible command line flags is out of scope here (please consult our @@ -30,33 +50,86 @@ Going through all the possible command line flags is out of scope here (please c but we've enumerated a few common parameter combos to get you up to speed quickly on how you can run your own `geth` instance. -### Hardware Requirements - -the hardware must meet certain requirements to run a full node. - +### Hardware Requirements (recommended) - 12 vCPUs - 48 GiB of RAM - 1 TB of Data Disk (SSD) IOPS: 20,000 - Suggest m5zn.3xlarge instance type on AWS, or c2-standard-16 on Google cloud. - A broadband Internet connection with upload/download speeds of at least 50 megabyte per second +#### Security Group & Firewall Rules +##### Allow Inbound +- Protocol - TCP & UDP +- Port - 30303 +- Source IP - 0.0.0.0/0 + +##### Network Bandwidth +- 50 Mbps/Sec + + ```shell $ geth console ``` This command will: - * Start `geth` in snap sync mode (default, can be changed with the `--syncmode` flag), - causing it to download more data in exchange for avoiding processing the entire history - of the Bitkub Chain network, which is very CPU intensive. - * Start up `geth`'s built-in interactive [JavaScript console](https://geth.ethereum.org/docs/interface/javascript-console), - (via the trailing `console` subcommand) through which you can interact using [`web3` methods](https://github.com/ChainSafe/web3.js/blob/0.20.7/DOCUMENTATION.md) - (note: the `web3` version bundled within `geth` is very old, and not up to date with official docs), - as well as `geth`'s own [management APIs](https://geth.ethereum.org/docs/rpc/server). - This tool is optional and if you leave it out you can always attach to an already running - `geth` instance with `geth attach`. + * Start `geth` in snap sync mode (default, can be changed with the `--syncmode` flag), causing it to download more data in exchange for avoiding processing the entire history of the Bitkub Chain network, which is very CPU intensive. + * Start up `geth`'s built-in interactive [JavaScript console](https://geth.ethereum.org/docs/interface/javascript-console), (via the trailing `console` subcommand) through which you can interact using [`web3` methods](https://github.com/ChainSafe/web3.js/blob/0.20.7/DOCUMENTATION.md) (note: the `web3` version bundled within `geth` is very old, and not up to date with official docs), as well as `geth`'s own [management APIs](https://geth.ethereum.org/docs/rpc/server). This tool is optional and if you leave it out you can always attach to an already running `geth` instance with `geth attach`. ### A node on the Bitkub Chain network -More details about how to run in [bkc-node](https://github.com/bitkub-blockchain/bkc-node). +Download the following binary, configuration and genesis files according to the mainnet or the testnet. + +### Download chain configurations +* Mainnet + * config.toml + ```shell + wget https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/mainnet/config.toml + ``` + * genesis.json + ```shell + wget https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/mainnet/genesis.json + ``` +* Testnet + * config.toml + ```shell + wget https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/testnet/config.toml + ``` + * genesis.json + ```shell + wget https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/testnet/genesis.json + ``` + +### RPC node running guideline + +* Initialize a genesis file +```shell +geth init --datadir { PATH } genesis.json +``` + +* Run node +```shell +geth --datadir { PATH } --config config.toml { any additional flags } +``` + +### Validator node running guideline + +* Initialize a genesis file +```shell +geth init --datadir { PATH } genesis.json +``` + +* Run node + +Before running `geth` command, make sure the reward address was set correctly. In the new `geth` binary that included the Erawan hard fork. The owner of the validator node can set either wallet address or smart contract address as a beneficially address by adding the flag `miner.etherbase`. + +| Flag | Required | Default | +| - | :-: | - | +|`--miner.sealerAddress`| ❌ | First unlocked account | +|`--miner.etherbase`| ❌ | First unlocked account | + +```shell +geth --datadir { PATH } --config config.toml --miner.etherbase { wallet/smart contract address} { any additional flags } +``` + ### Configuration As an alternative to passing the numerous flags to the `geth` binary, you can also pass a @@ -137,10 +210,10 @@ testing procedures. ## License -The go-ethereum library (i.e. all code outside of the `cmd` directory) is licensed under the +The bkc library (i.e. all code outside of the `cmd` directory) is licensed under the [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), also included in our repository in the `COPYING.LESSER` file. -The go-ethereum binaries (i.e. all code inside of the `cmd` directory) is licensed under the +The bkc binaries (i.e. all code inside of the `cmd` directory) is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also -included in our repository in the `COPYING` file. +included in our repository in the `COPYING` file. \ No newline at end of file