Tip bots usually work by storing all the funds on a central address that is controlled by the bot owner. The bot keeps a database of all the balances, but the users don’t actually own the money in their accounts. Users have to explicitly “withdraw” the money to get it into their own, secure, wallet. The downside is that the bot owner has full control over all the funds that are in circulation. So there is always a chance that the funds will get stolen.
In our approach, this is not the case. The user uses his own mobile/desktop/browser wallet and only he controls his private key. In the past, the problem with this approach was that there was no user friendly way of connecting tip bots with wallets to give them instructions.
We solve this problem by using “Beacon”. It allows developers to establish a connection between the server and the wallet. Once the connection is established, the bot can send requests to the wallet and the user simply needs to confirm them. We showcase the “tipping” functionality here, but it is not limited to simple spend transactions. The “tipping bot” can send any type of request, such as delegation requests or contract calls. This opens the door to many applications, such as a collectible trading bots or interactive games on the blockchain. Those bots could give live updates, status reports and offer intuitive ways of interacting with the smart contract, which then result in a single transaction that is sent to the users wallet.
The project is built in node.js (typescript). We built 3 microservices. The “beacon” service is the one managing the connections to the wallets, and storing a list of userIDs <=> tz addresses. Then there are 2 “provider” microservices to showcase the usage of our service on 2 different platforms. The 2 providers are “Discord” and “Telegram. The providers’ job is to receive and send messages to the user. When the user first interacts with one of the providers, he has to call the “connect” command and will be given a QR and JSON-code. The user can then either scan the QR code or copy/paste the JSON-code into his wallet, whatever is easier. This will establish the connection between the wallet and the backend. After this is done, the user can use the “tip” command, where he sends a specific amount to other users. This request is sent to the “beacon” service, which gets the corresponding addresses for the users and prepares/sends the request to the users wallet. All the state is managed in the “beacon service”, the 2 providers are stateless.
This architecture can easily be expanded to support other platforms, such as Slack, Facebook Messenger, but even websites such as Twitter.