gonode
contains two main applications, walletnode
and supernode
. These are designed to register NFTs on the Pastel blockchain. Neither walletnode
nor supernode
interact directly with the blockchain; instead, they use Pastel's RPC API to communicate with Pastel's cNode which handles the blockchain itself.
walletnode
is an API server that provides REST APIs on the client side. The APIs allow the user to search, view & download nfts as well as enable the users to register their own nfts. In addition, it also allows end-users or other applications to use Pastel Network's duplication detection system for the images as well as a storage system.
supernode
is a server application for walletnode
and its responsible for communication with the blockchain, duplication detection server, storage and other services.
- Get started with
golang
& install the latest version. - In order to generate mocks,
mockery
needs to be installed. - In order to generate proto, protoc compiler needs to be installed as well as protoc-gen-go & protoc-gen-go-grpc
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
pastel-api
simulates the Pastel RPC API which is provided by cNode and is used for local testing of walletnode and supernode.
make sn-unit-tests
execute sn unit tests including packages that it usesmake wn-unit-tests
execute wn-unit tests including packages that it usesmake integration-tests
execute integration testsmake build
verify if WN & SN are able to buildmake gen-mocks
remove existing mocks & generates all mocks for interfaces throughout gonode (mocks are used in unit tests)make gen-proto
generate all protobuf models & servicesmake clean-proto
removes all protobuf models & services
- Clone
regtest-network
cd <your-path>/mock-networks/regtest && mkidr unzipped && cd unzipped && tar -xvf ../node.tar.gz
.cp <your-path>/regtest/{masternode.conf <your-path>/regtest/unzipped/node14/regtest/
.cp <your-path>/regtest/{start.py, start_masternodes.sh} r <your-path>/regtest/
.cd <your-path>/regtest && ./start.py
../start_masternodes.sh
and retry if cNode(s) is not ready.- Verify if all masternode are
ENABLE
using<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node14 masternode list
, - Generate some block to drive the connections between masternode(s)
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node13 generate 1
- Verify top ranks masternode contains nodes whose
extAddr
islocalhost:{4444:4445:4446}
:<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node14 masternode top
. Those nodes are the ones supernode(s) will connect to. - Verify masternode{0,1,2} also have the same top node lis:
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node{0,1,2} masternode top
. - Start walletnode using:
GRPC_TRACE=tcp,http,api GRPC_VERBOSITY=debug WALLETNODE_DEBUG=1 ./walletnode/walletnode --log-level debug -c ./walletnode/examples/configs/localnet.yml --swagger 2>&1 | tee wallet-node.log
. - Start supernode(s) using:
SUPERNODE_DEBUG=1 LOAD_TFMODELS=0 ./supernode/supernode --log-level debug -c ./supernode/examples/configs/localnet-{4444,4445,4446}.yml 2>&1 | tee sn{1,2,3}.log
- Create an artist pastel Id:
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node14 pastelid newkey passphrase
. The passphrase of artist pastel id ispassphrase
, - Create an address:
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node14 getnewaddress
. - Register the artist with network:
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node14 tickets register id <artist-pastelId> "passphrase" <artist-address>
. - Send coin to artist's adress:
<your-path>/pastel-cli -datadir=<your-path>/regtest/unzipped/node13 sendtoaddress <artist-addr> <amount> "" "" true
. - Open your browser at
localhost:8080/swagger
. - Upload some image.
- Register task, change
artist-pastelId
,spendable-address
,passphrase
to "passphrase" andimage-id
using the result of upload REST call. - Observe the log and use the command to generate coin to drive the flow. The coin need to be generated at following points.
- Walletnode sends
preburnt-txid
to supernode(s). - Walletnode recieved
reg-art-txid
from supernode(s). - Walletnode recieved
reg-act-txid
from the network. - Each step generate 10 block is safe to drive the flow.
Notes:
- Walletnode's cNode is node 14.
- Miner is node 13.
- Node{0,1,2} are Node of supernoder{4444,4445,4446} accordingly.
Troubleshooting:
- If masternode(s) are
EXPIRE
then do step7
again. - If your masternode(s) failed to started due to metadab then remove these folder(s)
~/.pastel/supernode/metadb-444*
- If your masternode(s) failed to started due to kamedila then remove these folder(s)
~/.pastel/supernode/p2p-localnet-600*