stacks-network / stacks-core

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

Stacks-node unable to find Bitcoin wallet #3651

Closed igorsyl closed 9 months ago

igorsyl commented 1 year ago

Issue initially reported by Yuriy here: https://discord.com/channels/621759717756370964/691807526118883418/1080471748778148031

Describe the bug A clear and concise description of what the bug is.

i use custom wallet on btc node which is loaded from bitcoind.conf wallet=bitcoind/data/testnet3/wallets/my_wallet_name/ 2.1 node could find it while trying to list utxo it looks like it's trying to use default 'wallet' is there a way to continue using custom wallet? ERRO [1677673080.754803] [testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs:728] [main] Bitcoin RPC failure: error listing utxos Network("Bitcoin RPC: status(500) != success, body is 'Object({\"error\": Object({\"code\": Number(-18), \"message\": String(\"Requested wallet does not exist or is not loaded\")}), \"id\": String(\"stacks\"), \"result\": Null})'") wallet is loaded, as bitcoin-cli return correct balance and utxos

don't work either i've trying everything, changing wallet name to lowercase, set wallet_name=full path to wallet.dat

bitcoin-cli loadwallet shows that wallet is loaded, but stacks-node says Requested wallet does not exist or is not loaded

Steps To Reproduce Please provide detailed instructions (e.g. command line invocation with parameters) to reproduce the behavior.

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

Bitcoin v22.0.0 for testnet Bitcoin v21.1 for mainnet doesn't work for mainnet too

Additional context Please include any relevant stack traces, error messages and logs.

Hi, it doesn't seem to work or i am doing smth. wrong i loaded the wallet for bitcoind, in bitcoind.conf wallet=/bitcoind/data/testnet3/wallets/MY_WALLET_NAME/

in stacks-node config wallet_name = "MY_WALLET_NAME"

when starting the node DEBG [1678156411.470224] [testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs:2147] [main] BitcoinRPC builder 'listunspent': Some("user"):Some("password")@http://127.0.0.1:18332/wallet/MY_WALLET_NAME ERRO [1678156411.470837] [testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs:728] [main] Bitcoin RPC failure: error listing utxos Network("Bitcoin RPC: status(500) != success, body is 'Object({\"error\": Object({\"code\": Number(-18), \"message\": String(\"Requested wallet does not exist or is not loaded\")}), \"id\": String(\"stacks\"), \"result\": Null})'")

From Jude:

Hey! Both master (2.1.0.0.1) and the 2.1 release from a few weeks ago are stable. In both cases, you'll need to set always_use_affirmation_maps = false in the config file in the [node] section. I have a PR open that makes this the default, but it is not merged yet

If you are encountering an issue with a smart contract, please include the smart contract code that demonstrates the issue.

diwakergupta commented 1 year ago

Related PR, that does have an integration test for custom wallets: https://github.com/stacks-network/stacks-blockchain/pull/3597

Other relevant threads on Discord:

wileyj commented 1 year ago

from reporter:

since no default wallet is created by latest bitcoin-core it's quite challenging to spin-up a miner
it requires:
- start a miner in order to create bitcoin default wallet
- stop a miner
- import key to bitcoin wallet
- start a miner so it can track UTXOs in the wallet and start mining

will have to test and see if it can be reproduced or resolved.

wileyj commented 1 year ago

https://github.com/stacks-network/stacks-blockchain/pull/3694