You need to make sure you have installed Git and Go 1.21 or higher on your machine. If you want to install a GUI application, make sure you have installed GTK as well.
Follow these steps to compile and build Pactus:
git clone https://github.com/pactus-project/pactus.git
cd pactus
make buildThis will compile pactus-daemon, pactus-wallet and pactus-shell on your machine.
cd build
./pactus-daemon versionIf you want to compile the GUI application, run this command in the root folder:
make build_guiTo run the tests, use this command:
make testThis may take several minutes to finish.
pactus-daemon is a full node implementation of the Pactus blockchain.
You can use pactus-daemon to run a full node:
./pactus-daemon init -w=<working_dir>
./pactus-daemon start -w=<working_dir>To join the Testnet, first you need to initialize your node and then start the node:
./pactus-daemon init -w=<working_dir> --testnet
./pactus-daemon start -w=<working_dir>You can create a local node to set up a local network for development purposes on your machine:
./pactus-daemon init -w=<working_dir> --localnet
./pactus-daemon start -w=<working_dir>pactus-wallet is the CLI tool for creating and managing wallets on the Pactus blockchain.
To create a new wallet, run this command. The wallet will be encrypted by the provided password.
./pactus-wallet --path ~/pactus/wallets/wallet_1 createYou can create a new address like this:
./pactus-wallet --path ~/pactus/wallets/wallet_1 address newA list of addresses is available with this command:
./pactus-wallet --path ~/pactus/wallets/wallet_1 address allTo obtain the public key of an address, run this command:
./pactus-wallet --path ~/pactus/wallets/wallet_1 address pub <ADDRESS>To send a transaction, use the send subcommand.
For example, to send a bond transaction:
./pactus-wallet --path ~/pactus/wallets/wallet_1 send bond <FROM> <TO> <AMOUNT>You can recover a wallet if you have the seed phrase.
./pactus-wallet --path ~/pactus/wallets/wallet_2 recoverpactus-shell is an interactive command-line client for exploring and calling the Pactus gRPC APIs.
Start it against your node (default gRPC address is localhost:50051):
./pactus-shell interactive --server-addr localhost:50051You can run Pactus using a Docker image. Please make sure you have installed Docker on your machine.
Pull the image from Docker Hub:
docker pull pactus/pactus:mainLet's create a working directory at ~/pactus/testnet for the testnet:
docker run -it --rm -v ~/pactus/testnet:/root/pactus pactus/pactus:main pactus-daemon init --testnetNow we can run Pactus and join the testnet:
docker run -it -v ~/pactus/testnet:/root/pactus -p 8080:8080 -p 21777:21777 --name pactus-testnet pactus/pactus:main pactus-daemon startCheck "http://localhost:8080" for the list of APIs.
You can stop or start the container:
docker start pactus-testnet
docker stop pactus-testnetOr check the logs:
docker logs pactus-testnet --tail 1000 -fIf you need runtime profiling, enable the HTML server with pprof in your node configuration and restart the node. Once running, you can collect and explore a CPU profile with the pprof web UI (replace the host and port with your HTML server address):
go tool pprof -http :3000 "http://localhost:8081/debug/pprof/profile?debug=1"