nigiri icon indicating copy to clipboard operation
nigiri copied to clipboard

`nigiri start` launches on mainnet when running with `act`

Open luisschwab opened this issue 10 months ago • 2 comments

I am trying to use Nigiri to run some CLI wallet tests for BDK on CI. When running the script below directly on my system, it works and launches bitcoind on regtest as expected, but when running it as a GitHub action via act, it launches bitcoind on mainnet instead, even though ~/.nigiri/nigiri.config.json says "network":"regtest". Am I missing something here?

  test-wallet-rpc:
    needs: prepare
    name: Test example_wallet_cli
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          persist-credentials: false
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ needs.prepare.outputs.rust_version }}
          override: true
          profile: minimal
      - name: Rust Cache
        uses: Swatinem/[email protected]
      - name: Setup Docker
        uses: docker/setup-buildx-action@v2
      - name: Setup Nigiri
        run: |
          # Install dependencies
          #sudo apt update
          #sudo apt install -y jq
          
          # Install Nigiri and verify
          curl -sL https://getnigiri.vulpem.com | bash
          nigiri version
          
      - name: Run CLI test
        working-directory: example-crates/example_wallet_rpc
        run: |
          # Define environment variables
          export RPC_USER=admin1
          export RPC_PASS=123
          export RPC_URL=127.0.0.1:18443
          export WALLET_NAME="example_wallet_rpc"       

          # Start Nigiri and wait
          nigiri start
          sleep 5

          cat /root/.nigiri/nigiri.config.json

          nigiri rpc getblockchaininfo
[CI/Test example_wallet_cli]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/5] user= workdir=example-crates/example_wallet_rpc
[+] Running 4/4
|  ✔ Container bitcoin     Running0.0s 
|  ✔ Container electrs     Running0.0s 
|  ✔ Container esplora     Running0.0s 
|  ✔ Container chopsticks  Started0.0s 
| 🍣 nigiri configuration located at /root/.nigiri/nigiri.config.json
| 
| 🍜 ENDPOINTS
| ✓ bitcoin: localhost:18443
| ✓ esplora: localhost:5000
| ✓ chopsticks: localhost:3000
| ✓ electrs: localhost:50000
|
| {"ark":"false","ci":"false","liquid":"false","ln":"false","network":"regtest","ready":"true","running":"true"}
|
| {
|     "bestblockhash":  "00000000000000008d98c81d713149965414cae31d3dd531878629b783731bbf",
|     "blocks":  288941,
|     "chain":  "main",
|     "chainwork":  "0000000000000000000000000000000000000000000020e183942c83938869bc",
|     "difficulty":  3815723798.81463,
|     "headers":  886756,
|     "initialblockdownload":  true,
|     "mediantime":  1393969708,
|     "pruned":  false,
|     "size_on_disk":  18599616661,
|     "time":  1393972216,
|     "verificationprogress":  0.02898808519958874,
|     "warnings":  []
| }

luisschwab avatar Mar 07 '25 18:03 luisschwab

This is weird indeed. Can you check the data dir ~/.nigiri as it cointains the bitcoin.conf and docker-compose ?

tiero avatar Mar 07 '25 18:03 tiero

/root/.nigiri/volumes/bitcoin/bitcoin.conf:

| regtest=1
| testnet=0
| dnsseed=0
| upnp=0
| 
| [regtest]
| port=18444
| rpcport=18443
| 
| server=1
| txindex=1
| rest=1
| 
| rpcuser=admin1
| rpcpassword=123
| rpcallowip=0.0.0.0/0
| rpcbind=0.0.0.0
| fallbackfee=0.00001
| 
| zmqpubrawblock=tcp://0.0.0.0:28332
| zmqpubrawtx=tcp://0.0.0.0:28333
| 
| blockfilterindex=1
| peerblockfilters=1

/root/.nigiri/docker-compose.yml:

|name: nigiri
| services:
|   # RPC daemon
|   bitcoin:
|     image: getumbrel/bitcoind:v28.0
|     container_name: bitcoin
|     user: "${UID:-1000}:${GID:-1000}"
|     restart: on-failure
|     stop_grace_period: 30s
|     ports:
|       - 18443:18443
|       - 18444:18444
|       # ZMQ
|       - 28332:28332
|       - 28333:28333
|     volumes:
|       - ./volumes/bitcoin:/data/.bitcoin
| 
|   liquid:
|     image: ghcr.io/vulpemventures/elements:latest
|     container_name: liquid
|     user: "${UID:-1000}:${GID:-1000}"
|     command:
|       - -datadir=config
|     ports:
|       - 18884:18884
|       - 18886:18886
|       # ZMQ
|       - 38332:38332
|       - 38333:38333
|     volumes:
|       - ./volumes/elements/:/config
|     restart: unless-stopped
| 
|   # Block explorer server
|   electrs:
|     image: ghcr.io/vulpemventures/electrs:latest
|     container_name: electrs
|     entrypoint:
|       - /build/electrs
|     command:
|       - -vvvv
|       - --network
|       - regtest
|       - --daemon-dir
|       - /config
|       - --daemon-rpc-addr
|       - bitcoin:18443
|       - --cookie
|       - admin1:123
|       - --http-addr
|       - 0.0.0.0:30000
|       - --electrum-rpc-addr
|       - 0.0.0.0:50000
|       - --cors
|       - "*"
|       - --jsonrpc-import
|     depends_on:
|       - bitcoin
|     ports:
|       - 50000:50000
|       - 30000:30000
|     volumes:
|       - ./volumes/bitcoin/:/config
|     restart: unless-stopped
| 
|   electrs-liquid:
|     image: ghcr.io/vulpemventures/electrs-liquid:latest
|     container_name: electrs-liquid
|     entrypoint:
|       - /build/electrs
|     command:
|       - -vvvv
|       - --parent-network
|       - regtest
|       - --network
|       - liquidregtest
|       - --daemon-dir
|       - /config
|       - --daemon-rpc-addr
|       - liquid:18884
|       - --cookie
|       - admin1:123
|       - --http-addr
|       - 0.0.0.0:30001
|       - --electrum-rpc-addr
|       - 0.0.0.0:50001
|       - --cors
|       - "*"
|       - --jsonrpc-import
|     depends_on:
|       - liquid
|     ports:
|       - 50001:50001
|       - 30001:30001
|     volumes:
|       - ./volumes/elements/:/config
|     restart: unless-stopped
| 
|   # Block explorer frontend
|   esplora:
|     image: ghcr.io/vulpemventures/esplora:latest
|     container_name: esplora
|     depends_on:
|       - chopsticks
|     environment:
|       API_URL: http://localhost:3000
|     ports:
|       - 5000:5000
|     restart: unless-stopped
| 
|   esplora-liquid:
|     image: ghcr.io/vulpemventures/esplora:latest
|     container_name: esplora-liquid
|     depends_on:
|       - chopsticks-liquid
|     environment:
|       API_URL: http://localhost:3001
|     ports:
|       - 5001:5000
|     restart: unless-stopped
| 
|   # Chopsticks
|   chopsticks:
|     image: ghcr.io/vulpemventures/nigiri-chopsticks:latest
|     container_name: chopsticks
|     command:
|       - --use-faucet
|       - --use-mining
|       - --use-logger
|       - --rpc-addr
|       - bitcoin:18443
|       - --electrs-addr
|       - electrs:30000
|       - --addr
|       - 0.0.0.0:3000
|     depends_on:
|       - bitcoin
|       - electrs
|     ports:
|       - 3000:3000
|     restart: unless-stopped
| 
|   chopsticks-liquid:
|     image: ghcr.io/vulpemventures/nigiri-chopsticks:latest
|     container_name: chopsticks-liquid
|     command:
|       - --use-faucet
|       - --use-mining
|       - --use-logger
|       - --rpc-addr
|       - liquid:18884
|       - --electrs-addr
|       - electrs-liquid:30001
|       - --addr
|       - 0.0.0.0:3000
|       - --chain
|       - liquid
|     depends_on:
|       - liquid
|       - electrs-liquid
|     ports:
|       - 3001:3000
|     restart: unless-stopped
| 
|   lnd:
|     container_name: lnd
|     image: lightninglabs/lnd:v0.18.4-beta.rc2
|     user: "${UID:-1000}:${GID:-1000}"
|     depends_on:
|       - bitcoin
|     volumes:
|       - ./volumes/lnd:/data/.lnd
|     environment:
|       HOME: /data
|     restart: unless-stopped
|     stop_grace_period: 5m30s
|     ports:
|       - "9735:9735" # p2p
|       - "10009:10009" # grpc"
|       - "18080:18080" # rest"
| 
|   tap:
|     container_name: tap
|     image: lightninglabs/taproot-assets:v0.4.1
|     user: "${UID:-1000}:${GID:-1000}"
|     depends_on:
|       - bitcoin
|       - lnd
|     volumes:
|       - ./volumes/tapd:/data/.tapd
|       - ./volumes/lnd:/data/.lnd
|     environment:
|       HOME: /data
|     command:
|       - --network=regtest
|       - --debuglevel=debug
|       - --lnd.host=lnd:10009
|       - --lnd.macaroonpath=/data/.lnd/data/chain/bitcoin/regtest/admin.macaroon
|       - --lnd.tlspath=/data/.lnd/tls.cert
|     restart: unless-stopped
|     stop_grace_period: 5m30s
|     ports:
|       - "10029:10029" # grpc
|       - "8089:8089" # rest"
| 
|   cln:
|     container_name: cln
|     image: elementsproject/lightningd:latest
|     user: "${UID:-1000}:${GID:-1000}"
|     environment:
|       EXPOSE_TCP: "true"
|       LIGHTNINGD_NETWORK: regtest
|       LIGHTNINGD_DATA: .lightning
|     command:
|       - --lightning-dir=.lightning
|       - --alias=nigiri
|       - --bind-addr=0.0.0.0:9935
|       - --bitcoin-rpcconnect=bitcoin:18443
|       - --bitcoin-rpcpassword=123
|       - --bitcoin-rpcuser=admin1
|       - --log-level=debug
|       - --network=regtest
|       - --grpc-host=0.0.0.0
|       - --grpc-port=9936
|     depends_on:
|       - bitcoin
|     ports:
|       - "9835:9835" # rpc
|       - "9935:9935" # p2p
|       - "9936:9936" # grpc
|     restart: unless-stopped
|     volumes:
|       - ./volumes/lightningd:/.lightning
|       - ./volumes/bitcoin:/etc/bitcoin
| 
|   ark:
|     container_name: ark
|     image: ghcr.io/ark-network/ark:v0.5.1
|     user: "${UID:-1000}:${GID:-1000}"
|     depends_on:
|       - bitcoin
|     environment:
|       ARK_ROUND_INTERVAL: "15"
|       ARK_LOG_LEVEL: "5"
|       ARK_NETWORK: "regtest"
|       ARK_PORT: "7070"
|       ARK_NO_TLS: "true"
|       ARK_NO_MACAROONS: "true"
|       ARK_TX_BUILDER_TYPE: "covenantless"
|       ARK_BITCOIND_RPC_USER: "admin1"
|       ARK_BITCOIND_RPC_PASS: "123"
|       ARK_BITCOIND_RPC_HOST: "bitcoin:18443"
|       ARK_BITCOIND_ZMQ_BLOCK: "tcp://bitcoin:28332"
|       ARK_BITCOIND_ZMQ_TX: "tcp://bitcoin:28333"
|       ARK_DATADIR: "/app/data"
|     volumes:
|       - ./volumes/ark/data:/app/data
|       - ./volumes/ark/wallet:/app/wallet-data
|     ports:
|       - "7070:7070"
|     restart: unless-stopped
| 
| networks:
|   default:
|     name: nigiri

luisschwab avatar Mar 07 '25 18:03 luisschwab