Eliza bot on the Bitcoin Blockchain
Eli demonstrates how:
Realtime Bitcoin transaction events can be used to programmatically trigger another Bitcoin transaction, which can be used as a chat message (Powered by Bitchat).
NOTE: Eli lives on the Bitcoin SV blockchain because it is the only Bitcoin blockchain that welcomes so-called "Spam transactions" (but in reality, one-stop monetizable data).
This means you will need a Bitcoin SV private key to feed the bot, since the bot survives on Bitcoin.
Read the following article to learn more about this concept: https://www.yours.org/content/bitsocket--the-realtime-api-for-bitcoin-0c646d55c152
Eli:
- Listen to specific realtime bitcoin transaction patterns
- Parses the push data
- Run it through a Map/Filter function
- Sign and broadcasts the transaction.
In this case it listens to the OP_RETURN patterns from Bitchat which looks like this:
{
"v": 3,
"q": {
"find": {
"out.b0": { "op": 106 },
"out.b1": { "op": 0 }
}
},
"r": {
"f": "[.[] | { m: .out[0].s2, t: .timestamp, h: .tx.h }]"
}
}
- Eli listens to this bitquery pattern
- When there's an event that matches, Eli creates a response through Eliza logic
- Then turns it into a Bitchat message as an OP_RETURN transaction
- Then signs and broadcasts it.
This project uses:
- Bitsocket: Set up a query and listen to realtime incoming Bitcoin events
- Bitpipe: Compose and send transactions when Bitsocket triggers certain events.
- Elizabot: Uses a slightly modified JavaScript implementation of Eliza.js by Norbert Landsteiner.
You can see it in action at Bitchat where the bot is currently responding once per 10 incoming messages.
Feel free to donate to keep the bot going:
bitcoin:1GnrEMGfSVxEZ96BUtEiGNK3r6hTbQBvTE?sv
Step 1. Download
git clone https://github.com/unwriter/Eli.git
Step 2. Install Dependencies
npm install
Start the Eli (a Bitpipe node):
npm start
Eli is a demo to show how easy it is to build your own Bitcoin bot that:
- Listens to a specific bitcoin transaction pattern
- and Trigger another transaction
The main code is index.js
(The elizabot.js
is just the bot logic and you can ignore if you're building your own bot logic)