kovan-testnet / KIPs

The Kovan Improvement Proposal
19 stars 12 forks source link

FC: GitHub API Oraclize #3

Open 3esmit opened 7 years ago

3esmit commented 7 years ago

I'm researching a optimal way of creating a faucet for GitHub users with Oraclize.

I think a easy way to do it is to user register account using a gist file containing his address.

oraclize_query("URL", strConcat("https://gist.githubusercontent.com/",_github_user,"/",_gistid,"/raw/"));

Register could check in API what is the age of the user

With a registered account, he can claim free KETH every day, based in his last page(s) IssueCommentEvent

oraclize_query("URL", strConcat("json(https://api.github.com/users/",_github_user,"/events/public?page=1).$[?(@.type="IssueCommentEvent")].[repo][name]"));

?(@.type="IssueCommentEvent") would filter only Issues comments, this is important to avoid star/unstar event.
See other events type: https://developer.github.com/v3/activity/events/types/

image

We could interate over an array this response and check how many events are in "known" repositories, previously registered by faucet owner.

For each known repository in this list, user would earn one point:

There is the option to check user organizations in https://api.github.com/users/$user/orgs and search for known public organizations, such as ethereum, ethcore, etc, this would give the user like 100 KETH.

Also, adding a middle-man to connect with API is a option to check more details and just answer the points to the contract. I think is better to don't use a middle-man if possible, and try to relay only on oraclize, but then the options are limited and gas fees might be high.

keorn commented 7 years ago

Sounds great to me!

jdetychey commented 7 years ago

Nice indeed! It seems like it could not be exploited by using someone else's github link as the address to send KETH to is written in the gist. I'd love to see the rest though as from my experience this sort of scheme are kind of hard to secure. It's possible to totally impeach attacks though, notably by using ecrecover to give signed authorization tokens.

3esmit commented 7 years ago

Currently I'm working on GitHubOracle, that may be forked to a permissioned design with different rules of withdraw, as kovan paying for all fees for GitTokens claiming that can withdraw from a KETH faucet bank.