Skip to content

Commit

Permalink
gwemix: rebranding
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoci committed Jun 29, 2022
1 parent a31adbe commit 8ea9dc0
Show file tree
Hide file tree
Showing 66 changed files with 509 additions and 1,752 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ profile.cov

vendor/*

# Metadium
/metadium/admin_abi.go
/metadium/governance_abi.go
# Wemix
/wemix/admin_abi.go
/wemix/governance_abi.go
File renamed without changes.
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ ROCKSDB_DIR=$(shell pwd)/rocksdb
ROCKSDB_TAG=-tags rocksdb
endif

nxtmeta: gwemix logrot
gwemix.tar.gz: gwemix logrot
@[ -d build/conf ] || mkdir -p build/conf
@cp -p metadium/scripts/gwemix.sh metadium/scripts/solc.sh build/bin/
@cp -p metadium/scripts/config.json.example \
metadium/scripts/genesis-template.json \
metadium/contracts/MetadiumGovernance.js \
metadium/scripts/deploy-governance.js \
@cp -p wemix/scripts/gwemix.sh wemix/scripts/solc.sh build/bin/
@cp -p wemix/scripts/config.json.example \
wemix/scripts/genesis-template.json \
wemix/contracts/WemixGovernance.js \
wemix/scripts/deploy-governance.js \
build/conf/
@(cd build; tar cfz nxtmeta.tar.gz bin conf)
@echo "Done building build/nxtmeta.tar.gz"
@(cd build; tar cfz gwemix.tar.gz bin conf)
@echo "Done building build/gwemix.tar.gz"

gwemix: rocksdb metadium/governance_abi.go
gwemix: rocksdb wemix/governance_abi.go
ifeq ($(USE_ROCKSDB), NO)
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/gwemix
else
Expand Down Expand Up @@ -86,12 +86,12 @@ ios:
test: all
$(GORUN) build/ci.go test

lint: metadium/governance_abi.go ## Run linters.
lint: wemix/governance_abi.go ## Run linters.
$(GORUN) build/ci.go lint

clean:
env GO111MODULE=on go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/* build/conf metadium/admin_abi.go metadium/governance_abi.go
rm -fr build/_workspace/pkg/ $(GOBIN)/* build/conf wemix/admin_abi.go wemix/governance_abi.go
@ROCKSDB_DIR=$(ROCKSDB_DIR); \
if [ -e $${ROCKSDB_DIR}/Makefile ]; then \
cd $${ROCKSDB_DIR}; \
Expand All @@ -115,10 +115,10 @@ gwemix-linux:
if [ ! $$? = 0 ]; then \
echo "Docker not found."; \
else \
docker build -t meta/builder:local \
-f Dockerfile.metadium . && \
docker build -t wemix/builder:local \
-f Dockerfile.wemix . && \
docker run -e HOME=/tmp --rm -v $(shell pwd):/data \
-w /data meta/builder:local \
-w /data wemix/builder:local \
make USE_ROCKSDB=$(USE_ROCKSDB); \
fi

Expand All @@ -131,7 +131,7 @@ rocksdb:
endif

AWK_CODE=' \
BEGIN { print "package metadium"; bin = 0; name = ""; abi = ""; } \
BEGIN { print "package wemix"; bin = 0; name = ""; abi = ""; } \
/^{/ { bin = 1; abi = ""; name = ""; } \
/^}/ { bin = 0; abi = abi "}"; print "var " name "Abi = `" abi "`"; } \
{ \
Expand All @@ -144,13 +144,13 @@ BEGIN { print "package metadium"; bin = 0; name = ""; abi = ""; } \
} \
}'

metadium/admin_abi.go: metadium/contracts/MetadiumAdmin-template.sol build/bin/solc
@PATH=${PATH}:build/bin metadium/scripts/solc.sh -f abi $< /tmp/junk.$$$$; \
wemix/admin_abi.go: wemix/contracts/WemixAdmin-template.sol build/bin/solc
@PATH=${PATH}:build/bin wemix/scripts/solc.sh -f abi $< /tmp/junk.$$$$; \
cat /tmp/junk.$$$$ | awk $(AWK_CODE) > $@; \
rm -f /tmp/junk.$$$$;

AWK_CODE_2=' \
BEGIN { print "package metadium\n"; } \
BEGIN { print "package wemix\n"; } \
/^var Registry_contract/ { \
sub("^var[^(]*\\(","",$$0); sub("\\);$$","",$$0); \
n = "Registry"; \
Expand All @@ -172,7 +172,7 @@ BEGIN { print "package metadium\n"; } \
print "var " n "Abi = `{ \"contractName\": \"" n "\", \"abi\": " $$0 "}`"; \
}'

metadium/governance_abi.go: metadium/contracts/MetadiumGovernance.js
wemix/governance_abi.go: wemix/contracts/WemixGovernance.js
@cat $< | awk $(AWK_CODE_2) > $@

ifneq ($(shell uname), Linux)
Expand Down
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
## Go NxtMeta
## Go Wemix

Golang implementation of the NxtMeta project.
Golang implementation of the Wemix project.

## Building

`geth` has been renamed to `gnxt`. Building it is the same as go-ethereum.
`geth` has been renamed to `gwemix`. Building it is the same as go-ethereum.

make gnxt
make gwemix

For the convenience of installation, other targets have been added to the default target.

make

will build `logrot` (log rotator) and `nxtmeta.tar.gz` in `build` directory, in addtion. `nxtmeta.tar.gz` has the following files.
will build `logrot` (log rotator) and `gwemix.tar.gz` in `build` directory, in addtion. `gwemix.tar.gz` has the following files.

bin/gnxt
bin/gnxt.sh
bin/gwemix
bin/gwemix.sh
bin/solc.sh
bin/logrot
conf/MetadiumGovernance.js
conf/WemixGovernance.js
conf/genesis-template.json
conf/config.json.example

### Build For Ubuntu with a Docker Image

As we use `rocksdb` `C` implementation for better performance, library dependency becomes an issue. To mitigate that, we use a docker image to build our official image.

make gnxt-linux
make wemix-linux

will build gnxt for ubuntu.
will build gwemix for ubuntu.

### Build with LevelDB instead of Rocksdb

Expand All @@ -38,47 +38,47 @@ To avoid library dependency issue, one can forgo `rocksdb` with

This is default behavior in non-linux environment, e.g. in MacOS X.

## Join the NxtMeta Mainnet or Testnet
## Join the Wemix Mainnet or Testnet

One can use the following command lines to join the NxtMeta networks. Note that the default RPC port for `gnxt` is 8588, and p2p port is 8589. As with `geth`, if `--datadir` is missing, ~/.nxtmeta is the data directory.
One can use the following command lines to join the Wemix networks. Note that the default RPC port for `gwemix` is 8588, and p2p port is 8589. As with `geth`, if `--datadir` is missing, ~/.wemix is the data directory.

### NxtMeta Mainnet
### Wemix Mainnet

gnxt --syncmode full --datadir {data_folder} --rpc --rpcaddr 0.0.0.0
gwemix --syncmode full --datadir {data_folder} --rpc --rpcaddr 0.0.0.0

### NxtMeta Testnet
### Wemix Testnet

gnxt --testnet</b> --syncmode full --datadir {data_folder} --rpc --rpcaddr 0.0.0.0
gwemix --wemix-testnet --syncmode full --datadir {data_folder} --rpc --rpcaddr 0.0.0.0

## Setting Up a New Network

One can use `gnxt.sh` script to make setup process a little easier. `gnxt.sh` assumes nxtmeta data directory to be `/opt/<node-name>`
One can use `gwemix.sh` script to make setup process a little easier. `gwemix.sh` assumes wemix data directory to be `/opt/<node-name>`

### Initial Network

First create data directory in `/opt/`, say `/opt/meta`. Then, unpack nxtmeta.tar.gz in the directory.
First create data directory in `/opt/`, say `/opt/wemix`. Then, unpack gwemix.tar.gz in the directory.

mkdir /opt/meta
cd /opt/meta
tar xvfz <dir>/nxtmeta.tar.gz
mkdir /opt/wemix
cd /opt/wemix
tar xvfz <dir>/gwemix.tar.gz

Once initial members / accounts and nodes are determined (at least one member / account and node are required), create a configuration file using `conf/config.json.example` as a template, say `config.json`. A member designated as `bootnode` has a special meaning. Only that account can create the governance contracts, and only that node is allowed to generate blocks before governance contracts are established. These are recorded in the genesis block as the `coinbase` and the last 64 bytes of the `extraData`.

#### Account and Node IDs

One can reuse existing accounts and nodes. Account files are in `keystore` directory, and `geth/nodekey` is the node key / id file. Or one can use `gnxt` to create accounts and node keys, and copy them to data directory.
One can reuse existing accounts and nodes. Account files are in `keystore` directory, and `geth/nodekey` is the node key / id file. Or one can use `gwemix` to create accounts and node keys, and copy them to data directory.

To create a new account file, run the following.

bin/gnxt metadium new-account --out <account-file-name>
bin/gwemix wemix new-account --out <account-file-name>

To create a new node key,

bin/gnxt metadium new-nodekey --out <node-key-file-name>
bin/gwemix wemix new-nodekey --out <node-key-file-name>

To get node id, which is the public key of a `nodekey`.

bin/gnxt metadium nodeid <node-key-file-name>
bin/gwemix wemix nodeid <node-key-file-name>

`idv5` is the one that should be used in config.json file.

Expand All @@ -97,74 +97,74 @@ The same for accounts

Running the following command generates `genesis.json`.

bin/gnxt.sh init <node-name> config.json
bin/gwemix.sh init <node-name> config.json

e.g.

bin/gnxt.sh init meta config.json
bin/gwemix.sh init wemix config.json

Copy the newly created `genesis.json` to other nodes's data directories.

Now start gnxt.
Now start gwemix.

bin/gnxt.sh start
bin/gwemix.sh start

It's time to initialize governance contracts. Here we'll do a simple one-stop setup. Note that this is just for test. The real governance setup is a multi step process involving several proposals and votes. We'll prepare detailed governance setup documents later. Fow now, just do the following is enough.

bin/gnxt.sh init-gov meta config.json <account-file>
bin/gwemix.sh init-gov wemix config.json <account-file>

Now start the console, and check if governance contracts are set up or not.

bin/gnxt.sh console
> admin.metadiumInfo
bin/gwemix.sh console
> admin.wemixInfo

If this shows nodes as configured in config.json, it's time to initialize etcd.

> admin.etcdInit()

Check if `etcd` is configured successfully.

> admin.metadiumInfo.etcd
> admin.wemixInfo.etcd

#### Other Initial Nodes

Set up the data directory and copy the `genesis` file as follows.

mkdir /opt/meta
cd /opt/meta
mkdir /opt/wemix
cd /opt/wemix
mkdir geth
cp <node-key-file> geth/nodekey
mkdir keystore
chmod 0700 keystore
cp <account-files> keystore/
tar xvfz <dir>/nxtmeta.tar.gz
tar xvfz <dir>/wemix.tar.gz
# copy genesis.json
bin/gnxt.sh start
bin/gwemix.sh start

Once these nodes are setup, the first node will automatically connect and chain synchronization will follow.

### NxtMeta Info
### Wemix Info

bin/gnxt.sh console
bin/gwemix.sh console
...
> admin.metadiumInfo
> admin.wemixInfo

### Starting & Stopping Nodes

To start or stop a single node

bin/gnxt.sh start
bin/gnxt.sh stop
bin/gwemix.sh start
bin/gwemix.sh stop

### Starting Non-mining Nodes

First download genesis.json from existing nodes to a data directory.

bin/gnxt metadium download-genesis --url http://<ip> --out genesis.json
bin/gwemix wemix download-genesis --url http://<ip> --out genesis.json

After getting enodes of mining nodes, run gnxt as follows.
After getting enodes of mining nodes, run gwemix as follows.

bin/gnxt --syncmode full --datadir <data-directory> --bootnodes <enodes> --rpc --rpcaddr 0.0.0.0
bin/gwemix --syncmode full --datadir <data-directory> --bootnodes <enodes> --rpc --rpcaddr 0.0.0.0

### The original go-ethereum README follows...

Expand Down
2 changes: 1 addition & 1 deletion accounts/usbwallet/offline.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 The go-ethereum / go-metadium Authors
// Copyright 2019 The go-ethereum / go-metadium / go-wemix Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
utils.Fatalf("Failed to set account manager backends: %v", err)
}

utils.SetMetadiumConfig(ctx, stack, &cfg.Eth)
utils.SetWemixConfig(ctx, stack, &cfg.Eth)
utils.SetEthConfig(ctx, stack, &cfg.Eth)
if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) {
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/governancedeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/metadium/metclient"
"github.com/ethereum/go-ethereum/wemix/metclient"
"gopkg.in/urfave/cli.v1"
)

Expand Down
14 changes: 7 additions & 7 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import (
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/log"
metadium "github.com/ethereum/go-ethereum/metadium"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/wemix"

// Force-load the tracer engines to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
Expand Down Expand Up @@ -209,7 +209,7 @@ var (
utils.MetricsInfluxDBOrganizationFlag,
}

metadiumFlags = []cli.Flag{
wemixFlags = []cli.Flag{
utils.ConsensusMethodFlag,
utils.FixedDifficultyFlag,
utils.FixedGasLimitFlag,
Expand All @@ -233,7 +233,7 @@ func init() {
// Initialize the CLI app and start Geth
app.Action = geth
app.HideVersion = true // we have a command to print the version
app.Copyright = "Copyright 2013-2022 The go-ethereum / go-metadium Authors"
app.Copyright = "Copyright 2013-2022 The go-ethereum / go-metadium / go-wemix Authors"
app.Commands = []cli.Command{
// See chaincmd.go:
initCommand,
Expand Down Expand Up @@ -265,7 +265,7 @@ func init() {
utils.ShowDeprecated,
// See snapshot.go
snapshotCommand,
metadiumCommand,
wemixCommand,
}
sort.Sort(cli.CommandsByName(app.Commands))

Expand All @@ -274,7 +274,7 @@ func init() {
app.Flags = append(app.Flags, consoleFlags...)
app.Flags = append(app.Flags, debug.Flags...)
app.Flags = append(app.Flags, metricsFlags...)
app.Flags = append(app.Flags, metadiumFlags...)
app.Flags = append(app.Flags, wemixFlags...)

app.Before = func(ctx *cli.Context) error {
// setup rotating log if specified
Expand Down Expand Up @@ -380,8 +380,8 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
// Start up the node itself
utils.StartNode(ctx, stack, isConsole)

// Start metadium admin
metadium.StartAdmin(stack, ctx.GlobalString(utils.DataDirFlag.Name))
// Start wemix admin
wemix.StartAdmin(stack, ctx.GlobalString(utils.DataDirFlag.Name))

// Unlock any account specifically requested
unlockAccounts(ctx, stack)
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
Flags: metricsFlags,
},
{
Name: "METADIUM",
Name: "WEMIX",
Flags: []cli.Flag{
utils.ConsensusMethodFlag,
utils.FixedDifficultyFlag,
Expand Down
Loading

0 comments on commit 8ea9dc0

Please sign in to comment.