Peerplays Development FAQs

Bitcoin-SON

How can I generate Bitcoin addresses?

Command:
1
./bitcoin-cli -rpcuser=1 -rpcpassword=1 -rpcwallet=default getnewaddress
Copied!
References:
bitcoin-cli getnewaddress – ChainQuery
getnewaddress — Bitcoin

How to get TEST BTC on the REGTEST network?

From developer.bitcoin.org...
For situations where interaction with random peers and blocks is unnecessary or unwanted, Bitcoin Core’s regression test mode (regtest mode) lets you instantly create a brand-new private block chain with the same basic rules as testnet—but one major difference: you choose when to create new blocks, so you have complete control over the environment.
Many developers consider regtest mode the preferred way to develop new applications. The following example will let you create a regtest environment after you first configure bitcoind.
1
bitcoind -regtest -daemon
Copied!
Start bitcoind in regtest mode to create a private block chain.
1
bitcoin-cli -regtest generatetoaddress 101 $(bitcoin-cli -regtest getnewaddress)
Copied!
Generate 101 blocks using a special RPC which is only available in regtest mode. This takes less than a second on a generic PC. Because this is a new block chain using Bitcoin’s default rules, the first blocks pay a block reward of 50 bitcoins. Unlike mainnet, in regtest mode only the first 150 blocks pay a reward of 50 bitcoins. However, a block must have 100 confirmations before that reward can be spent, so we generate 101 blocks to get access to the coinbase transaction from block #1.
1
bitcoin-cli -regtest getbalance
Copied!
Verify that we now have 50 bitcoins available to spend.
You can now use Bitcoin Core RPCs prefixed with bitcoin-cli -regtest.
Regtest wallets and block chain state (chainstate) are saved in the regtest subdirectory of the Bitcoin Core configuration directory. You can safely delete the regtest subdirectory and restart Bitcoin Core to start a new regtest. (See the Developer Examples Introduction for default configuration directory locations on various operating systems. Always back up mainnet wallets before performing dangerous operations such as deleting.)
Reference:
Testing Applications — Bitcoin

How can I generate / find the public key for a Bitcoin address?

Command:
1
./bitcoin-cli -rpcuser=1 -rpcpassword=1 -rpcwallet=default getaddressinfo "address"
Copied!
References:
bitcoin-cli getaddressinfo – ChainQuery
getaddressinfo — Bitcoin

If funds are deposited to a Bitcoin address, will there be logs?

What is the cli_command to generate a Bitcoin deposit address in the Peerplays blockchain?

Command Definition:
return type, namespace, & method
1
signed_transaction graphene::wallet::wallet_api::add_sidechain_address(
2
string account,
3
sidechain_type sidechain,
4
string deposit_public_key,
5
string withdraw_public_key,
6
string withdraw_address,
7
bool broadcast);
Copied!
Command Structure:
1
add_sidechain_address <account> <sidechain> <deposit_public_key> <withdraw_public_key> <withdraw_address> true
Copied!
Command Example:
1
add_sidechain_address myaccount123 bitcoin 03c8d1c33727788ca1f61e13bdeca0127047527a0880c816056b4015d6e2d36c1e 025cee805793fd94ca1933cc28ef9c065addd0e256195f1a541be0cd21867ac1c5 1EToWbQDvEwwie6jYsuM7WkZnh7rCn5Ecu true
Copied!
Reference:
CLI Commands for SONs
Peerplays Infrastructure Docs

If a Bitcoin deposit address is created for a Peerplays address (account) what are the logs in the Peerplays blockchain?

How to run a Peerplays blockchain node with RPC debugging turned on?

Gamified Proof of Stake (GPOS)

What are the blockchain logs when a successful GPOS Vesting is done?

Faucet

What are the logs in faucet when an account is successfully created?

One can use Curl command or POSTMAN in order to create a new account in the Faucet. With Curl you can do the following:
1
curl -X POST http://<IP_ADDRESS>:<PORT_NUMBER>/api/v1/accounts
2
-H 'content-type: application/json'
3
-d '{
4
"account": {
5
"name": "<ACCOUNT_NAME>",
6
"owner_key": "TEST5WaszCsqVN9hDkXZPMyiUib3dyrEA4yd5kSMgu28Wz47B3wUqa",
7
"active_key": "TEST5TPTziKkLexhVKsQKtSpo4bAv5RnB8oXcG4sMHEwCcTf3r7dqE",
8
"memo_key": "TEST5TPTziKkLexhVKsQKtSpo4bAv5RnB8oXcG4sMHEwCcTf3r7dqE"
9
}
10
}'
Copied!
IP_ADDRESS should be 127.0.0.1 or localhost when running it directly in a VM or on your local machine.
owner_key, active_key, memo_key should start with TEST on testnet, and it should be PPY on mainnet.
If the result of the above is successful, there should be output like this:
1
{
2
"account": {
3
"active_key": "TEST5TPTziKkLexhVKsQKtSpo4bAv5RnB8oXcG4sMHEwCcTf3r7dqE",
4
"memo_key": "TEST5TPTziKkLexhVKsQKtSpo4bAv5RnB8oXcG4sMHEwCcTf3r7dqE",
5
"name": "account-name4",
6
"owner_key": "TEST5WaszCsqVN9hDkXZPMyiUib3dyrEA4yd5kSMgu28Wz47B3wUqa",
7
"referrer": "nathan"
8
}
9
}
Copied!
And in case of any error, it will be following (i.e. duplicate account):
1
{"error":{"base":["Account exists"]}}
Copied!
You can also track the logs in Faucet container, with the following command:
1
docker logs --follow <Faucet-Container-ID>
2
For example: docker logs --follow 47c101add138
Copied!
And look for logs when receiving Create Account requests, with 200 status code as a result.
1
37.252.95.183 - - [06/Oct/2021 17:55:29] "OPTIONS /api/v1/accounts HTTP/1.1" 200 -
2
37.252.95.183 - - [06/Oct/2021 17:55:30] "POST /api/v1/accounts HTTP/1.1" 200 -
Copied!

Peerplays DEX

How do I setup a local DEX UI project?

This works with a Faucet and a local QA environment (create account & login).
First, pull the DEX repository from here.
After setting up the project, update the following variables in .env file:
1
FAUCET_URL='http://<IP_ADDRESS>:5000/api/v1/accounts'
2
BLOCKCHAIN_ENDPOINTS='ws://<IP_ADDRESS>:8090/api'
Copied!
IP_ADDRESS should be 127.0.0.1 or localhost when running it directly on your local machine.

Peerplays QA Environment

How do I transfer funds between accounts in a Peerplays QA Environment network?

In the QA environment setup by instructions in here, execute commands in Peerplays01 container with the following:
1
docker exec -it peerplaysqaenvironment_peerplays01_1 /bin/bash
Copied!
Then running into account’s wallet:
1
./cli_wallet list_account_balances <ACCOUNT_NAME>
2
For example: ./cli_wallet list_account_balances armin
Copied!
Unlock the wallet with the default password (which is "password"):
1
unlock password
Copied!
Get the private key for active key (public key):
1
get_private_key_from_password "<ACCOUNT_NAME>" active "<ACCOUNT_PASSWORD>"
Copied!
ACCOUNT_PASSWORD is the password defined when creating account in DEX UI.
Import the private key returned from previous step:
1
import_key <ACCOUNT_NAME> <PRIVATE_KEY>
2
For example:
3
import_key armin 5JckQ6g57P9YyyumHCRj1cNbHTiMEUVA2HjVDJqXDDPYizEaAMu
Copied!
Finally transfer with the following:
1
transfer <FROM_ACCOUNT_NAME> <TO_ACCOUNT_NAME> <AMOUNT> TEST "" true
2
For example: transfer armin nathan 10 TEST "" true
Copied!
memo key should be empty string for it to work. With list_core_accounts command you can check all account’s balances.
Last modified 9d ago