qng

module
v1.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2023 License: ISC

README

qng

The next generation of the Qitmeer network implementation with the plug-able VMs under the MeerDAG consensus.

Installation

make sure you have go-lang version 1.19.x or above (1.20.x is recommended) installed on the system to build.

  • Build from source
~ git clone https://github.com/Qitmeer/qng.git
~ cd qng
~ make

or

or

  • Build with Docker:
~ docker build -t qng .
Make sure you have enough memory

Note : Swap 4G+ is required for running the mainent node otherwise you might need the 8G physical memory.

Ex: How to setup a 4G+ swap file on an ubuntu machine
  1. setup the swap file
sudo apt update
sudo apt install --reinstall util-linux
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
  1. check the running swap file
sudo swapon -s
  1. edit /etc/fstab file (optional)
sudo vi /etc/fstab

add a line to the end of /etc/fstab file

/swapfile swap swap defaults 0 0
Getting Started
  • We take the construction of test network nodes as an example:
~ cd ./build/bin
~ ./qng --testnet
~ docker run --rm -it --name qng qng:latest ./build/bin/qng --mixnet --acceptnonstd --modules=qitmeer --modules=p2p
Miner
  • If you are a miner, you also need to configure your reward address:
~ ./qng --testnet --miningaddr=Tk6uXJ3kjh3yA4q94KQF9DTL14rDbd4vb2kztbkfhMBziR35HYkkx 
  • Please note that the mining address here is a PK address:
~ ./qx ec-to-public [Your_Private_Key] | ./qx ec-to-pkaddr -v=testnet
  • If you use the old address(PKH Address), you will only be unable to package the cross chain transaction.
Address
Use qx Command line tools

Note: to use "qx" tool, you need to enter the directory ./cmd/qx to build the qx command, see this guide for details

  • PKH Address:
~ ./qx ec-to-public [Your_Private_Key] | ./qx ec-to-addr -v=testnet
  • PK Address:
~ ./qx ec-to-public [Your_Private_Key] | ./qx ec-to-pkaddr -v=testnet
  • MeerDAG Address:
~ ./qx ec-to-public [Your_Private_Key] | ./qx ec-to-ethaddr
or
~ ./qx pkaddr-to-public [Your_pkaddress] | ./qx ec-to-ethaddr
or
~ ./qx pkaddr-to-ethaddr [Your_pkaddress]
Use qng RPC
  • All addresses corresponding to the same private key:
~ ./cli.sh getaddresses [Your_Private_Key]

(Due to safety reasons, you need to actively open the private module by ./qng --modules=test)

MeerEVM
  • If you want to use our MeerEVM function, the required interface information can be queried in this RPC:
~ cd ./script
~ ./cli.sh vmsinfo
  • If you don't need the default configuration, we provide an environment configuration parameter to meet your custom configuration for MeerEVM:
~ ./qng --testnet --evmenv="--http"
or
~ ./qng --testnet --evmenv="--http --http.port=18545 --ws --ws.port=18546"
~ 
  • You first need to transfer your money in qitmeer to MeerEVM:createExportRawTx <txid> <vout> <PKAdress> <amount>
~ ./cli.sh createExportRawTx ce28ec92cc99b13d9f7a658d2f1e08aa9e4f27ebcfaf5344750bb77484a79657 0 Tk6uXJ3kjh3yA4q94KQF9DTL14rDbd4vb2kztbkfhMBziR35HYkkx 11000000000
~ ./cli.sh txSign [Your_Private_Key] [rawTx]
~ ./cli.sh sendRawTx [signRawTx]
  • Or you can use the multiple inputs or outputs version:createExportRawTxV2 <inputs> <outputs> <lockTime>
~ ./cli.sh createExportRawTxV2 '[{"txid":"0e6aa3a41c6712ed5d68960f2315041579767a9d0a7be9988276cc802e2ae269","vout":0},{"txid":"2d1b3e5e89fbcec54368b7d98079bf533e38f1ce48bfd752582ea87bbac5cbca","vout":0}],[{"address":"Tk6tMafZQW1r2WzwW9V8ynq2HkLhc43nPaMivHTsJGvBUHRNLycPh","amount":11000000000},{"address":"TnNbgxLpoPJCLTcsJbHCzpzcHUouTtfbP8c","amount":999900000}]' 
~ ./cli.sh txSign [Your_Private_Key] [rawTx]
~ ./cli.sh sendRawTx [signRawTx]
  • Finally, wait for the miner to pack your transaction into the block. Then you have the money to start operating your MeerEVM ecosystem.
How can I transfer my money in meerevm to the qitmeer account system ?
~ ./cli.sh createImportRawTx Tk6uXJ3kjh3yA4q94KQF9DTL14rDbd4vb2kztbkfhMBziR35HYkkx [amount] 
~ ./cli.sh txSign [Your_Private_Key] [rawTx]
~ ./cli.sh sendRawTx [signRawTx]
  • Finally, wait for the miner to pack your transaction into the block.
How to call QNG's RPC in the JavaScript runtime environment of meerevm ?
~ ./qng --testnet --evmenv="--http --http.port=18545 --http.api=net,web3,eth,qng"
~ ./qng attach http://127.0.0.1:18545

Welcome to the Geth JavaScript console!

instance: meereth/v1.10.9-stable/darwin-amd64/go1.16.2
at block: 0 (Thu Jan 01 1970 08:00:00 GMT+0800 (CST))
 datadir: /bin/data/testnet
 modules: eth:1.0 net:1.0 qng:1.0 rpc:1.0 web3:1.0

To exit, press ctrl-d or type exit
> qng.getNodeInfo
...
...

How to export the data of blocks from node
~ ./qng blockchain export
or
~ ./qng blockchain export --path=[Output directory]
How to import the data of blocks to node
~ ./qng blockchain import
or
~ ./qng blockchain import --path=[Input directory]
How to upgrade the data of blocks to node
~ ./qng --testnet blockchain upgrade
First aid mode under consensus error
~ ./qng --testnet blockchain upgrade --aidmode

Directories

Path Synopsis
cmd
miner/common/go-flags
Package flags provides an extensive command line option parser.
Package flags provides an extensive command line option parser.
miner/common/socks
Current limitations:
Current limitations:
miner/core
* Qitmeer james
* Qitmeer james
miner/symbols/lib
* Qitmeer james
* Qitmeer james
payledger
* Copyright (c) 2020.
* Copyright (c) 2020.
qng
qx
rlpdump
rlpdump is a pretty-printer for RLP data.
rlpdump is a pretty-printer for RLP data.
Package common contains various helper functions.
Package common contains various helper functions.
encode/rlp
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
math
Package math provides integer math utilities.
Package math provides integer math utilities.
mclock
Package mclock is a wrapper for a monotonic clock source
Package mclock is a wrapper for a monotonic clock source
util/hexutil
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.
vm
core
dbnamespace
Package dbnamespace contains constants that define the database namespaces for the purpose of the blockchain, so that external callers may easily access this data.
Package dbnamespace contains constants that define the database namespaces for the purpose of the blockchain, so that external callers may easily access this data.
bip39
Package bip39 is the official Golang implementation of the BIP39 spec.
Package bip39 is the official Golang implementation of the BIP39 spec.
ecc
ecc/ed25519/internal
Package ed25519 implements the Ed25519 signature algorithm.
Package ed25519 implements the Ed25519 signature algorithm.
ecc/secp256k1
Package secp256k1 implements support for the elliptic curves needed for qitmeer.
Package secp256k1 implements support for the elliptic curves needed for qitmeer.
x16rv3/whirlpool
Package whirlpool implements the ISO/IEC 10118-3:2004 whirlpool cryptographic hash.
Package whirlpool implements the ISO/IEC 10118-3:2004 whirlpool cryptographic hash.
ffldb/treap
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
engine
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2018 The qitmeer developers This file is auto generate
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2018 The qitmeer developers This file is auto generate
log
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
Package dbnamespace contains constants that define the database namespaces for the purpose of the blockdag, so that external callers may easily access this data.
Package dbnamespace contains constants that define the database namespaces for the purpose of the blockdag, so that external callers may easily access this data.
meerevm
cmd
eth
evm
meer
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2022 The qitmeer developers This file is auto generate by : go run mkalloc.go
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2022 The qitmeer developers This file is auto generate by : go run mkalloc.go
Package metrics provides general system and process level metrics collection.
Package metrics provides general system and process level metrics collection.
p2p
discover
Package discover implements the Node Discovery Protocol.
Package discover implements the Node Discovery Protocol.
iputils
Package iputils contains useful functions for ip address formatting.
Package iputils contains useful functions for ip address formatting.
netutil
Package netutil contains extensions to the net package.
Package netutil contains extensions to the net package.
proto/v1
Code generated by fastssz.
Code generated by fastssz.
qnr
qx
rpc
api
services
cf
index
Package indexers implements optional block chain indexes.
Package indexers implements optional block chain indexes.
tx
zmq
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2022 The qitmeer developers This file is auto generate by : go run compile_solidity.go
It is called by go generate and used to automatically generate pre-computed Copyright 2017-2022 The qitmeer developers This file is auto generate by : go run compile_solidity.go
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.
vm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL