services:
  
  boba-bnb-archive-dtl:
    image: bobanetwork/data-transport-layer@sha256:33e7530795f387c660633fc855e5ea7e19de445a7985b1c8b142db26698839e6
    stop_grace_period: 5m    
    environment:
      DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: 'https://bsc-dataseed.binance.org'
#      DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: 'https://bsc-erigon3:8545'
#      DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: 'https://replica.bnb.boba.network'
#      DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: 'https://rpc-de-23.stakesquid.eu/bobabnb'
      DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: 'http://142.132.249.52:8547'
      DATA_TRANSPORT_LAYER__SYNC_FROM_L1: 'false'
      DATA_TRANSPORT_LAYER__SYNC_FROM_L2: 'true'
      DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 56288
      DATA_TRANSPORT_LAYER__POLLING_INTERVAL: 10000
      DATA_TRANSPORT_LAYER__ETH1_CTC_DEPLOYMENT_HEIGHT: 1305672
      DATA_TRANSPORT_LAYER__ADDRESS_MANAGER: '0xeb989B25597259cfa51Bd396cE1d4B085EC4c753'
      DATA_TRANSPORT_LAYER__BSS_HARDFORK_1_INDEX: 0
      DATA_TRANSPORT_LAYER__TURING_V0_HEIGHT: 0
      DATA_TRANSPORT_LAYER__TURING_V1_HEIGHT: 0
      DATA_TRANSPORT_LAYER__DB_PATH: '/db'
      DATA_TRANSPORT_LAYER__SERVER_PORT: 7878
      DATA_TRANSPORT_LAYER__CONFIRMATIONS: 0
      DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL: 2000
      DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS: 'true'
      DATA_TRANSPORT_LAYER__SERVER_HOSTNAME: '0.0.0.0'
    volumes:
      - ./boba/bnb:/opt/optimism/packages/data-transport-layer/state-dumps/
      - ${BOBA_BNB_MAINNET_L2GETH_ARCHIVE__DTL_DATA:-boba-bnb-mainnet-l2geth-archive_dtl}:/db
    networks:
      - chains

  boba-bnb-archive-client:
    depends_on:
      - boba-bnb-archive-dtl
    image: bobanetwork/l2geth@sha256:0c5c25d1db8244f819d84517aaafafbf0e73cf3dacc98051c80310d9d01a12fd
    entrypoint: sh ./geth.sh
    stop_grace_period: 5m    
    volumes:
      - ${BOBA_BNB_MAINNET_L2GETH_ARCHIVE__CLIENT_DATA:-boba-bnb-mainnet-l2geth-archive}:/root/.ethereum/
    environment:
      GETH_ALLOW_INSECURE_UNLOCK: 'true'
#      ETH1_HTTP: 'https://bsc-dataseed.binance.org'
      ETH1_HTTP: 'https://bsc-erigon3:8545'
      ETH1_CTC_DEPLOYMENT_HEIGHT: 1305672
      ROLLUP_TIMESTAMP_REFRESH: 5s
      ROLLUP_STATE_DUMP_PATH: http://boba-bnb-archive-dtl:8081/state-dump.latest.json
      ROLLUP_CLIENT_HTTP: http://boba-bnb-archive-dtl:7878
      ROLLUP_BACKEND: 'l2'
      ROLLUP_VERIFIER_ENABLE: 'false'
      RETRIES: 60
      # no need to keep this secret, only used internally to sign blocks
      BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27"
      BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F"
      ROLLUP_POLL_INTERVAL_FLAG: "10s"
      ROLLUP_ENFORCE_FEES: 'true'
      # turing
      TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020"
      # fee token
      L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023"
      BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024"
      # sequencer http endpoint
      SEQUENCER_CLIENT_HTTP: https://bnb.boba.network/
#      SEQUENCER_CIENT_HTTP: http://142.132.249.52:8547
      ETH1_SYNC_SERVICE_ENABLE: true
      ETH1_CONFIRMATION_DEPTH: 0

      ROLLUP_ENABLE_L2_GAS_POLLING: true

      ETHERBASE: 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf

      RPC_ENABLE: true
      RPC_ADDR: 0.0.0.0
      RPC_PORT: 8545
      RPC_API: eth,net,rollup,web3,debug
      RPC_CORS_DOMAIN: '*'
      RPC_VHOSTS: '*'

      WS: true
      WS_ADDR: 0.0.0.0
      WS_PORT: 8546
      WS_API: eth,net,rollup,web3
      WS_ORIGINS: '*'

      CHAIN_ID: 56288
      DATADIR: /root/.ethereum
      GASPRICE: 0
      GCMODE: full
      IPC_DISABLE: true
      NETWORK_ID: 56288
      NO_USB: true
      NO_DISCOVER: true
      TARGET_GAS_LIMIT: 11000000
      USING_OVM: true
    networks:                                                                                         
      - chains

  boba-bnb-archive:         
    restart: unless-stopped           
    image: nginx
    depends_on:
      - boba-bnb-archive-client
    expose:  
      - 80                                                                                            
    environment:                                                                                      
      PROXY_HOST: boba-bnb-archive-client
      RPC_PORT: 8545
      RPC_PATH: ""
      WS_PORT: 8546
      WS_PATH: ""
    networks:               
      - chains 
    volumes:               
      - ./nginx-proxy:/etc/nginx/templates            
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.boba-bnb-mainnet-l2geth-archive-stripprefix.stripprefix.prefixes=/boba-bnb-archive"
      - "traefik.http.services.boba-bnb-mainnet-l2geth-archive.loadbalancer.server.port=80"
      - "${NO_SSL:-traefik.http.routers.boba-bnb-mainnet-l2geth-archive.entrypoints=websecure}"
      - "${NO_SSL:-traefik.http.routers.boba-bnb-mainnet-l2geth-archive.tls.certresolver=myresolver}"
      - "${NO_SSL:-traefik.http.routers.boba-bnb-mainnet-l2geth-archive.rule=Host(`$DOMAIN`) && PathPrefix(`/boba-bnb-archive`)}"
      - "${NO_SSL:+traefik.http.routers.boba-bnb-mainnet-l2geth-archive.rule=PathPrefix(`/boba-bnb-archive`)}"      
      - "traefik.http.routers.boba-bnb-mainnet-l2geth-archive.middlewares=boba-bnb-mainnet-l2geth-archive-stripprefix, ipwhitelist"      


volumes:
  boba-bnb-mainnet-l2geth-archive:
  boba-bnb-mainnet-l2geth-archive_dtl:
