A Cardano blockchain indexer and reward system that monitors transactions and automatically sends rewards based on configurable criteria.
The application uses environment variables to configure its behavior. You can set these variables in your environment or create a .env file in the project root.
NETWORK: Cardano network to use (default:preprod)
Use one of the following:
INDEXER_TCP_ADDRESS: TCP address and port of the remote Cardano Node for the indexerINDEXER_SOCKET_PATH: Socket path of the local Cardano Node for the indexer
MIN_LOVELACE: Minimum Lovelace required to trigger a reward (default:50_000_000)REWARD_ADDRESS: Address to send rewards toREWARD_AMOUNT: Amount of Lovelace to send as a reward (default:5_000_000)SOURCE_ADDRESS: Source address to filter transactions
Use one of the following:
SUBMIT_TCP_ADDRESS: TCP address and port of the remote Cardano Node for transaction submissionSUBMIT_SOCKET_PATH: Socket path of the local Cardano Node for transaction submissionSUBMIT_URL: API URL for transaction submission
Use one of the following:
BLOCKFROST_API_KEY: Blockfrost API key for UTxO queriesKUPO_URL: Kupo URL for UTxO queries
MNEMONIC: Wallet mnemonic (if not set, will use or generateseed.txt)
- The main entry point is the
main()function - Loads configuration from environment variables and
.envfile - Sets up logging
- Initializes the wallet (loads or generates mnemonic)
- Starts the indexer
- Loads mnemonic from config or
seed.txt - If not present, generates a new mnemonic and writes it to
seed.txt - Initializes the wallet for use
- Creates a pipeline to listen for transaction events on the configured network and addresses
- Filters events for relevant addresses (wallet and reward)
- On transaction events, triggers the transaction builder
- Handles transaction events
- Checks if the transaction meets reward criteria (source address, minimum Lovelace, etc.)
- Builds a reward transaction if criteria are met
- Signs the transaction with the wallet keys
- Submits the built transaction to the network via TCP, socket, or API, depending on config
To build the application:
make buildTo run the application:
./workshopThe application will run continuously, monitoring the blockchain for transactions and automatically sending rewards when criteria are met.