hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
293 stars 130 forks source link

Persisting Message "Waiting for bitcoin-node" #505

Closed Oyeins-GUI closed 1 year ago

Oyeins-GUI commented 1 year ago

Screenshot from 2022-08-02 17-42-25 I get this persisting message when I run the 'clarinet integrate' command on my terminal

Oyeins-GUI commented 1 year ago

Devnet.toml file

[network]
name = "devnet"
deployment_fee_rate = 10

[accounts.deployer]
mnemonic = "twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw"
balance = 100_000_000_000_000
# secret_key: 753b7cc01a1a2e86221266a154af739463fce51219d97e4f856cd7200c3bd2a601
# stx_address: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
# btc_address: mqVnk6NPRdhntvfm4hh9vvjiRkFDUuSYsH

[accounts.wallet_1]
mnemonic = "sell invite acquire kitten bamboo drastic jelly vivid peace spawn twice guilt pave pen trash pretty park cube fragile unaware remain midnight betray rebuild"
balance = 100_000_000_000_000
# secret_key: 7287ba251d44a4d3fd9276c88ce34c5c52a038955511cccaf77e61068649c17801
# stx_address: ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5
# btc_address: mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC

[accounts.wallet_2]
mnemonic = "hold excess usual excess ring elephant install account glad dry fragile donkey gaze humble truck breeze nation gasp vacuum limb head keep delay hospital"
balance = 100_000_000_000_000
# secret_key: 530d9f61984c888536871c6573073bdfc0058896dc1adfe9a6a10dfacadc209101
# stx_address: ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG
# btc_address: muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG

[accounts.wallet_3]
mnemonic = "cycle puppy glare enroll cost improve round trend wrist mushroom scorpion tower claim oppose clever elephant dinosaur eight problem before frozen dune wagon high"
balance = 100_000_000_000_000
# secret_key: d655b2523bcd65e34889725c73064feb17ceb796831c0e111ba1a552b0f31b3901
# stx_address: ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC
# btc_address: mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7

[accounts.wallet_4]
mnemonic = "board list obtain sugar hour worth raven scout denial thunder horse logic fury scorpion fold genuine phrase wealth news aim below celery when cabin"
balance = 100_000_000_000_000
# secret_key: f9d7206a47f14d2870c163ebab4bf3e70d18f5d14ce1031f3902fbbc894fe4c701
# stx_address: ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND
# btc_address: mg1C76bNTutiCDV3t9nWhZs3Dc8LzUufj8

[accounts.wallet_5]
mnemonic = "hurry aunt blame peanut heavy update captain human rice crime juice adult scale device promote vast project quiz unit note reform update climb purchase"
balance = 100_000_000_000_000
# secret_key: 3eccc5dac8056590432db6a35d52b9896876a3d5cbdea53b72400bc9c2099fe801
# stx_address: ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB
# btc_address: mweN5WVqadScHdA81aATSdcVr4B6dNokqx

[accounts.wallet_6]
mnemonic = "area desk dutch sign gold cricket dawn toward giggle vibrant indoor bench warfare wagon number tiny universe sand talk dilemma pottery bone trap buddy"
balance = 100_000_000_000_000
# secret_key: 7036b29cb5e235e5fd9b09ae3e8eec4404e44906814d5d01cbca968a60ed4bfb01
# stx_address: ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0
# btc_address: mzxXgV6e4BZSsz8zVHm3TmqbECt7mbuErt

[accounts.wallet_7]
mnemonic = "prevent gallery kind limb income control noise together echo rival record wedding sense uncover school version force bleak nuclear include danger skirt enact arrow"
balance = 100_000_000_000_000
# secret_key: b463f0df6c05d2f156393eee73f8016c5372caa0e9e29a901bb7171d90dc4f1401
# stx_address: ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ
# btc_address: n37mwmru2oaVosgfuvzBwgV2ysCQRrLko7

[accounts.wallet_8]
mnemonic = "female adjust gallery certain visit token during great side clown fitness like hurt clip knife warm bench start reunion globe detail dream depend fortune"
balance = 100_000_000_000_000
# secret_key: 6a1a754ba863d7bab14adbbc3f8ebb090af9e871ace621d3e5ab634e1422885e01
# stx_address: ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP
# btc_address: n2v875jbJ4RjBnTjgbfikDfnwsDV5iUByw

[accounts.faucet]
mnemonic = "shadow private easily thought say logic fault paddle word top book during ignore notable orange flight clock image wealth health outside kitten belt reform"
balance = 100_000_000_000_000
# secret_key: de433bdfa14ec43aa1098d5be594c8ffb20a31485ff9de2923b2689471c401b801
# stx_address: STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6
# btc_address: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d

[devnet]
disable_stacks_explorer = false
disable_stacks_api = false
disable_bitcoin_explorer = false
# working_dir = "tmp/devnet"
# stacks_node_events_observers = ["host.docker.internal:8002"]
# miner_mnemonic = "twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw"
# miner_derivation_path = "m/44'/5757'/0'/0/0"
# faucet_mnemonic = "shadow private easily thought say logic fault paddle word top book during ignore notable orange flight clock image wealth health outside kitten belt reform"
# faucet_derivation_path = "m/44'/5757'/0'/0/0"
# orchestrator_port = 20445
# bitcoin_node_p2p_port = 18444
# bitcoin_node_rpc_port = 18443
# bitcoin_node_username = "devnet"
# bitcoin_node_password = "devnet"
# bitcoin_controller_block_time = 30_000
# stacks_node_rpc_port = 20443
# stacks_node_p2p_port = 20444
# stacks_api_port = 3999
# stacks_api_events_port = 3700
# bitcoin_explorer_port = 8001
# stacks_explorer_port = 8000
# postgres_port = 5432
# postgres_username = "postgres"
# postgres_password = "postgres"
# postgres_database = "postgres"
# bitcoin_node_image_url = "quay.io/hirosystems/bitcoind:devnet-v2"
# stacks_node_image_url = "localhost:5000/stacks-node:devnet-v2"
# stacks_api_image_url = "hirosystems/stacks-blockchain-api:latest"
# stacks_explorer_image_url = "hirosystems/explorer:latest"
# bitcoin_explorer_image_url = "quay.io/hirosystems/bitcoin-explorer:devnet"
# postgres_image_url = "postgres:alpine"
# enable_hyperchain_node = true
# hyperchain_node_image_url = "hirosystems/hyperchains:0.0.4-stretch"
# hyperchain_leader_mnemonic = "female adjust gallery certain visit token during great side clown fitness like hurt clip knife warm bench start reunion globe detail dream depend fortune"
# hyperchain_leader_derivation_path = "m/44'/5757'/0'/0/0"
# hyperchain_contract_id = "STXMJXCJDCT4WPF2X1HE42T6ZCCK3TPMBRZ51JEG.hc-alpha"
# hyperchain_node_rpc_port = 30443
# hyperchain_node_p2p_port = 30444
# hyperchain_events_ingestion_port = 30445
# hyperchain_node_events_observers = ["host.docker.internal:8002"]

# Send some stacking orders
[[devnet.pox_stacking_orders]]
start_at_cycle = 3
duration = 12
wallet = "wallet_1"
slots = 2
btc_address = "mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC"

[[devnet.pox_stacking_orders]]
start_at_cycle = 3
duration = 12
wallet = "wallet_2"
slots = 1
btc_address = "muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG"

[[devnet.pox_stacking_orders]]
start_at_cycle = 3
duration = 12
wallet = "wallet_3"
slots = 1
btc_address = "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7"
lgalabru commented 1 year ago

Thanks @Oyeins-GUI! Do you think that you could also attach some logs from you bitcoin node? That'd be super helpful. docker logs -f bitcoin-node.<project>.devnet

lgalabru commented 1 year ago

Also, just to be sure, are you running the latest version of clarinet (v0.33.0)?

Oyeins-GUI commented 1 year ago

Also, just to be sure, are you running the latest version of clarinet (v0.33.0)?

Yes, I just installed it some weeks ago.

Oyeins-GUI commented 1 year ago

Thanks @Oyeins-GUI! Do you think that you could also attach some logs from you bitcoin node? That'd be super helpful. docker logs -f bitcoin-node.<project>.devnet

Yeah

Oyeins-GUI commented 1 year ago

Screenshot from 2022-08-02 21-56-08

This is the log

Oyeins-GUI commented 1 year ago

The logs kept on running. I had to just stop myself

radicleart commented 1 year ago

Hey- I'm running clarinet integrate on a Debian VM and experiencing the same problem - although with different log out put. Mine looks as follows..

2022-08-03T09:37:56Z Bitcoin Core version v0.21.1 (release build)
2022-08-03T09:37:56Z Validating signatures for all blocks.
2022-08-03T09:37:56Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
2022-08-03T09:37:56Z Using the 'shani(1way,2way)' SHA256 implementation
2022-08-03T09:37:56Z Using RdSeed as additional entropy source
2022-08-03T09:37:56Z Using RdRand as an additional entropy source
2022-08-03T09:37:56Z Default data directory /root/.bitcoin
2022-08-03T09:37:56Z Using data directory /root/.bitcoin/regtest
2022-08-03T09:37:56Z Config file: /etc/bitcoin/bitcoin.conf
2022-08-03T09:37:56Z Config file arg: disablewallet="0"
2022-08-03T09:37:56Z Config file arg: discover="0"
2022-08-03T09:37:56Z Config file arg: dns="0"
2022-08-03T09:37:56Z Config file arg: dnsseed="0"
2022-08-03T09:37:56Z Config file arg: fallbackfee="0.00001"
2022-08-03T09:37:56Z Config file arg: listen="1"
2022-08-03T09:37:56Z Config file arg: listenonion="0"
2022-08-03T09:37:56Z Config file arg: regtest="1"
2022-08-03T09:37:56Z Config file arg: rpcallowip="0.0.0.0/0"
2022-08-03T09:37:56Z Config file arg: rpcallowip="::/0"
2022-08-03T09:37:56Z Config file arg: rpcpassword=****
2022-08-03T09:37:56Z Config file arg: rpcserialversion="0"
2022-08-03T09:37:56Z Config file arg: rpcuser=****
2022-08-03T09:37:56Z Config file arg: rpcworkqueue="100"
2022-08-03T09:37:56Z Config file arg: server="1"
2022-08-03T09:37:56Z Config file arg: txindex="1"
2022-08-03T09:37:56Z Config file arg: [regtest] bind="0.0.0.0:18444"
2022-08-03T09:37:56Z Config file arg: [regtest] rpcbind=****
2022-08-03T09:37:56Z Config file arg: [regtest] rpcport="18443"
2022-08-03T09:37:56Z Command-line arg: conf="/etc/bitcoin/bitcoin.conf"
2022-08-03T09:37:56Z Command-line arg: datadir="/root/.bitcoin"
2022-08-03T09:37:56Z Command-line arg: debuglogfile=false
2022-08-03T09:37:56Z Command-line arg: pid="/run/bitcoind.pid"
2022-08-03T09:37:56Z Using at most 125 automatic connections (1048576 file descriptors available)
2022-08-03T09:37:56Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-08-03T09:37:56Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-08-03T09:37:56Z Script verification uses 1 additional threads
2022-08-03T09:37:56Z scheduler thread start
2022-08-03T09:37:56Z WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
2022-08-03T09:37:56Z HTTP: creating work queue of depth 100
2022-08-03T09:37:56Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-08-03T09:37:56Z HTTP: starting 4 worker threads
2022-08-03T09:37:56Z Using wallet directory /root/.bitcoin/regtest/wallets
2022-08-03T09:37:56Z init message: Verifying wallet(s)...
2022-08-03T09:37:56Z init message: Loading banlist...
2022-08-03T09:37:56Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/regtest/banlist.dat
2022-08-03T09:37:56Z Invalid or missing banlist.dat; recreating
2022-08-03T09:37:56Z SetNetworkActive: true
2022-08-03T09:37:56Z Using /16 prefix for IP bucketing
2022-08-03T09:37:56Z Cache configuration:
2022-08-03T09:37:56Z * Using 2.0 MiB for block index database
2022-08-03T09:37:56Z * Using 56.0 MiB for transaction index database
2022-08-03T09:37:56Z * Using 8.0 MiB for chain state database
2022-08-03T09:37:56Z * Using 384.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-08-03T09:37:56Z init message: Loading block index...
2022-08-03T09:37:56Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-08-03T09:37:56Z Opening LevelDB in /root/.bitcoin/regtest/blocks/index
2022-08-03T09:37:56Z Opened LevelDB successfully
2022-08-03T09:37:56Z Using obfuscation key for /root/.bitcoin/regtest/blocks/index: 0000000000000000
2022-08-03T09:37:56Z LoadBlockIndexDB: last block file = 0
2022-08-03T09:37:56Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2022-08-03T09:37:56Z Checking all blk files are present...
2022-08-03T09:37:56Z Initializing databases...
2022-08-03T09:37:56Z Pre-allocating up to position 0x1000000 in blk00000.dat
2022-08-03T09:37:56Z Opening LevelDB in /root/.bitcoin/regtest/chainstate
2022-08-03T09:37:56Z Opened LevelDB successfully
2022-08-03T09:37:56Z Wrote new obfuscate key for /root/.bitcoin/regtest/chainstate: 4a8ecaf8bb7b396c
2022-08-03T09:37:56Z Using obfuscation key for /root/.bitcoin/regtest/chainstate: 4a8ecaf8bb7b396c
2022-08-03T09:37:56Z init message: Rewinding blocks...
2022-08-03T09:37:56Z  block index              13ms
2022-08-03T09:37:56Z Opening LevelDB in /root/.bitcoin/regtest/indexes/txindex
2022-08-03T09:37:56Z Opened LevelDB successfully
2022-08-03T09:37:56Z Using obfuscation key for /root/.bitcoin/regtest/indexes/txindex: 0000000000000000
2022-08-03T09:37:56Z txindex thread start
2022-08-03T09:37:56Z txindex is enabled
2022-08-03T09:37:56Z txindex thread exit
2022-08-03T09:37:56Z loadblk thread start
2022-08-03T09:37:56Z UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1.000000 tx=1 date='2011-02-02T23:16:42Z' progress=1.000000 cache=0.0MiB(0txo)
2022-08-03T09:37:56Z block tree size = 1
2022-08-03T09:37:56Z nBestHeight = 0
2022-08-03T09:37:56Z Bound to 0.0.0.0:18444
2022-08-03T09:37:56Z Bound to 127.0.0.1:18445
2022-08-03T09:37:56Z init message: Loading P2P addresses...
2022-08-03T09:37:56Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/regtest/peers.dat
2022-08-03T09:37:56Z Invalid or missing peers.dat; recreating
2022-08-03T09:37:56Z Failed to open mempool file from disk. Continuing anyway.
2022-08-03T09:37:56Z loadblk thread exit
2022-08-03T09:37:56Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/regtest/anchors.dat
2022-08-03T09:37:56Z 0 block-relay-only anchors will be tried for connections.
2022-08-03T09:37:56Z init message: Starting network threads...
2022-08-03T09:37:56Z DNS seeding disabled
2022-08-03T09:37:56Z net thread start
2022-08-03T09:37:56Z addcon thread start
2022-08-03T09:37:56Z init message: Done loading
2022-08-03T09:37:56Z msghand thread start
2022-08-03T09:37:56Z opencon thread start
2022-08-03T09:38:57Z Adding fixed seed nodes as DNS doesn't seem to be available.
2022-08-03T10:10:11Z Potential stale tip detected, will try using extra outbound peer (last tip update: 1935 seconds ago)
radicleart commented 1 year ago

NB Installed clarinet v0.33.0 on debian via clarinet-linux-x64-glibc.tar.gz

lgalabru commented 1 year ago

Thanks. @radicleart @Oyeins-GUI could you both send me 5 of logs? In one console, run: clarinet integrate In another console, run: docker logs -f bitcoin-node.<project>.devnet > bitcoin-devnet.log for maybe 5 minute, then Ctrl+C, zip the file and share in that PR? That'd be useful. Are you sure that nothing else is running on port 18443? Thanks!

radicleart commented 1 year ago

Yes will do but the the bitcoin log file is as above the last line (potential stale tip) just repeats with a longer delay each time - ran it for over an hour.

I've since run bitcoin core on regtest using this compose file from LNow.. the bitcoin container starts up and mining starts up fine. The bitcoin.conf is very similar to yours.


services:
  bitcoin-core:
    image: ruimarinho/bitcoin-core:0.21.1-alpine
    container_name: bitcoin-core
    hostname: bitcoin-core
    volumes:
      - ./miner.sh:/bin/miner.sh
      - ./bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf
    ports:
      - "18444:18444"
      - "18443:18443"
    command:
      - miner.sh

  stacks-node:
    image: quay.io/hirosystems/stacks-node:devnet-v2
    container_name: stacks-node
    hostname: stacks-node
    volumes:
      - ./Stacks.toml:/src/stacks-node/Stacks.toml
    environment:
      - BLOCKSTACK_USE_TEST_GENESIS_CHAINSTATE=1
    entrypoint: 
      - stacks-node
      - start
      - --config=/src/stacks-node/Stacks.toml
    depends_on:
      - bitcoin-core
    ports:
      - "20444:20444"
      - "20443:20443"```
radicleart commented 1 year ago

regtest=1
rpcallowip=0.0.0.0/0
rpcallowip=::/0
rpcallowid=127.0.0.1
rpcuser=rpcuser
rpcpassword=rpcpassword
txindex=1
listen=1
discover=0
dns=0
dnsseed=0
listenonion=0
rpcserialversion=0
rpcworkqueue=100
disablewallet=0
fallbackfee=0.00001
#debug=1

[regtest]
bind=0.0.0.0:18444
rpcbind=0.0.0.0:18443
rpcport=18443```
lgalabru commented 1 year ago

so are you saying that you're running docker compose and clarinet integrate at the same time? that'd be an issue.

lgalabru commented 1 year ago

(@radicleart, per your logs, your issue is completely different from @Oyeins-GUI's issue)

radicleart commented 1 year ago

not at same time - only ran compose to try investigate why clarinet integrate didn't work.

radicleart commented 1 year ago

(@radicleart, per your logs, your issue is completely different from @Oyeins-GUI's issue)

sorry should i raise a separate issue?

lgalabru commented 1 year ago

@radicleart would you be opened to a screen-sharing debugging session? feel free to add me as a friend on Stacks discord to discuss this.

radicleart commented 1 year ago

@lgalabru not sure if you noticed but this was also reported by @LNow in Issue https://github.com/hirosystems/clarinet/issues/411

@LNow has debugged and dropped the following on discord..

ipv6

For some reason clarinet is trying to connect to bitcoin container using ip6

lgalabru commented 1 year ago

I see, thanks for the investigation @radicleart and @LNow. There's no magic trick on Clarinet's side there, we're simply dns-resolving localhost, which certainly ends up resolving to an ipv6 address and your Docker daemon would need to be configured accordingly (this bug is tractable on google - example here https://news.ycombinator.com/item?id=14950946). If the pristine ubuntu configuration + pristine docker configuration are not aligned by default, we can probably replicate what seems to be curl's workaround - fallback to ipv4 if ipv6 does not work.

radicleart commented 1 year ago
Screenshot 2022-08-05 at 15 11 52
radicleart commented 1 year ago

Disabled IPV6 networking on the linode and everything came up roses - great team effort!

See https://www.linode.com/community/questions/17409/how-do-i-remove-my-ipv6-from-my-linode

Oyeins-GUI commented 1 year ago

It did not work for me

lgalabru commented 1 year ago

Many improvements were implemented recently - I believe this issue is behind us now. Feel free to re-open if you're still experiencing this problem after updating clarinet.