Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pow feature #11

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,702 changes: 1,021 additions & 681 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
### build stage
FROM rust:1.51-slim as builder
ENV USER root
ENV CI_PROJECT_NAME docker
RUN apt-get update && apt-get install -y git cmake pkg-config libssl-dev git clang libclang-dev
RUN rustup default nightly && rustup target add wasm32-unknown-unknown
RUN rustup default nightly && rustup target add wasm32-unknown-unknown
COPY . .
RUN CI_PROJECT_NAME=docker sh scripts/init.sh
RUN cargo build --release

### package stage
FROM debian:bullseye-slim
FROM debian:stretch-slim
# metadata
ARG VCS_REF
ARG BUILD_DATE
Expand All @@ -11,7 +22,6 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libssl1.1 \
ca-certificates \
glibc \
curl && \
# apt cleanup
apt-get autoremove -y && \
Expand All @@ -20,9 +30,7 @@ RUN apt-get update && \
# add user
useradd -m -u 1000 -U -s /bin/sh -d /metaverse mvs
# add binary to docker image
COPY ./target/release/metaverse /usr/local/bin/metaverse
COPY ./mainnet.json ./mainnet
COPY ./mainnet.json .
COPY --from=builder /target/release/metaversevm /usr/local/bin/metaverse
USER mvs
# check if executable works in this container
RUN /usr/local/bin/metaverse --version
Expand Down
124 changes: 118 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,133 @@ Follow the steps below to take control and compile your own node. :hammer_and_wr

First, complete the [basic Rust setup instructions](./doc/rust-setup.md).

### Build

The `cargo run` command will perform an initial build. Use the following command to build the node
without launching it:

```sh
cargo build --release
```

### Run

Use Rust's native `cargo` command to build and launch the template node:
Launch one metaverse node:

```sh
cargo run --release -- --dev --tmp
./target/release/metaversevm --validator --tmp --rpc-cors all
```

### Build

The `cargo run` command will perform an initial build. Use the following command to build the node
without launching it:

Launch a test net with 3 metaverse node at localhost :

On console for node01:

```sh
cargo build --release
./target/release/metaversevm --validator --tmp --rpc-cors all \
--node-key 0000000000000000000000000000000000000000000000000000000000000111
```

On console for node02:

```
./target/release/metaversevm --validator --tmp --rpc-cors all \
--port 30334 \
--ws-port 9946 \
--rpc-port 9934 \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWRBaMZHnFYtT1B143sSLHkx8G6ysPSg8PMzqXkymm38Ld
```

On console for node03:
```
./target/release/metaversevm --validator --tmp --rpc-cors all \
--port 30335 \
--ws-port 9947 \
--rpc-port 9935 \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWRBaMZHnFYtT1B143sSLHkx8G6ysPSg8PMzqXkymm38Ld
```

### GPU mining

**Install miner**

Access the project's [releases page](https://github.com/ethereum-mining/ethminer/releases), and pick up the latest Linux tarball. Unpack the tarball in the directory where you want to run Ethminer. It's a pre-compiled binary, so that's all you need to do before you start using it.

```sh
$ mkdir ethminer
$ wget -O ethminer/ethminer.tar.gz https://github.com/ethereum-mining/ethminer/releases/download/v0.18.0/ethminer-0.18.0-cuda-9-linux-x86_64.tar.gz
$ tar xzf ethminer/ethminer.tar.gz -C ethminer/
$ ethminer/bin/ethminer --help
ethminer 0.18.0
Build: linux/release/gnu

Ethminer - GPU ethash miner
minimal usage : ethminer [DEVICES_TYPE] [OPTIONS] -P... [-P...]
```

**Run miner**

```sh
// Change to correct RPC port to get work
ethminer/bin/ethminer -P http://127.0.0.1:9933
```

### CPU mining(only for test)

**Dependencies:**

Linux-based:

```
sudo apt-get install libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libudev-dev cmake
```

macOS:

```
brew install leveldb libmicrohttpd
```

**Install:**

```
git clone --depth=1 https://github.com/avatar-lavventura/ethminer.git
cd ethminer
./scripts/install_deps.sh
```

**Build:**

```
cmake -H. -Bbuild
cd build/ethminer
make -j $(nproc)
```

**Run miner**

```sh
// Change to correct RPC port to get work
./ethminer -F http://localhost:9933 --mining-threads 4
```

**Notice**

If the compilation doesn't work through, it could be the C++ compiler version problem, please follow these step:

```sh
vi cmake/EthCompilerSettings.cmake
...
# comment out this line
#add_compile_options(-Werror)
...
...
# at last line add
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-implicit-fallthrough>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-maybe-uninitialized>)
...
```

### Embedded Docs
Expand Down
Loading