Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deploy Bidder Service

Prepare EC2 machine and install dependencies

  1. Launch an Ubuntu EC2 instance with appropriate security groups and a key pair.

  2. Install Go (>=1.16):

    sudo snap install go --classic
    mkdir -p "$HOME/go/bin"
    
  3. Install CockroachDB:

    curl -sL https://binaries.cockroachdb.com/cockroach-v24.2.3.linux-amd64.tgz \
      | sudo tar -xz --strip 1 -C /usr/local/bin cockroach-v24.2.3.linux-amd64/cockroach
    sudo chmod +x /usr/local/bin/cockroach
    
  4. Configure CockroachDB as a systemd service:

    sudo mkdir -p /var/log/crdb
    sudo touch /var/log/crdb/out.log /var/log/crdb/err.log
    
    sudo tee /etc/systemd/system/crdb.service << EOF
    [Unit]
    Description=CockroachDB single node
    After=network-online.target
    
    [Service]
    WorkingDirectory=/home/ubuntu
    ExecStart=/usr/local/bin/cockroach start-single-node --insecure --listen-addr=localhost:26257 \
        --http-addr=localhost:18080 --store=path=/home/ubuntu/db
    StandardOutput=append:/var/log/crdb/out.log
    StandardError=append:/var/log/crdb/err.log
    Restart=always
    User=ubuntu
    Group=ubuntu
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
    sudo systemctl enable crdb.service
    sudo systemctl start crdb.service
    
  5. Configure Go environment variables by appending the following to $HOME/.profile:

    export GOBIN=$HOME/go/bin
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOBIN
    

    Then reload:

    source $HOME/.profile
    

Setup binary, db, config and accounts

  1. Clone the bidder service repo from /home/ubuntu:

    git clone https://github.com/brevis-network/prover-network-bidder
    cd prover-network-bidder
    git checkout main
    
  2. Initialize the CockroachDB schema:

    cat $HOME/prover-network-bidder/dal/schema.sql | cockroach sql --insecure
    
  3. Build and install the bidder binary:

    cd ./cmd/service
    go build -o bidder
    cp ./bidder $HOME/go/bin
    cd ~
    
  4. Copy bidder configs:

    git clone https://github.com/brevis-network/prover-network-ops
    cp -a prover-network-ops/node-configs ~/.bidder
    
  5. Edit ~/.bidder/config.toml:

    You may use separate accounts for staking (prover) and for bidding/submitting proofs (submitter), or reuse the same Ethereum account for both.

    FieldDescription
    prover_urlPico proving service gRPC endpoint (${pico-ip}:${port}, default port 50052)
    prover_eth_addrEthereum address of the prover account
    submitter_keystorePath to the submitter keystore JSON (or AWS KMS reference)
    submitter_passphraseKeystore password (or apikey:apisec for AWS KMS)

    Optional tuning fields:

    FieldDescription
    prover_gas_pricePrice per prove cycle (bid fee = prove_cycles * prover_gas_price / 1e12). Cycles are auto-computed; set the price per your economics
    prove_min_durationSkip requests whose remaining time (reveal → deadline) is less than this many seconds
    max_input_size0 means no limit; otherwise skip requests with larger inputs
    max_feeSkip requests whose bid fee would exceed this ceiling
    vk_whitelistIf empty, accept all requests. Otherwise process only VKs on this list
    vk_blacklistSkip requests targeting VKs on this list

    Note: (1) Fees are denominated in the staking token. (2) A VK digest is generated when building the ELF and uniquely identifies a zk program.

Run the bidder service

  1. Create a systemd service:

    sudo mkdir -p /var/log/bidder
    sudo touch /var/log/bidder/app.log
    
    sudo tee /etc/systemd/system/bidder.service << EOF
    [Unit]
    Description=bidder daemon
    After=network-online.target
    
    [Service]
    Environment=HOME=/home/ubuntu
    ExecStart=/home/ubuntu/go/bin/bidder --config /home/ubuntu/.bidder/config.toml
    StandardOutput=append:/var/log/bidder/app.log
    StandardError=append:/var/log/bidder/app.log
    Restart=always
    RestartSec=3
    User=ubuntu
    Group=ubuntu
    LimitNOFILE=4096
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
  2. Create /etc/logrotate.d/bidder and add the following:

    /var/log/bidder/*.log {
        compress
        copytruncate
        daily
        maxsize 30M
        rotate 30
    }
    
  3. Enable and start the service:

    sudo systemctl enable bidder
    sudo systemctl start bidder