Skip to content

A EVM and Ethereum RPC compatible blockchain & The next generation of GXChain

License

Notifications You must be signed in to change notification settings

REI-Network/rei

Repository files navigation

REI-Network

Node Version NPM Version

Nodejs implementation of REI-Network protocols

This project is under continuous development, all protocols and modules may be changed in the future, use it at your own risk

package npm issues
@rei-network/structure NPM Version Block Issues
@rei-network/blockchain NPM Version Blockchain Issues
@rei-network/cli NPM Version Cli Issues
@rei-network/contracts NPM Version Contracts Issues
@rei-network/utils NPM Version Utils Issues
@rei-network/core NPM Version Core Issues
@rei-network/common NPM Version Common Issues
@rei-network/database NPM Version Database Issues
@rei-network/network NPM Version Network Issues
@rei-network/rpc NPM Version Rpc Issues
@rei-network/wallet NPM Version Wallet Issues
@rei-network/api NPM Version Api Issues
@rei-network/ipc NPM Version Ipc Issues

Requirements

  • node >= 16.0.0
  • npm >= 7.0.0
  • supported system:
    • MacOS 12+
    • Any Linux with glibc >= 2.28 and glibcxx >= 3.4.25

Quick start

Install

npm install @rei-network/cli --global

Usage

Usage: rei [options] [command]

Options:
  -V, --version                              output the version number
  --rpc                                      open rpc server
  --rpc-port <port>                          rpc server port
  --rpc-host <port>                          rpc server host
  --rpc-api <apis>                           rpc server apis: debug, eth, net, txpool, web3, rei
  --p2p-tcp-port <port>                      p2p server tcp port
  --p2p-udp-port <port>                      p2p server udp port
  --p2p-nat <ip>                             p2p server nat ip
  --max-peers <peers>                        max p2p peers count
  --max-dials <dials>                        max p2p dials count
  --bootnodes <bootnodes...>                 comma separated list of bootnodes
  --sync <sync>                              sync mode: full, snap (default: "full")
  --snap-trusted-height <trustedHeight>      snap sync trusted height.
                                             this value and trustedHash are specified at the same time to take effect.
                                             snap sync will start from the specified block to verify the legitimacy.
                                             e.g. 100
  --snap-trusted-hash <trustedHash>          snap sync trusted hash.
                                             this value and trustedHeight are specified at the same time to take effect.
                                             snap sync will start from the specified block to verify the legitimacy.
                                             e.g. 0x123...
  --snap-min-td <minTD>                      minimum total difficulty difference for snap sync
  --skip-verify-snap                         whether skip verifing snapshot
  --datadir <path>                           chain data dir path (default: "~/.rei")
  --keystore <keystore>                      the datadir for keystore (default: "keystore")
  --unlock <unlock>                          comma separated list of accounts to unlock
  --password <password>                      password file to use for non-interactive password input
  --chain <chain>                            chain name: rei-mainnet, rei-testnet, rei-devnet
  --mine                                     mine block
  --coinbase <address>                       miner address
  --verbosity <verbosity>                    logging verbosity: silent, error, warn, info, debug, detail (default: "info")
  --receipts-cache-size <receiptsCacheSize>  receipts cache size
  --evm <evm>                                evm implementation type, "js" or "binding"
  --bls <bls>                                the datadir for bls (default: "bls")
  --bls-password <blsPassword>               bls password file to use for non-interactive password input
  --bls-file <blsFile>                       bls file name
  -h, --help                                 display help for command

Commands:
  account                                    Manage accounts
  attach [ipcpath]                           Start an interactive JavaScript environment (connect to node)
  console                                    Start an interactive JavaScript environment
  bls                                        Manage bls signature key

Example

Block producer startup

rei --mine --coinbase 0x...abc --unlock 0x...abc --password ./password

Normal node startup

rei --rpc --rpc-host 0.0.0.0

Bootnode startup

rei --p2p-nat 1.2.3.4

Testnet node startup

rei --chain rei-testnet

Build

This monorepo uses npm workspaces. It links the local packages together, making development a lot easier.

Install:

npm install

Build:

npm run build -ws

ℹ️ Note for Windows users:

Windows users might run into the following error when trying to install the repo: '.' is not recognized as an internal or external command. To remediate for this, you can force Windows to use Git bash to run scripts (you'll need to install Git for Windows for this) with the following command:

npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe"

If you ever need to reset this change, you can do so with this command:

npm config delete script-shell

Project scripts — run from repository root

npm install (alias: npm i)

Adds dependencies listed in the root package.

npm run build -ws

Builds all monorepo packages.

To build a specific package, use npm run build -w @rei-network/contracts

npm run build:core, npm run build:contracts, ...

Only build single monorepo package.

npm run clean

Removes root and packages node_modules, dist directories, and other generated files.

npm run clean:build

Only remove dist directories for each monorepo packages.

npm run lint, npm run lint:fix

These scripts execute lint and lint:fix respectively, to all monorepo packages.

FAQ

  • Q: Why do I get EACCES: permission denied or node-gyp: Permission denied when I install @rei-network/cli?

    like this
    > [email protected] install /xxx/v14.16.1/lib/node_modules/@rei-network/cli/node_modules/bigint-buffer
    > npm run rebuild || echo "Couldn't build bindings. Non-native version used."
    
    Error: EACCES: permission denied, scandir '/xxx/v14.16.1/lib/node_modules/@rei-network/cli/node_modules/bigint-buffer'
    
    > [email protected] install /xxx/v14.16.1/lib/node_modules/@rei-network/cli/node_modules/bcrypto
    > node-gyp rebuild
    
    sh: 1: node-gyp: Permission denied
    npm ERR! code ELIFECYCLE
    npm ERR! syscall spawn
    npm ERR! file sh
    npm ERR! errno ENOENT
    npm ERR! [email protected] install: `node-gyp rebuild`
    npm ERR! spawn ENOENT
    npm ERR!
    npm ERR! Failed at the [email protected] install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /xxx/.npm/_logs/2021-07-14T02_24_45_172Z-debug.log
    

    A: Please run

    npm install @rei-network/cli -g --unsafe-perm=true --allow-root
    
  • Q: Why do I get SyntaxError: Unexpected token '?' when I run rei?

    like this
    /xxx/v12.20.0/lib/node_modules/@rei-network/cli/node_modules/@gxchain2/discv5/lib/service/addrVotes.js:44
            let best = [tiebreakerStr, this.tallies[tiebreakerStr] ?? 0];
                                                                    ^
    
    SyntaxError: Unexpected token '?'
        at wrapSafe (internal/modules/cjs/loader.js:915:16)
        at Module._compile (internal/modules/cjs/loader.js:963:27)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
        at Module.load (internal/modules/cjs/loader.js:863:32)
        at Function.Module._load (internal/modules/cjs/loader.js:708:14)
        at Module.require (internal/modules/cjs/loader.js:887:19)
        at require (internal/modules/cjs/helpers.js:74:18)
        at Object.<anonymous> (/xxx/v12.20.0/lib/node_modules/@rei-network/cli/node_modules/@gxchain2/discv5/lib/service/service.js:18:21)
        at Module._compile (internal/modules/cjs/loader.js:999:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    

    A: Please update the node version to 14.16.1 or higher. nvm may be able to help you

License

GNU General Public License v3.0

About

A EVM and Ethereum RPC compatible blockchain & The next generation of GXChain

Resources

License

Stars

Watchers

Forks

Packages

No packages published