Skip to content

sresolt/janctionLayer1Faucet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚰 Janction Faucet

A lightweight HTTP faucet service for the Janction testnet, designed to distribute test tokens to users for development and testing purposes.

📦 Requirements

  • Go 1.20 or higher
  • A running Janction node (accessible at localhost:26657)

⚙️ Setup Instructions

1. Create a Faucet Account and Assign an Alias

Generate a new key named faucet using the test keyring backend:

janctiond keys add faucet \
  --keyring-backend test

2. Fund the Faucet from Another Account

Transfer tokens from an existing account (e.g., alice) to the faucet account:

janctiond tx bank send alice janction1t43dueljm7kya9ddkhxq24f8kmkhv44vjjcnfg 1000000jct \
  --from alice \
  --chain-id demo \
  --keyring-backend test \
  --node http://localhost:26657 \
  --yes
  • janction1t43dueljm7kya9ddkhxq24f8kmkhv44vjjcnfg is the address of the faucet account

3. Update Environmental Variables and Launch the Service

Ensure the configuration variables in your .env file are correct:

APP_NAME=test
CHAIN_ID=demo
FAUCET_ADDRESS=janction1t43dueljm7kya9ddkhxq24f8kmkhv44vjjcnfg
FAUCET_ADDRESS_ALIAS=faucet
TOKEN_AMOUNT_PER_REQUEST=1000
NODE_ADDRESS=localhost
NODE_PORT=26657
GRPC_ADDRESS=localhost
GRPC_PORT=9090
PUBLISH_ADDRESS=localhost
PUBLISH_PORT=8081

Install dependencies and run the faucet service:

go mod tidy
go run .

4. Send a GET Request to the Faucet

Use curl or your preferred HTTP client to request tokens:

curl "http://localhost:8081/faucet?address=janction1ev7mkxtccqud7d0j7pzxrd42e9ze4t4gah5dyl"

Replace janction1ev7mkxtccqud7d0j7pzxrd42e9ze4t4gah5dyl with the recipient’s Bech32 target address.

🛠️ Customization

You can customize the faucet by modifying the following parameters in .env:

  • TOKEN_AMOUNT_PER_REQUEST: Number of tokens dispensed per request

  • NODE_ADDRESS and NODE_PORT: Janction node RPC endpoint

  • GRPC_ADDRESS and GRPC_PORT: Janction node gRPC endpoint

  • PUBLISH_ADDRESS and PUBLISH_PORT: HTTP server settings for the faucet service

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages