OriginProtocol / origin

Monorepo for our developer tools and decentralized marketplace application
https://www.originprotocol.com/developers
MIT License
652 stars 196 forks source link

Growth Rewards and Telegram #2799

Closed sparrowDom closed 5 years ago

sparrowDom commented 5 years ago

Overview: The purpose of this issue is to keep in one place the research and proposals of how Telegram can enhance Origin Rewards.

The cool thing is that Telegram enables the creation of bots that are actually very capable:

Implementation: Updates to a bot can be pulled calling Telegram's endpoint or pushed by exposing a webhook. The latter seems the more elegant option.

Possible integration with Origin Rewards:

On the plus side: once we implement a bot it should be rather easy to add a Telegram attestation in case we want to

BTW have reached out to Ping Zaur in case he has any new interesting ideas. Will update here.

sparrowDom commented 5 years ago

some possibilities on Telegram - Origin Rewards integration @franckc @matthewliu @micahalcorn @joshfraser

matthewliu commented 5 years ago

A couple random ideas for using TG bots.

Definitely think we should add Join TG and Join Korean TG per our engineering meeting.

shahthepro commented 5 years ago

@franckc @sparrowDom Telegram does have a webhook that posts events in a channel to a URL endpoint. The Message object returns an array new_chat_members of type User. This can be useful to get the id as well as username of the recently joined users.

The only missing part is now mapping the usernames to ETH addresses. We can probably add a Telegram attestation that uses Telegram's Authorization flow

So, Telegram's Authorization flow works like this:

  1. Ask the user to enter his phone number
  2. Use Telegram's sendCode() to send an authorization SMS to the registered phone number or the Telegram App.
    • We can also use sendCall() after a 30s timeout
  3. After the user enters the verification code, use Telegram's signIn method to verify it and get user details

This seems to be simplest way to do it.

We already have a code structure for webhooks in @origin/bridge. We could have this up and running quickly if we are going to take this approach. We don't have to run a bot for this.

shahthepro commented 5 years ago

One more thing, the above approach is good only for rewarding users for joining the telegram group. For other stuffs that @sparrowDom and @matthewliu have mentioned, we should probably have a bot and that will POST data back to the bridge can use the webhooks to get those events on bridge

shahthepro commented 5 years ago

Adding to the above stuffs, I do like the way of signing a message with user's ETH address and asking the user to post that in a channel. We would still receive these messages via webhook, so we can parse those in @origin/bridge.

If we don't want to stick with the Telegram's official Authorization flow, this is a far better alternative.

However, the channel could have many non-authorization messages that we will have to filter it out. We may have to use regex or pattern matching to find these authorization messages and then verify the sign.

sparrowDom commented 5 years ago

Nice research on this @shahthepro

Regarding the telegram attestation and following the group I think it is a better approach we solve it using Oauth flow and only have bots listening for the new_chat_member. This way users just need to join the group and we will automatically detect it. And they wont need to "spam" the telegram chat with cryptic codes/messages.

On the other hand we might be inclined towards having a lot of messages on Telegram, for that reason we might want users to post some kind of confirmation code we generate in the DApp on Telegram chat. The chat would look more active, but possibly with a less valuable content.

shahthepro commented 5 years ago

@sparrowDom

On the other hand we might be inclined towards having a lot of messages on Telegram, for that reason we might want users to post some kind of confirmation code we generate in the DApp on Telegram chat. The chat would look more active, but possibly with a less valuable content.

Agreed. I, for one, would immediately mute/quit out of a group, if most of the messages over there aren't valuable to me.

shahthepro commented 5 years ago

@micahalcorn Do you have any opinion on this? So we can add Telegram attestation in these two ways:

  1. Use Telegram's Authorization flow (screens will be similar to Email/Phone attestation).
  2. Ask the user to post a signed message to the channel (similar to Airbnb attestation). But we will end up polluting the channel with authorization messages

I'm more inclined to take the first approach. But would like to know about what you think.

Zaur-Iv commented 5 years ago

Please take a look, maybe this information can be useful.

Bitcoin Cash (BCH) fans created and shared a bunch of tokens, which has been created using the Simple Ledger Protocol (SLP). Bchpls.io payment platform now has bots for Telegram and Twitter, which are integrated with Badger wallet logo and support Bitcoin Cash SLP tokens.

Members of the crypto community create unique tokens using SLP software with names such as “Dragon Ball”, “Steam Cash”, “Nazgûl”, “Wonton” and other tokens. They were made for the 20 most popular cryptocurrency networks.

Coinspice, the cryptocurrency news outlet and Telegram channel, which associated with Coinspice, have a bot that allows to send donations to each other in tokens.

@Spicetokens user is a Telegram bot that gives user the hint for several tokens. Scrolling through the Coinspice channel, which has 397 participants, we see that Spicetokens bot is very active. The bot is also available on Twitter and some of the users are already sharing tokens on Twitter.

Badger begins integrating logos and token icons for nonprofit Eatbch.

On March 14, Badger wallet developer Gabriel Cardona explained that the latest version of Badger 0.4.2 has been released, which has official token icons for some tokens, such as spice, wonton, and SLP Torch.

Wallet developers have also added Eatbch Venezuela and Eatbch South Sudan icons to the client. Therefore, every time when user transfers funds to these specific addresses, he sees the Eatbch logos in the wallet's transaction log.

sparrowDom commented 5 years ago

@Zaur-Iv thanks for this info. If I understand correctly SLP created tokens are similar to ERC-20 tokens running on Etherium. And companies have supported transfering of those tokens via telegram bots.

micahalcorn commented 5 years ago

@shahthepro I prefer option 1️⃣ because we wouldn't get much, if any, value from the user generating the noise in option 2️⃣. In the Airbnb or Twitter case of using publicly-auditable proofs, the message is posted in a public arena that is viewable by people who are otherwise unaware of Origin. In the Telegram case, the entire audience, by definition, has already converted.

Zaur-Iv commented 5 years ago

Simple Ledger Protocol (SLP) https://simpleledger.cash/ Please, check this out @sparrowDom

franckc commented 5 years ago

@shahthepro @sparrowDom I talked with Micah and Matt and they confirmed their preference for Telegram's attestation is to go for option 1. So let's do that.

shahthepro commented 5 years ago

Thanks @franckc and @micahalcorn

Will go ahead with the first approach then.

micahalcorn commented 5 years ago

Considering this done ✅