fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
Prathamesh Musale 57e66ac5d6 Pin laconicd version in stack (#18)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: #18
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-30 13:16:17 +00:00
..
scripts Add scripts to initialize stage2 testnet (#16) 2024-10-24 07:23:32 +00:00
README.md Add config for min gas price to accept for txs (#17) 2024-10-28 04:22:03 +00:00
records-demo.md Run laconic-console stack as part of fixturenet deployment (#1) 2024-06-25 06:43:22 +00:00
stack.yml Pin laconicd version in stack (#18) 2024-10-30 13:16:17 +00:00

fixturenet-laconicd-stack

Instructions for running a laconicd fixturenet along with registry CLI and console

Setup

  • Clone the stack repos:

    laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack
    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
    
  • Clone required repositories:

    # laconicd
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories
    
    # laconic cli and console
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories
    
  • Build the container images:

    # laconicd
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers
    
    # laconic cli and console
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers
    

    This should create the following docker images locally:

    • cerc/laconicd
    • cerc/laconic-registry-cli
    • cerc/webapp-base
    • cerc/laconic-console-host

Create a deployment

  • Create spec files for the deployment:

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

    # fixturenet-laconicd-spec.yml
    ...
    network:
      ports:
        laconicd:
          - '6060:6060'
          - '26657:26657'
          - '26656:26656'
          - '9473:9473'
          - '9090:9090'
          - '1317:1317'
    
    # laconic-console-spec.yml
    ...
    network:
      ports:
        console:
          - '8080:80'
    
  • Create deployment from the spec files:

    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file fixturenet-laconicd-spec.yml --deployment-dir fixturenet-laconicd-deployment
    
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment
    
    # Place them both in the same namespace (cluster)
    cp fixturenet-laconicd-deployment/deployment.yml laconic-console-deployment/deployment.yml
    
  • (Optional) Copy over an existing genesis file (.json) to data directory in deployment (fixturenet-laconicd-deployment/data/genesis-config):

    # Example
    cp genesis.json fixturenet-laconicd-deployment/data/genesis-config/genesis.json
    

Configuration

  • Inside the fixturenet-laconicd-deployment deployment directory, open config.env file and set the following env variable:

    # Optional
    
    # Set to true to enable adding participants functionality of the onboarding module (default: false)
    ONBOARDING_ENABLED=
    
    # Staking amount to use for the default validator account (default: 1000000000000000)
    STAKING_AMOUNT=
    
    # Enable authority auctions (default: false)
    AUTHORITY_AUCTION_ENABLED=true
    
    # Authority auctions commits duration (in secs) (default: 1hr)
    AUTHORITY_AUCTION_COMMITS_DURATION=3600
    
    # Authority auctions reveals duration (in secs) (default: 1hr)
    AUTHORITY_AUCTION_REVEALS_DURATION=3600
    
    # Authority grace period (set bond to authority within this) (in secs) (default: 2 * 1hr)
    AUTHORITY_GRACE_PERIOD=7200
    
    # Node moniker (default: "localtestnet")
    MONIKER=
    
    # Chain ID of the network (default: "laconic_9000-1")
    CHAINID=
    
    # Minimum gas price in alnt to accept for transactions (default: "0.001")
    MIN_GAS_PRICE=
    
  • Inside the laconic-console-deployment deployment directory, open config.env file and set following env variables:

    # Optional CLI configuration
    
    # laconicd user private key for txs
    CERC_LACONICD_USER_KEY=
    
    # laconicd bond id for txs
    CERC_LACONICD_BOND_ID=
    
    # Gas limit for txs (default: 200000)
    CERC_LACONICD_GAS=
    
    # Max fees for txs (default: 200alnt)
    CERC_LACONICD_FEES=
    
    # Gas price to use for txs (default: 0.001alnt)
    # Use for auto fees calculation, gas and fees not required to be set in that case
    # Reference: https://git.vdb.to/cerc-io/laconic-registry-cli#gas-and-fees
    CERC_LACONICD_GASPRICE=
    

Start the deployment

laconic-so deployment --dir fixturenet-laconicd-deployment start
laconic-so deployment --dir laconic-console-deployment start

Check status

  • To list down and monitor the running containers:

    # With status
    docker ps -a
    
    # Follow logs for laconicd container
    laconic-so deployment --dir fixturenet-laconicd-deployment logs laconicd -f
    
  • View the laconic console at http://localhost:8080

  • Use the cli service for registry CLI operations:

    # Example
    laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status"
    

Perform operations

  • Example (bond creation):

    # Get the PK from your node
    ALICE_PK=$(echo y | laconic-so deployment --dir fixturenet-laconicd-deployment exec laconicd "laconicd keys export alice --unarmored-hex --unsafe")
    
    # Create a bond:
    laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type alnt --quantity 1000000000000 --user-key $ALICE_PK" | jq -r '.bondId'
    

Demo

Clean up

  • Stop all services running in the background:

    # Stop the docker containers
    laconic-so deployment --dir fixturenet-laconicd-deployment stop
    
  • To stop all services and also delete data:

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