We are building a service that allows for smart bounty execution on GitHub issues.
The main advantage over other bounty programs bounty source is that it's fully decentralized and completely free for everyone. It allows for trustless execution of payments once the work has been done.
There will be up to 3 user roles involved:
Note: the issue could potentially be opened by either the owner or the resolver, in which case we only have 2 roles.
An open issue has a unique URL that will be used for two purposes:
When the resolver opens a PR, he provides his public key in the PR body. This will later be used as a security measure to protect un-authorised actors from claiming the reward.
The resolver should ensure that his PR closes the issue by including a commit with msg such as closes #33
. This will automatically close the issue once that commit is merged into master.
The owner will create a Bounty label in his repository that will allow easy filtering for issues eligible for a bounty. This simply serves as a convenience.
No development needed for this component for the MVP - except for a good README write-up.
The smart contract keeps track of bounties (hashmap). The bounty key is the hash of the issue URL and the value is the bounty payout value.
The smart contract has two public methods:
Create
This creates a new entry in the hashmap. It requires the owner to lock up X tokens with the contract. These tokens can be unlocked only under two conditions:
It accepts the following parameters:
Release
Should be called by the resolver. This will trigger a call to the Chainlink oracle that reaches out to GitHub & verifies the merge.
There are two conditions for triggering the payout:
verify(message, public_key, signature) = true
where:
message
is the issue urlpublic_key
was provided in the PR bodysignature
is the digital signature provided in the call parameterParameters to the release method:
signature
The resolver needs to be able to provide his public key with the PR, as well as sign a message to generate a digital signature.
These are standard cryptographic protocols and the tutorial will provide detailed instructions for the computation of these.
The oracle acts as a data proxy between GitHub and the blockchain. When requested, it will query a github PR & issue, referenced by URLs provided with the call to the smart contract.
It will check whether the issue has been closed with a commit message. If so, it will any PRs & then check whether that PR has been merged. If so, return true
; else return false
to the smart contract. If no PRs are referencing this issue, return false
.
The logic:
false
.closed
event type. If available, retrieve the commit ID of the closing commit; else return false
is_closing_commit_within_pr_commit_list(commit_ID, commit_list)
We need a blockchain capable of deploying & executing smart contracts. Substrate will be the underlying blockchain, specifically the Edgeware network, which comes with the Contracts module as part of its runtime.
There is still a number of manual steps involved, potentially hindering the adoption of such a bounty model, in particular:
To circumvent #1, a tighter integration with GitHub would be needed in order to provide automatic calls to the blockchain together with asset locking.
If the resolver is able to provide his payment address inside the PR comments/description, another GitHub Workflow could trigger a call to the blockchain to transfer the funds upon merge. This call would require the authorization of the owner, rather than of the resolver. In this case, the owner would provide his private key to the GitHub Workflow as part of setting up the repository.The digital signature would be generated automatically upon merge.
This approach would eliminate #2 & #3.
The project closest to ours is StandardBounties on Ethereum.
While they provide a larger array of functionalities (such as allowing co-founding from 3rd parties of existing bounties - something that could be included in the second iteration of this project), the bounty workflow is even further away from the usual developer experience.
In particular:
We feel that by introducing Oracles which automatically verify PR merges, we successfully circumvent the need for IPFS & metadata tracking.