Build a Gacha Machine
Last updated
Last updated
Before proceeding, ensure you have cloned the repository:
The Gacha machine implements a single-charge model, charging a fixed amount for a one-time action (e.g., dispensing an item). It simplifies the messaging and payment logic compared to DeCharge.
An online demo of these examples is available at:
Run DePHY vending machine workers by: docker compose up
The docker compose
setup and the App demo application integrate both DeCharge and Gacha use cases.
Ensure all dependencies are installed before running the application.
Message Definition: Same as DeCharge (DephyDechargeMessage
), but typically only processes Request
to Working
and Status
back to Available
.
Mention Tag (Machine Pubkey): Identifies the GaCha machine (e.g., PublicKey::parse("gacha_machine_pubkey")
).
Session Tag: Scopes events (e.g., "dephy-gacha-controller"
).
Publishing and Subscription
Sender: User requesting a dispense.
Receiver: Gacha node controller.
Message Handling: Processes a single transaction and reverts state.
Node: Unlike DeCharge, Gacha’s simpler transaction (one payment, one action) doesn’t require a separate server. The node handles both state and payment in a single step using pay
, making it lightweight.
Uses pay
for a one-time transaction: