Skip to content

CorDapp using the tokens SDK (https://github.com/corda/token-sdk) that issues GitCoins on contributions to a repository.

License

Notifications You must be signed in to change notification settings

willhr3/gitcoins-cordapp

 
 

Repository files navigation

Git-Coinsv3

GitCoins CorDapp

Pre-Requisites

See https://docs.corda.net/getting-set-up.html.

Download ngrok to expose your local end points to the web.

Usage

From the root directory run the following commands:

  • ./gradlew clean deployNodes
  • build/nodes/runnodes

Once built, start the spring boot web server Server.kt using the following command: ./gradlew runPartyAServer

Navigate to your ngrok installation and run the following command

  • ./ngrok http 8080

Copy the forwarding address, e.g. http://28c756d5.ngrok.io

GitHub Webhook Configuration

Navigate to the repository that you would like GitCoins to be rewarded for contributions. Configure the following webhooks via Settings > Webhooks > Add webhook:

  • pull_request_review_comments

    • payload URL: /api/git/create-key

    • content type: JSON

  • push

    • payload URL: /api/git/push-event

    • content type: JSON

  • pull_request_review

    • payload URL: /api/git/pr-event

    • content type: JSON

Issuing GitCoins

To generate a key for a GitHub user you will need first open a pull request review on the repo. Once open, the user must comment 'createKey' on a portion of the unified diff. (The GitHub Review Comments API is desribed here)

Now the user is linked to an AnonymousParty they will be issued 1 GitCoin for each push, or pull request review on the repo.

Alternatively, you can load up on GitCoins for free:

  • curl -d '{ "comment": { "user": { "login": "yourUserName" }, "body": "createKey" } }' -H "Content-Type: application/json" -X POST <ngrok forwarding address>/api/git/create-key
  • curl -d '{"pusher": { "name": “yourUserName” } }' -H "Content-Type: application/json" -X POST <ngrok forwarding address>/api/git/push-event
  • curl -d '{ "review": { "user": { "login": "yourUserName" } } }' -H "Content-Type: application/json" -X POST <ngrok forwarding address>/api/git/pr-event

Future work

  • Implement movement of tokens between parties
  • Implement redeem flows
  • Add security around the endpoints so you cannot do the above
  • Implement commit/ review evaluation logic to issue more tokens for a greater contribution

About

CorDapp using the tokens SDK (https://github.com/corda/token-sdk) that issues GitCoins on contributions to a repository.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 99.5%
  • Other 0.5%