Skip to content

Commit

Permalink
Merge pull request #5 from niuxiaojie-Alaya/develop
Browse files Browse the repository at this point in the history
Modified to Alaya feature
  • Loading branch information
benbaley committed May 31, 2021
2 parents 8f18e47 + 323c8e9 commit 58a6d43
Show file tree
Hide file tree
Showing 3,414 changed files with 4,273 additions and 259,993 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Contributing

If you'd like to contribute to PlatON-Go please fork, fix, test, commit and
If you'd like to contribute to Alaya-Go please fork, fix, test, commit and
send a pull request. Commits which do not comply with the coding standards
are ignored (use gofmt!).

See [Developers' Guide](https://platonnetwork.github.io/Docs/#/en-us/basics/[English]-Getting-Started)
See [Developers' Guide](https://devdocs.alaya.network/alaya-devdocs/en/)
for more details on configuring your environment, testing, and
dependency management.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ please note that this is an issue tracker reserved for bug reports and feature r

#### System information

PlatON version: `platon version`
Alaya version: `alaya version`
OS & Version: Windows/Linux/OSX
Commit hash : (if `develop`)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Build
run: make platon
run: make alaya

- name: Test
run: go test -tags=test -covermode=count -coverprofile=coverage.out `go list ./...|grep -v life|grep -v swarm|grep -v tests|grep -v bn256|grep -v mobile`
50 changes: 40 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
# Build Geth in a stock Go builder container
FROM golang:1.11-alpine as builder
# Build Alaya in a stock Go builder container
FROM golang:1.15-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers bash cmake g++
RUN apk add --no-cache make gcc musl-dev linux-headers g++ llvm bash cmake git gmp-dev openssl-dev

ADD . /PlatON-Go
RUN cd /PlatON-Go && make platon
RUN git clone https://github.com/dfinity/bn.git
RUN cd bn && make && make install

# Pull Geth into a second stage deploy alpine container
ADD . /Alaya-Go
RUN cd /Alaya-Go && make clean && make alaya

# Pull Alaya into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates libstdc++ gcc
COPY --from=builder /PlatON-Go/build/bin/platon /usr/local/bin/
RUN apk add --no-cache ca-certificates libstdc++ bash tzdata gmp-dev
COPY --from=builder /Alaya-Go/build/bin/alaya /usr/local/bin/
COPY --from=builder /Alaya-Go/entrypoint.sh /usr/local/bin/
COPY --from=builder /usr/local/lib/libbls384.so /usr/local/lib/
COPY --from=builder /usr/local/lib/libmcl.so /usr/local/lib/
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ENV ENABLE_DEBUG=false
ENV ENABLE_PPROF=false
ENV ENABLE_WS=false
ENV WSAPI=
ENV ENABLE_RPC=false
ENV RPCAPI=
ENV BOOTNODES=
ENV NEW_ACCOUNT=false
ENV INIT=false
ENV VERBOSITY=3
ENV ENBALE_DISCOVER=false
ENV ENABLE_V5DISC=false
ENV ENABLE_CBFT_TRACING=false
ENV P2PPORT=16789
ENV WSPORT=6080
ENV RPCPORT=6789
ENV PPROFPORT=6060
ENV MAXPEERS=43
ENV MAXCONSENSUSPEERS=100
ENV ENABLE_LIGHT_SRV=false
ENV SYNCMODE=full

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["platon"]
VOLUME /data/alaya
EXPOSE 6060 6080 6789 16789 16789/udp
ENTRYPOINT ["alaya"]
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ GO ?= latest
GPATH = $(shell go env GOPATH)
GORUN = env GO111MODULE=on GOPATH=$(GPATH) go run

platon:
alaya:
build/build_deps.sh
$(GORUN) build/ci.go install ./cmd/platon
$(GORUN) build/ci.go install ./cmd/alaya
@echo "Done building."
@echo "Run \"$(GOBIN)/platon\" to launch platon."
@echo "Run \"$(GOBIN)/alaya\" to launch alaya."

fix-cbft-test:
build/cbft_test.sh
@echo "Done fix."

platon-with-mpc:
alaya-with-mpc:
build/build_deps.sh
$(GORUN) build/ci.go install -mpc on ./cmd/platon
@echo "Done building platon with mpc."
@echo "Run \"$(GOBIN)/platon\" to launch platon."
$(GORUN) build/ci.go install -mpc on ./cmd/alaya
@echo "Done building alaya with mpc."
@echo "Run \"$(GOBIN)/alaya\" to launch alaya."

platon-with-vc:
alaya-with-vc:
build/build_deps.sh
build/build_snark.sh
$(GORUN) build/ci.go install -vc on ./cmd/platon
@echo "Done building platon with vc."
@echo "Run \"$(GOBIN)/platon\" to launch platon."
$(GORUN) build/ci.go install -vc on ./cmd/alaya
@echo "Done building alaya with vc."
@echo "Run \"$(GOBIN)/alaya\" to launch alaya."

platon-with-mv:
alaya-with-mv:
build/build_deps.sh
build/build_snark.sh
$(GORUN) build/ci.go install -mv on ./cmd/platon
@echo "Done building platon with vc."
@echo "Run \"$(GOBIN)/platon\" to launch platon."
$(GORUN) build/ci.go install -mv on ./cmd/alaya
@echo "Done building alaya with vc."
@echo "Run \"$(GOBIN)/alaya\" to launch alaya."

all:
build/build_deps.sh
Expand Down
60 changes: 33 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
## Go PlatON
## Go Alaya

Welcome to the PlatON-Go source code repository! This is an Ethereum-based、high-performance and high-security implementation of the PlatON protocol.
Most of peculiarities according the PlatON's [whitepaper](https://www.platon.network/static-new/pdf/zh/PlatON_A_High-Efficiency_Trustless_Computing_Network_Whitepaper_ZH.pdf) has been developed.
Alaya-Go is the implementation of Alaya network which is pioneering demonstration network of PlatON.

[![Build Status](https://travis-ci.com/PlatONnetwork/PlatON-Go.svg?branch=feature%2Fbump-version-to-0.7)](https://travis-ci.com/PlatONnetwork/PlatON-Go)
[![API Reference](
https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667
)](https://pkg.go.dev/github.com/AlayaNetwork/Alaya-Go?tab=doc)
[![Go Report Card](https://goreportcard.com/badge/github.com/AlayaNetwork/Alaya-Go)](https://goreportcard.com/report/github.com/AlayaNetwork/Alaya-Go)
[![Build Status](https://github.com/AlayaNetwork/Alaya-Go/actions/workflows/test.yml/badge.svg))](https://github.com/AlayaNetwork/Alaya-Go/actions)
[![codecov](https://codecov.io/gh/AlayaNetwork/Alaya-Go/branch/feature-mainnet-launch/graph/badge.svg)](https://codecov.io/gh/AlayaNetwork/Alaya-Go)
[![version](https://img.shields.io/github/v/tag/AlayaNetwork/Alaya-Go)](https://github.com/AlayaNetwork/Alaya-Go/releases/latest)
[![GitHub All Releases](https://img.shields.io/github/downloads/AlayaNetwork/Alaya-Go/total.svg)](https://github.com/AlayaNetwork/Alaya-Go)

## Building the source
The requirements to build PlatON-Go are:
The requirements to build Alaya-Go are:

- OS:Windows10/Ubuntu18.04
- [Golang](https://golang.org/doc/install) :version 1.13+
- [Golang](https://golang.org/doc/install) :version 1.14+
- [cmake](https://cmake.org/) :version 3.0+
- [g++&gcc](http://gcc.gnu.org/) :version 7.4.0+
> The 'cmake' and 'gcc&g++' are usually included in Ubuntu18.04
Expand All @@ -22,10 +28,10 @@ sudo apt install libgmp-dev libssl-dev
Then, clone the repository

```
git clone https://github.com/PlatONnetwork/PlatON-Go.git --recursive
git clone https://github.com/AlayaNetwork/Alaya-Go.git --recursive
```

Switch to the PlatON-Go repository root directory.
Switch to the Alaya-Go repository root directory.

Ubuntu:

Expand All @@ -39,33 +45,33 @@ Windows:
go run build\ci.go install
```

The resulting binary will be placed in '$PlatON-Go/build/bin'(Ubuntu) or in '%GOPATH%\bin'(Windows) .
The resulting binary will be placed in '$Alaya-Go/build/bin'(Ubuntu) or in '%GOPATH%\bin'(Windows) .

## Getting Started

The project comes with several executables found in the `build/bin` directory.

| Command | Description |
|:----------:|-------------|
| **`platon`** | Our main PlatON CLI client. It is the entry point into the PlatON network |
| `keytool` | a key related tool. |
| **`alaya`** | Our main Alaya CLI client. It is the entry point into the Alaya network |
| `alayakey` | a key related tool. |

### Generate the keys

Each node requires two pairs of public&private keys, the one is called node's keypair, it's generated based on the secp256k1 curve for marking the node identity and signning the block, and the other is called node's blskeypair, it's based on the BLS_12_381 curve and is used for consensus verifing. These two pairs of public-private key need to be generated by the keytool tool.
Each node requires two pairs of public&private keys, the one is called node's keypair, it's generated based on the secp256k1 curve for marking the node identity and signning the block, and the other is called node's blskeypair, it's based on the BLS_12_381 curve and is used for consensus verifing. These two pairs of public-private key need to be generated by the alayakey tool.

Switch to the directory where contains 'keytool.exe'(Windows) or 'keytool'(Ubuntu).
Switch to the directory where contains 'alayakey.exe'(Windows) or 'alayakey'(Ubuntu).
Node's keypair(Ubuntu for example):

```
keytool genkeypair
alayakey genkeypair
PrivateKey: 1abd1200759d4693f4510fbcf7d5caad743b11b5886dc229da6c0747061fca36
PublicKey : 8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127
```
Node's blskeypair::

```
keytool genblskeypair
alayakey genblskeypair
PrivateKey: 7747ec6876bbf8ca0934f05e45917b4213afc5814639355868bbf06d0b3e0f19
PublicKey : e5eb9915ed2b5fd52cf5ff760873a75a8562956e176968f3cbe5ea2b22e03a7b5efc07fdd5ad66d433b404cb880b560bed6295fa79f8fa649588be02231de2e70a782751dc28dbf516b7bb5d52053b5cdf985d8961a5baafa467e8dda55fe981
```
Expand All @@ -85,7 +91,7 @@ echo "{your-blskey}" > ./data/blskey
### Generate a wallet

```
platon --datadir ./data account new
alaya --datadir ./data account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Expand All @@ -94,7 +100,7 @@ Address: {apt1anp4tzmdggdrcf39qvshfq3glacjxcd5mayaa8}

> Do remember the password
### Connect to the PlatON network
### Connect to the Alaya network

| Options | description |
| :------------ | :------------ |
Expand All @@ -108,19 +114,19 @@ Address: {apt1anp4tzmdggdrcf39qvshfq3glacjxcd5mayaa8}
| --nodekey | P2P node key file |
| --cbft.blskey | BLS key file |

Run the following command to launch a PlatON node connecting to the PlatON's mainnet:
Run the following command to launch a Alaya node connecting to the Alaya's mainnet:

```
$ ./platon --identity "platon" --datadir ./data --port {your-p2p-port} --rpcaddr 127.0.0.1 --rpcport {your-rpc-port} --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data/nodekey --cbft.blskey ./data/blskey
$ ./alaya --identity "alaya" --datadir ./data --port {your-p2p-port} --rpcaddr 127.0.0.1 --rpcport {your-rpc-port} --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data/nodekey --cbft.blskey ./data/blskey
```

OK, it seems that the chain is running correctly, we can check it as follow:

```
platon attach http://127.0.0.1:6789
Welcome to the PlatON JavaScript console!
alaya attach http://127.0.0.1:6789
Welcome to the Alaya JavaScript console!
instance: PlatONnetwork/platon/v0.7.3-unstable/linux-amd64/go1.10.4
instance: AlayaNetwork/alaya/v0.7.3-unstable/linux-amd64/go1.10.4
at block: 26 (Wed, 15 Dec 51802 20:22:44 CST)
datadir: /home/jht/node1/data
modules: admin:1.0 debug:1.0 net:1.0 personal:1.0 platon:1.0 rpc:1.0 web3:1.0
Expand All @@ -129,17 +135,17 @@ at block: 26 (Wed, 15 Dec 51802 20:22:44 CST)
29
```

For more information, please visit our [Docs](https://platonnetwork.github.io/Docs/#/en-us/basics/[English]-Getting-Started).
For more information, please visit our [Docs](https://devdocs.alaya.network/alaya-devdocs/en/).

## Contributing to PlatON-Go
## Contributing to Alaya-Go

All of codes for PlatON-Go are open source and contributing are very welcome! Before beginning, please take a look at our contributing [guidelines](https://github.com/PlatONnetwork/PlatON-Go/blob/master/.github/CONTRIBUTING.md). You can also open an issue by clicking [here](https://github.com/PlatONnetwork/PlatON-Go/issues/new).
All of codes for Alaya-Go are open source and contributing are very welcome! Before beginning, please take a look at our contributing [guidelines](https://github.com/AlayaNetwork/Alaya-Go/blob/master/.github/CONTRIBUTING.md). You can also open an issue by clicking [here](https://github.com/AlayaNetwork/Alaya-Go/issues/new).

## Support
If you have any questions or suggestions please contact us at support@platon.network.

## License
The PlatON-Go library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.
The Alaya-Go library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The PlatON-Go binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.
The Alaya-Go binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.

4 changes: 2 additions & 2 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"fmt"
"io"

"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/crypto"
)

// The ABI holds information about a contract's context and available
Expand Down
6 changes: 3 additions & 3 deletions accounts/abi/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
"strings"
"testing"

"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/common/math"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/common/math"
"github.com/AlayaNetwork/Alaya-Go/crypto"
)

const jsondata = `
Expand Down
8 changes: 4 additions & 4 deletions accounts/abi/bind/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"io"
"io/ioutil"

"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/core/types"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/AlayaNetwork/Alaya-Go/accounts/keystore"
"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/core/types"
"github.com/AlayaNetwork/Alaya-Go/crypto"
)

// NewTransactor is a utility method to easily create a transaction signer from
Expand Down
6 changes: 3 additions & 3 deletions accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"errors"
"math/big"

platon "github.com/PlatONnetwork/PlatON-Go"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/core/types"
platon "github.com/AlayaNetwork/Alaya-Go"
"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/core/types"
)

var (
Expand Down
38 changes: 19 additions & 19 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ import (
"sync"
"time"

"github.com/PlatONnetwork/PlatON-Go/core/snapshotdb"

ethereum "github.com/PlatONnetwork/PlatON-Go"
"github.com/PlatONnetwork/PlatON-Go/accounts/abi/bind"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/common/math"
"github.com/PlatONnetwork/PlatON-Go/consensus"
"github.com/PlatONnetwork/PlatON-Go/core"
"github.com/PlatONnetwork/PlatON-Go/core/bloombits"
"github.com/PlatONnetwork/PlatON-Go/core/rawdb"
"github.com/PlatONnetwork/PlatON-Go/core/state"
"github.com/PlatONnetwork/PlatON-Go/core/types"
"github.com/PlatONnetwork/PlatON-Go/core/vm"
"github.com/PlatONnetwork/PlatON-Go/eth/filters"
"github.com/PlatONnetwork/PlatON-Go/ethdb"
"github.com/PlatONnetwork/PlatON-Go/event"
"github.com/PlatONnetwork/PlatON-Go/params"
"github.com/PlatONnetwork/PlatON-Go/rpc"
_ "github.com/PlatONnetwork/PlatON-Go/x/xcom"
"github.com/AlayaNetwork/Alaya-Go/core/snapshotdb"

ethereum "github.com/AlayaNetwork/Alaya-Go"
"github.com/AlayaNetwork/Alaya-Go/accounts/abi/bind"
"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/common/math"
"github.com/AlayaNetwork/Alaya-Go/consensus"
"github.com/AlayaNetwork/Alaya-Go/core"
"github.com/AlayaNetwork/Alaya-Go/core/bloombits"
"github.com/AlayaNetwork/Alaya-Go/core/rawdb"
"github.com/AlayaNetwork/Alaya-Go/core/state"
"github.com/AlayaNetwork/Alaya-Go/core/types"
"github.com/AlayaNetwork/Alaya-Go/core/vm"
"github.com/AlayaNetwork/Alaya-Go/eth/filters"
"github.com/AlayaNetwork/Alaya-Go/ethdb"
"github.com/AlayaNetwork/Alaya-Go/event"
"github.com/AlayaNetwork/Alaya-Go/params"
"github.com/AlayaNetwork/Alaya-Go/rpc"
_ "github.com/AlayaNetwork/Alaya-Go/x/xcom"
)

// This nil assignment ensures compile time that SimulatedBackend implements bind.ContractBackend.
Expand Down
Loading

0 comments on commit 58a6d43

Please sign in to comment.