pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
114 stars 28 forks source link

Support request: Unable to stake pocketcoin #58

Closed dmaltsiniotis closed 2 years ago

dmaltsiniotis commented 2 years ago

Hello Pocketnet folks,

I have been operating a node for some months (since the end of June 2021) now and I am trying to track down why I cannot seem to be able to stake any pocketcoin. I think I have all configuration set up properly.

Server details

I am operating this node a virtual Linux server, running Debian Buster (10) on kernel 4.19.194-3. I am using pocketcoind and pocketcoin-cli in a non GUI, headless, environment. The server has 4 vCPUs and 24 GB of RAM, and pocketcoind is the only notable process running.

Configuration

The main configuration is as follows:

server=1
listen=1
wsuse=1
port=37070
rpcport=37071
publicrpcport=38081
wsport=8087

rpcthreads=1
rpcworkqueue=1
rpcpostthreads=3
rpcpostworkqueue=100
rpcpublicthreads=5
rpcpublicworkqueue=100

Wallet info

I have a sneaking suspicion, that this is where I potentially messed something up. Here is the result of getwalletinfo:

{
  "walletname": "",
  "walletversion": 169900,
  "balance": 192.40810200,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 2,
  "keypoololdest": 1624486557,
  "keypoolsize": 999,
  "keypoolsize_hd_internal": 1000,
  "paytxfee": 0.00000000,
   ...
  "private_keys_enabled": true
}

And listaddressgroupings:

[
  [
    [
      "<Address redacted, yes I know it's public record>",
      192.40810200,
      "master"
    ]
  ]
]

Staking info

getstakinginfo:

{
  "enabled": true,
  "staking": true,
  "errors": "",
  "currentblockweight": 9820,
  "currentblocktx": 5,
  "difficulty": 113050.5056460741,
  "search-interval": 16,
  "weight": 19240810200,
  "netstakeweight": 113926700903269,
  "expectedtime": 888164
}

Assuming that "expectedtime" is listed in seconds, this equates to approximately ~10.2 days. This number fluctuates between 12 and 10 days.

And getstakereport:

{
  "2021-10-07T00:00:00Z": "0.00",
  ... (every day is "0.00")
  "2021-09-08T00:00:00Z": "0.00",
  "Last 24H": "0.00",
  "Last 7 Days": "0.00",
  "Last 30 Days": "0.00",
  "Last 365 Days": "0.00",
  "Latest Stake": "0.00",
  "Latest Time": "Never",
  "Stake counted": 0,
  "time took (ms)": 0
}

Console output

Now that the node is fully synchronized again, here are a few of lines of the most recent output. I am not sure what is meant by "Available coins count 2" when casually looking at the stdout of the process. When I first spun up the node, it was zero, then as I added pocketcoins to the staking wallet, it went from zero, to one, to now, two.

2021-10-07T06:13:52Z Available coins count 2 BestHeader: 1384429 44d7e4775b615d446066b29ad141225d305eb247a0fbfc9cc90d4a2a5c40bd36
2021-10-07T06:14:08Z Available coins count 2 BestHeader: 1384430 ddddd5e2a0737c066fdd0383aa62cbb0c771a00583046ca8d74ee73c917b1599
2021-10-07T06:14:24Z Available coins count 2 BestHeader: 1384430 ddddd5e2a0737c066fdd0383aa62cbb0c771a00583046ca8d74ee73c917b1599

Odd logs

Today by accident, I noticed in the console window the following message: 2021-10-07T05:14:24Z CreateCoinStake : no support for kernel type=3

When I searched the debug logs for this, I found many other instances:

2021-08-11T19:33:20Z CreateCoinStake : no support for kernel type=3
2021-08-18T13:28:00Z CreateCoinStake : no support for kernel type=3
2021-08-25T20:47:28Z CreateCoinStake : no support for kernel type=3
2021-08-27T01:02:40Z CreateCoinStake : no support for kernel type=3
2021-09-17T02:36:16Z CreateCoinStake : no support for kernel type=3
2021-10-03T23:19:17Z CreateCoinStake : no support for kernel type=3
2021-10-04T07:45:53Z CreateCoinStake : no support for kernel type=3
2021-10-07T05:14:24Z CreateCoinStake : no support for kernel type=3

This is just a guess, but it seems like this message comes up at about the frequency I would expect staking the happen at. Trying to track down the source in the master branch for this yields this location, but I'm having trouble making sense of it, and again I don't know if this is even related to my issue: https://github.com/pocketnetteam/pocketnet.core/blob/98680615c5b7b15945abf1f89c324e457dea692a/src/wallet/wallet.cpp#L4610

My asks

1) What does "Available coins count X" mean in the output logs. 2) May I get some help in resolving why this node is not staking properly?

Thank you,

Demetri

andyoknen commented 2 years ago
  1. The stacking algorithm involves the "outputs" of your transactions. Exits are blocked when creating a block for several hours as a guarantee of your work - a PoS transaction is generated in the created block that contains your blocked funds + remuneration. The log displays information about the number of outputs available for this algorithm. The minimum allowable output size is 5 PKOIN

  2. Does your address containing coins start with the letter P? In the network (by analogy with bitcoin) there are several types of public keys - P, Z

dmaltsiniotis commented 2 years ago

Thank you for the reply @andyoknen.

1. The stacking algorithm involves the "outputs" of your transactions. Exits are blocked when creating a block for several hours as a guarantee of your work - a PoS transaction is generated in the created block that contains your blocked funds + remuneration. The log displays information about the number of outputs available for this algorithm. The minimum allowable output size is 5 PKOIN

Interesting, thank you for the info, I'm still trying to wrap my head around the algorithm.

2. Does your address containing coins start with the letter P? In the network (by analogy with bitcoin) there are several types of public keys - P***, Z***

The address holding the coins starts with Z. At the recommendation of another node owner, I created a another wallet with the cli, and a new address, and transferred the coins from the Z address to the new one, which now starts with P. I am not sure what the difference is between the Z and P addresses. However, after doing this getstakinginfo returns "staking": false, and the Available Coins message in the logs shows 1.

andyoknen commented 2 years ago

Available Coins message in the logs shows 1. - I believe this is due to the fact that you transferred all the funds in one transaction with one output.

As for "staking": false - two options immediately come to mind: either an encrypted wallet, or the coins to the addresses did not lie for several hours before you checked the status.

dmaltsiniotis commented 2 years ago

An update on this: Staking unfortunately continues to be a problem. Sanity check: The transaction to new address has over 5k confirmations now, and I'm on the correct chain, and the coins are visible from other nodes.

The issue now is that running getstakinginfo is flip-flopping between "staking": false and "staking": true every few minutes. Something seems to very wrong here even though my setup is as vanilla as they come.

Hypothetically speaking, lets say someone just installed a fresh new node, synced it up, and is now fully participating in the network. What would be the steps to enable staking "from scratch" using only the pocketcoind and pocketcoin-cli commands (I'm in a headless environment)? I'm trying to see if there's any discrepancy between my setup and "established practice."

davkastheranger19 commented 2 years ago

Do you have the above ports forwarding from your router to your node?

dmaltsiniotis commented 2 years ago

Do you have the above ports forwarding from your router to your node?

Yes, the relevant ports are open and the node is fully connected to other nodes. It also shows up in the node list on block explorer as well as the bastyon client.

davkastheranger19 commented 2 years ago

The only thing different between your config and my config is this portion. rpcbind=127.0.0.1 rpcbind=LAN_IP_OF_NODE rpcallowip=127.0.0.1/24 # for access from only localhost rpcallowip=192.168.11.0/0 # for access from local network. CHANGE THIS TO MATCH YOUR LAN SUBNET rpchost=localhost

dmaltsiniotis commented 2 years ago

The only thing different between your config and my config is this portion. rpcbind=127.0.0.1 rpcbind=LAN_IP_OF_NODE rpcallowip=127.0.0.1/24 # for access from only localhost rpcallowip=192.168.11.0/0 # for access from local network. CHANGE THIS TO MATCH YOUR LAN SUBNET rpchost=localhost

Thanks for comparing, I don't currently have any problems with connectivity/issuing RPC commands or having nodes connect to me. The issue I'm experiencing is around wallet setup and staking I think.

davkastheranger19 commented 2 years ago

My only other suggestion (as a noob when it comes to blockchain) is to run the daemon in debug mode. pocketcoind -debug See if that gives you any insights or more information you can post here for troubleshooting.

dmaltsiniotis commented 2 years ago

Update:

My node was able to stake, finally, today. I think the wallet/address issues (switching from a Z to a P address) helped resolve this part of it.

The last remaining issue I have now is that getstakinginfo reports "staking": false most of the time, and I'm concerned that it won't stake or I'll miss opportunities to stake if it's reporting accurately:

getstakereport
{
  "2021-10-15T00:00:00Z": "0.00",
  "2021-10-14T00:00:00Z": "4.9902002",
  "2021-10-13T00:00:00Z": "0.00",
  "2021-10-12T00:00:00Z": "0.00",
  "2021-10-11T00:00:00Z": "0.00",
  "2021-10-10T00:00:00Z": "0.00",
  "2021-10-09T00:00:00Z": "0.00",
  "2021-10-08T00:00:00Z": "0.00",
  "2021-10-07T00:00:00Z": "0.00",
  "2021-10-06T00:00:00Z": "0.00",
  "2021-10-05T00:00:00Z": "0.00",
  "2021-10-04T00:00:00Z": "0.00",
  "2021-10-03T00:00:00Z": "0.00",
  "2021-10-02T00:00:00Z": "0.00",
  "2021-10-01T00:00:00Z": "0.00",
  "2021-09-30T00:00:00Z": "0.00",
  "2021-09-29T00:00:00Z": "0.00",
  "2021-09-28T00:00:00Z": "0.00",
  "2021-09-27T00:00:00Z": "0.00",
  "2021-09-26T00:00:00Z": "0.00",
  "2021-09-25T00:00:00Z": "0.00",
  "2021-09-24T00:00:00Z": "0.00",
  "2021-09-23T00:00:00Z": "0.00",
  "2021-09-22T00:00:00Z": "0.00",
  "2021-09-21T00:00:00Z": "0.00",
  "2021-09-20T00:00:00Z": "0.00",
  "2021-09-19T00:00:00Z": "0.00",
  "2021-09-18T00:00:00Z": "0.00",
  "2021-09-17T00:00:00Z": "0.00",
  "2021-09-16T00:00:00Z": "0.00",
  "Last 24H": "4.9902002",
  "Last 7 Days": "4.9902002",
  "Last 30 Days": "4.9902002",
  "Last 365 Days": "4.9902002",
  "Latest Stake": "4.9902002",
  "Latest Time": "2021-10-14T05:18:40Z",
  "Stake counted": 1,
  "time took (ms)": 0
}
getstakinginfo
{
  "enabled": true,
  "staking": false,
  "errors": "",
  "currentblockweight": 13844,
  "currentblocktx": 9,
  "difficulty": 139281.5358005261,
  "search-interval": 0,
  "weight": 19739829990,
  "netstakeweight": 162692676277133,
  "expectedtime": 0
}
dmaltsiniotis commented 2 years ago

Final update: No no other changes, things have seemed to stabilized with "staking": true, staying on pretty consistently. I've been able to stake twice now. I believe the root cause was the incorrect address type 'Z' originally used, instead of an 'P' account-type of address. Closing this now as my original issue seems to be resolved. There remain general node stability concerns, but that's for another thread/issue.

Thanks for everyone's input/assistance.

-DM