testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet
Prathamesh Musale 29b2ce2927 Add a laconic-faucet stack (#7)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Reviewed-on: cerc-io/testnet-laconicd-stack#7
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-18 14:45:01 +00:00
..
README.md Add a laconic-faucet stack (#7) 2024-07-18 14:45:01 +00:00
stack.yml Add a laconic-faucet stack (#7) 2024-07-18 14:45:01 +00:00

laconic-faucet

Instructions for running the laconic faucet

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
    
  • Clone the laconic-faucet respository:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories
    
  • Build the container image:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet build-containers
    

    This should create the cerc/laconic-faucet image locally

Create a deployment

  • Create a spec file for the deployment:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy init --output laconic-faucet-spec.yml
    
  • Edit network in the spec file to map container ports to host ports as required:

    network:
      ports:
        laconic-faucet:
          - '3000:3000'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment
    

Configuration

  • Inside the laconic-faucet-deployment deployment directory, open config.env file and set following env variables:

    # Private key of a funded faucet account
    CERC_FAUCET_KEY=
    
    # Optional
    
    # laconicd RPC endpoint (default: http://laconicd:26657)
    CERC_LACONICD_RPC_ENDPOINT=
    
    # laconicd chain id (default: laconic_9000-1)
    CERC_LACONICD_CHAIN_ID=
    
    # Amount of tokens to transfer on a single request (default: 1000000)
    CERC_TRANSFER_AMOUNT=
    
    # Transfer limit for an address within a period (default: 3000000)
    CERC_PERIOD_TRANSFER_LIMIT=
    

Start the deployment

laconic-so deployment --dir laconic-faucet-deployment start

Check status

  • To list down and monitor the running container:

    # With status
    docker ps
    
    # Check logs for a container
    docker logs -f <CONTAINER_ID>
    

Run

  • Request tokens from the faucet for an account:

    curl -X POST http://localhost:3000/faucet \
      -H "Content-Type: application/json" \
      -d '{"address": "<laconicd_address>"}'
    
    # Expected output:
    # {"success":true,"txHash":"<tx_hash>"}
    

Clean up

  • Stop the laconic-faucet service running in the background:

    # Stop the docker container
    laconic-so deployment --dir laconic-faucet-deployment stop
    
  • To stop the service and also delete data:

    # Stop the docker containers
    laconic-so deployment --dir laconic-faucet-deployment stop --delete-volumes
    
    # Remove deployment directory (deployment will have to be recreated for a re-run)
    rm -r laconic-faucet-deployment