stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 667 forks source link

trying to mine the first genesis block #1 using custom stacks-core node for Bitnet IO network UTXOs arent detected when trying to run a miner node on mainnet or testnet xenon even if its funded with listunspent UTXOs #4452

Closed bitnet-io closed 7 months ago

bitnet-io commented 7 months ago

My custom version of stacks-core node refuses to mine the very first block for my network i am trying to deploy Stacks for Bitnet IO instead of Bitcoin network

this is a log of the miner trying to operate

https://raw.githubusercontent.com/bitnet-io/stacks-core-bitnet/master/debug-02-29-2024.txt

INFO [1709207237.167477] [stackslib/src/burnchains/bitcoin/spv.rs:1287] [main] Syncing Bitcoin headers: 100.0% (143879 out of 143879)
INFO [1709207250.252821] [testnet/stacks-node/src/run_loop/neon.rs:333] [main] Miner node: checking UTXOs at address: BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r
WARN [1709207250.256571] [testnet/stacks-node/src/run_loop/neon.rs:336] [main] UTXOs not found for BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r. If this is unexpected, please ensure that your bitcoind instance is indexing transactions for the address BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r (importaddress)

these are my constants

https://github.com/bitnet-io/stacks-core-bitnet/blob/master/stackslib/src/core/mod.rs#L116

need help to understand how this part of neon.rs detects the actual UTXOs

https://github.com/bitnet-io/stacks-core-bitnet/blob/master/testnet/stacks-node/src/run_loop/neon.rs#L334

this address on my network is actually funded with my local wallet

https://bitexplorer.io/address/BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r

┌─[✗]─[root@nwstrtrj01]─[~]
└──╼ #bitnet-cli -rpcwallet=legacy listunspent
[
  {
    "txid": "1a775a9b27844bd253bfe5accb8700f48f7ec71e862774b75062e4b69c33898c",
    "vout": 0,
    "address": "BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r",
    "label": "",
    "scriptPubKey": "76a914fd425dc57c44f0cf799c8b03ba0a91616cebce3d88ac",
    "amount": 5000.00000000,
    "confirmations": 517,
    "spendable": true,
    "solvable": true,
    "desc": "pkh([fd425dc5]02eff1752a8e01f6ddb2bf7b8837769a2ba2fb7b9a0306a89367f24aa8530ecf1e)#yytrxjgq",
    "parent_descs": [
    ],
    "safe": true
  },
  {
    "txid": "ef7020249cee55a9fb516887bbaf89d6f3a1470b1cef97b31e8868b37c011e0a",
    "vout": 0,
    "address": "BTYC5TcKAx3DEaCNeEejVGdo4572wefH9r",
    "label": "",
    "scriptPubKey": "76a914fd425dc57c44f0cf799c8b03ba0a91616cebce3d88ac",
    "amount": 5000.00000000,
    "confirmations": 517,
    "spendable": true,
    "solvable": true,
    "desc": "pkh([fd425dc5]02eff1752a8e01f6ddb2bf7b8837769a2ba2fb7b9a0306a89367f24aa8530ecf1e)#yytrxjgq",
    "parent_descs": [
    ],
    "safe": true
  }
]

my custom code is here

diwakergupta commented 7 months ago

Using stacks-node against bitnet is an unsupported use-case.

bitnet-io commented 7 months ago

Using stacks-node against bitnet is an unsupported use-case.

Even when I try to use bitcoin-qt with a testnet address and xenon mode for stacks-node it also doesnt detect UTXOs in a funded bitcoin-qt wallet either?

INFO [1709256718.978990] [stackslib/src/burnchains/bitcoin/indexer.rs:798] [main] New canonical Bitcoin chain found! New tip is 000000000000001a9ce8e3a84a65239d3c97ac1256ffce308b709a8c3ab04057
INFO [1709256720.079175] [stackslib/src/burnchains/burnchain.rs:1475] [main] Syncing Bitcoin blocks: 0.0% (2000001 to 2000002 out of 2579993)
INFO [1709256720.764741] [testnet/stacks-node/src/run_loop/neon.rs:333] [main] Miner node: checking UTXOs at address: mg1q78BMnSkET5vzMFsDjR2uXwZhxSaaN9
WARN [1709256720.768865] [testnet/stacks-node/src/run_loop/neon.rs:336] [main] UTXOs not found for mg1q78BMnSkET5vzMFsDjR2uXwZhxSaaN9. If this is unexpected, please ensure that your bitcoind instance is indexing transactions for the address mg1q78BMnSkET5vzMFsDjR2uXwZhxSaaN9 (importaddress)
INFO [1709256720.916375] [stackslib/src/chainstate/stacks/index/file.rs:262] [main] Migrate 0 blocks to external blob storage at /home/hiro-systems/bitcoin-testnet3/xenon/chainstate/vm/index.sqlite.blobs
INFO [1709256720.916488] [stackslib/src/chainstate/stacks/index/file.rs:191] [main] Preemptively vacuuming the database file to free up space after copying trie blobs to a separate file

you can see the bitcoin testnet address is funded here

https://mempool.space/testnet/address/mg1q78BMnSkET5vzMFsDjR2uXwZhxSaaN9

UTXOs from the command line

┌─[✗]─[root@nwstrtrj01]─[~]
└──╼ #bitcoin-cli -testnet -rpcwallet=legacy listunspent
[
  {
    "txid": "40de26859d86b51501dc9c0051cc1615f18699a86cf4bee3198624992e3eac0d",
    "vout": 0,
    "address": "mg1q78BMnSkET5vzMFsDjR2uXwZhxSaaN9",
    "label": "",
    "scriptPubKey": "76a91405760ff1f2a4c53f2ee4a544d8130d9f97d8617e88ac",
    "amount": 0.00083847,
    "confirmations": 145,
    "spendable": true,
    "solvable": true,
    "desc": "pkh([05760ff1]0303018bc010cd6257ad6a1643471b8f4389e0eb647a07f53ea7d337ac1e36e45f)#4l9uzjv2",
    "parent_descs": [
    ],
    "safe": true
  }
]
bitnet-io commented 7 months ago

Using stacks-node against bitnet is an unsupported use-case.

doesn't seem to matter if i use bitcoin or if i try to use it for my network.....it DOES NOT want to detect UTXOs on a funded wallet when i try to use miner = true

and it never seems to mine the first block on a new chain

only if mock_mining is equal to true or if i use mocknet instead of krypton or xenon

bitnet-io commented 7 months ago

Using stacks-node against bitnet is an unsupported use-case.

you can mark this issue as closed I was able to solve it and I was able to patch my version of Stacks blockchain for Bitnet IO

its working now and i mined the first genesis block for BitStacks network using Stacks technology for Bitnet IO

we were able to launch today 03-01-2024 https://github.com/bitnet-io/stacks-core-bitnet/releases/tag/03-01-2024-genesis

and 03-01-2024 is also the 1 year anniversary of Bitnet IO exactly to the day

its also our network's 1 year anniversary as we celebrate by also launching Stacks Blockchain for our network

bitnet-io commented 6 months ago

i released some notes about patching the different frameworks so any altcoin developer can have a slightly easier time to also integrate stacks layer 2 into any mainnet altcoin

https://github.com/bitnet-io/patching-stacks-frameworks-altcoin-guides