The next generation of the Qitmeer network implementation with the plug-able VMs under the MeerDAG consensus.
make sure you have go-lang version 1.21.x or above (1.22.x is recommended) installed on the system to build.
- Build from source
~ git clone https://github.com/Qitmeer/qng.git
~ cd qng
~ git submodule update --init --recursive
~ makeor
- Install the latest qng available here: https://github.com/Qitmeer/qng/releases
or
- Build with Docker:
~ docker build -t qng .Note : Swap 4G+ is required for running the mainent node otherwise you might need the 8G physical memory.
- 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
- check the running swap file
sudo swapon -s
- edit
/etc/fstabfile (optional)
sudo vi /etc/fstab
add a line to the end of /etc/fstab file
/swapfile swap swap defaults 0 0
- 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
- 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.
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]
- 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)
- 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.
~ ./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.
~ ./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
...
...
~ ./qng blockchain export
or
~ ./qng blockchain export --path=[Output directory]
~ ./qng blockchain import
or
~ ./qng blockchain import --path=[Input directory]
~ ./qng --testnet blockchain upgrade
~ ./qng --testnet blockchain upgrade --aidmode
~ ./qng --mcp
- Default MCP server URL: /mcp/sse
~ ./qng --amananet --genesis="./custom_amana.json"
Note:
- The guide requires the command-line utilities
qxandethkey(from the Go Ethereum project). - In the consensus section (in the
custom_amana.jsonfile), make sure to replace the signer with the Ethereum address you created (e.g.,0xb86...0). - The address you create must be different from
0xb86...0andAkAGe...9i. Always use your own address. - You need to obtain the mining address in the QNG (Amana network) format. here we use the
qxtool with your private key as pain-text input to generate it. Warning: You are fully responsible for keeping your private key secure. Handle it with extreme care. This guide is intended for demonstration purposes only, not for production use. The way private keys are handled here is not secure by design. - A functional PoA network requires at least three nodes. This guide only provides a basic starting point.
% qx entropy|qx ec-new > prv.key
% ethkey generate --privatekey=prv.key
Password:
Repeat password:
Address: 0xb8676De65f496FE79306b917ba475c9989F318C0
% ethkey inspect keyfile.json
Password:
Address: 0xb8676De65f496FE79306b917ba475c9989F318C0
Public key: 04122db12f9d52d3df8cfc195b1bfd0ff49d737f30f1f1423270f451f8d957857a34613369b25a90d5b28d8145f5f0d4fa26888771de29b602c82ec7c184b21481
% cat prv.key|qx ec-to-public|qx ec-to-ethaddr
0xb8676De65f496FE79306b917ba475c9989F318C0
% cat prv.key|qx ec-to-public -u
04122db12f9d52d3df8cfc195b1bfd0ff49d737f30f1f1423270f451f8d957857a34613369b25a90d5b28d8145f5f0d4fa26888771de29b602c82ec7c184b21481
%cat prv.key|qx ec-to-public|qx ec-to-pkaddr -v amananet
AkAGeNRBPBVQJ9Q2mtYVMcGBK9Fki9eGYFHu2XNoVbH7GydrsYC9i
echo "<your_keystore_password>" > ./password.txt
./qng --amananet -A . --generate --miner --miningaddr AkAGeNRBPBVQJ9Q2mtYVMcGBK9Fki9eGYFHu2XNoVbH7GydrsYC9i --genesis ./custom_amana.json --evmenv="--keystore . --unlock=0xb8676De65f496FE79306b917ba475c9989F318C0 --password=./password.txt"