Lights interacting with Cardano transactions


Can anyone tell me how I would go about getting a Cardano on chain transaction to activate a physical LED Light?


You need a script to read the on-chain transactions and when it detects it, to activate the LED light. There are no events to trigger something, you have to read the blockchain.

1 Like

Thanks for the replay. Could you give me more details on how I would go about doing this.
I am new to this and need a lot of help.

Is there a script out there that I could modify?
What type of hardware could the script interact with?
How hard is this task?

You can read the transactions with cardano-cli (to see if you receive ADA and native tokens at an address).
You could activate a led with an Arduino board.
But I do not know how you could make them work together.

You could run a node on a RaspberryPi and control the LED with its GPIO pins, but I don’t know if Pis are still powerful enough to run full nodes nowadays.

You could observe the blockchain with something like If you query once a minute you are far from their 50k limit for the free tier. (If you can get the information, you are searching for, with one request that is.)

1 Like

Nice. I have come across OTG_WCat who is running a full node on a RaspberryPi. I will have a closer look at what is possible with the GPIO pins.

Ill post a update with what I can find.

1 Like

If you like Python:

There’s a super simple/comfortable library to work with the GPIOs: GitHub - gpiozero/gpiozero: A simple interface to GPIO devices with Raspberry Pi
Also contains pointers to the various a little more low-level libraries that you could also use directly.

There’s also an implementation of the Blockfrost API for Python: GitHub - blockfrost/blockfrost-python: Python 3 SDK for the API.