bitcoin-computer / monorepo

A Turing-complete smart contract system for Bitcoin and Litecoin
https://docs.bitcoincomputer.io/
29 stars 18 forks source link

Pepecoin Issue #267

Open PepeEnthusiast opened 1 month ago

PepeEnthusiast commented 1 month ago

CHAIN and NETWORK in .env have no effect so I am starting the node with:

./scripts/up.py --testnet --pepecoin

When starting the node, the following error is logged:

bcn-1   | 09-07-2024 07:44:55 error Wallet creation failed with error 'Method not found'

Then as the node syncs the console is spammed with the following error for every transaction:

sync-1  | 09-07-2024 13:07:39 error [wid 1 pid: 29: failed to parse transaction in block 43333
sync-1  |             error message: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
sync-1  |             transaction: {"txid":"5b96393413bcabd197e0edc6aabc76968767e6c8450c615057635b243891bdaa","hash":"5b96393413bcabd197e0edc6aabc76968767e6c8450c615057635b243891bdaa","size":89,"vsize":89,"version":1,"locktime":0,"vin":[{"coinbase":"0345a900","sequence":4294967295}],"vout":[{"value":500000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 2e75729ad22574fe62ac8c8856c7a2e5ae26ecf2 OP_EQUALVERIFY OP_CHECKSIG","hex":"76a9142e75729ad22574fe62ac8c8856c7a2e5ae26ecf288ac","reqSigs":1,"type":"pubkeyhash","addresses":["nYRp3W82vFNJerdT3kqzKFM5zVXW8nYowj"]}}]}

After getting it to show a (unconfirmed) balance I uncomment the lines to mint and update and the script appears to work but the transaction is never broadcast to the other nodes. The transaction get stuck in the local mempool and never makes it onto the blockchain, so the transaction must be invalid somehow, this I think is unrelated to the above errors, it might be using an address type incompatible with Pepecoin when creating the transaction? I'm not sure.

index.html (click to expand) ```html Value: * ```

If you want try to make this work there is a testnet explorer here: https://testnet-blockbook.pepeblocks.com/address/nUFSJ3jNS5Ksnm3WiR7jvTgdW65zpdWr5j or here: https://testnet.pepeblocks.com/

ltardivo commented 4 weeks ago

Hi @PepeEnthusiast. We are investigating the errors.

1) CHAIN and NETWORK in .env

CHAIN and NETWORK in .env have no effect so I am starting the node with:

./scripts/up.py --testnet --pepecoin

This is an actual bug, thanks for reporting. We have created a related issue to fix this and simplify the configuration to prioritize the .env values.

2) RPC method not supported by pepe node

When starting the node, the following error is logged:

bcn-1   | 09-07-2024 07:44:55 error Wallet creation failed with error 'Method not found'

It looks like Pepecoin RPC does not support the method 'createwallet'. Tested with cli: # pepecoin-cli -regtest -rpcport=18332 -rpcuser=xxx -rpcpassword=xxx createwallet “mywallet” error code: -32601 error message: Method not found

A fresh run of the Bitcoin Computer Node creates a wallet with the name given in the .envfile DEFAULT_WALLET='defaultwallet'

But this action is only needed for regtest, in which we generate some blocks to setup the wallet, and detect mweb activation for Litecoin. In this case that you are running on testnet, the error is not relevant.

And I actually checked from the pepe node logs that the defaultwallet is created correctly:

2024-09-09 21:48:13 2024-09-10 00:48:13 Using BerkeleyDB version Berkeley DB 5.3.28: (September  9, 2013)
2024-09-09 21:48:13 2024-09-10 00:48:13 Using wallet defaultwallet
2024-09-09 21:48:13 2024-09-10 00:48:13 init message: Verifying wallet...
...
2024-09-09 21:48:13 2024-09-10 00:48:13 init message: Loading wallet...
2024-09-09 21:48:13 2024-09-10 00:48:13 nFileVersion = 1000100
2024-09-09 21:48:13 2024-09-10 00:48:13 Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total
2024-09-09 21:48:13 2024-09-10 00:48:13 Performing wallet upgrade to 60000

So, the error "error Wallet creation failed with error 'Method not found'" can be dismissed.

3) Error when syncing to PEPE testnet

Then as the node syncs the console is spammed with the following error for every transaction:

sync-1  | 09-07-2024 13:07:39 error [wid 1 pid: 29: failed to parse transaction in block 43333
sync-1  |             error message: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
sync-1  |             transaction: {"txid":"5b96393413bcabd197e0edc6aabc76968767e6c8450c615057635b243891bdaa","hash":"5b96393413bcabd197e0edc6aabc76968767e6c8450c615057635b243891bdaa","size":89,"vsize":89,"version":1,"locktime":0,"vin":[{"coinbase":"0345a900","sequence":4294967295}],"vout":[{"value":500000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 2e75729ad22574fe62ac8c8856c7a2e5ae26ecf2 OP_EQUALVERIFY OP_CHECKSIG","hex":"76a9142e75729ad22574fe62ac8c8856c7a2e5ae26ecf288ac","reqSigs":1,"type":"pubkeyhash","addresses":["nYRp3W82vFNJerdT3kqzKFM5zVXW8nYowj"]}}]}
  • Running the following html after the node has synced, the wallet balance shows 0 in the console even though the address has 200 PEPE on the blockchain. This is most likely due to the error above.

We are using the RPC getBlock with verbosity 2. It looks that the field we are using to get the transaction hex is not part of the response. Do you know if the Pepecoin RPC method getBlock support verbosity levels?

We can fix this, will require changes at the bcn service. We created this issue

  • If I send an additional 100 PEPE to the address and reload the page it will show balance 100 PEPE (the amount sent after the node has started, not total) but will remain unconfirmed forever even thought it would become confirmed on the blockchain. Most likely also related to the above.

This is related to the previous. The sync process is not parsing any transaction, so it is not registering them as confirmed when syncing.

3) Invalid transaction - Address type incompatibility

After getting it to show a (unconfirmed) balance I uncomment the lines to mint and update and the script appears to work but the transaction is never broadcast to the other nodes. The transaction get stuck in the local mempool and never makes it onto the blockchain, so the transaction must be invalid somehow, this I think is unrelated to the above errors, it might be using an address type incompatible with Pepecoin when creating the transaction? I'm not sure.

We will investigate this point, if you have any ideas, please let us know

If you want try to make this work there is a testnet explorer here: https://testnet-blockbook.pepeblocks.com/address/nUFSJ3jNS5Ksnm3WiR7jvTgdW65zpdWr5j or here: https://testnet.pepeblocks.com/

Super! thank you.

Let me know if there is something that needs more clarification.