Skip to main content

Counter Transaction Device

The counter_transaction_device is a creative device that manages transactions using a persistent counter value. When activated, it checks if the persistent counter (identified by the CounterKey) has enough value to cover the defined Cost. If sufficient funds are available, it deducts the cost and triggers a success event; otherwise, it triggers a failure event.

Properties

Trigger

Type: trigger_device
The trigger device that, when activated, initiates the transaction process.

SuccessTrigger

Type: trigger_device
The trigger device that is activated if the transaction is successful (i.e., the persistent counter has enough value to cover the cost).

FailTrigger

Type: trigger_device
The trigger device that is activated if the transaction fails (i.e., the persistent counter does not have enough value).

Cost

Type: int
The amount to deduct from the persistent counter when a transaction is attempted.

CounterKey

Type: string
A key identifier used to store and retrieve the persistent counter value.
Default: "coin"