Skip to content

as a user, i want to fund development work with bitcoin, because bitcoin is my preferred crypto currency #1966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
owocki opened this issue Aug 8, 2018 · 17 comments

Comments

@owocki
Copy link
Contributor

owocki commented Aug 8, 2018

User Story

as a user, i want to fund development work with bitcoin, because bitcoin is my preferred crypto currency

Why Is this Needed

Summary:
bitcoin is the #1 crypto in the world

Description

Type:
feature

Current Behavior

no bitcoin funding

Expected Behavior

research report about bitcoin funding on gitcoin

Definition of Done

this is a research task.

the expectation for this bounty is that whomever turns it around has taken the time to understand http://btcrelay.org/ , and how it might be applied to allow gitcoin users to do bounties in bitcoin.

to submit the bounty, come up with an architecture that described how an integration between gitcoin and btcrelay would work. if you don't think its a viable option, then please articulate why.

total funding for this bounty is 100 DAI, which will be broken up between submitters by (1) who provided value first and (2) correctness of submission, at my discretion.

@gitcoinbot
Copy link
Member

gitcoinbot commented Aug 8, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 6 months, 2 weeks ago.
Please review their action plans below:

1) writeprovidence has started work.

i will be glad to make my contributions on this issue.

Learn more on the Gitcoin Issue Details page.

2) hardlydifficult has started work.

I'm researching BTCRelay now. At first glance this seems like a great addition for Gitcoin.

I have experience with writing Smart Contracts and Dapps, after researching this I'll put together a report as requested.

Learn more on the Gitcoin Issue Details page.

3) rahulpat has started work.

I will be researching on BTC Relay as suggested and understanding how the gitcoin codebase works.
Being a newbie to the blockchain world/gitcoin world this task is a good starting point for me to understand integrations.

Learn more on the Gitcoin Issue Details page.

@HardlyDifficult
Copy link

Gitcoin.co BTC Support Using BTC Relay
Bounty funders deposit Bitcoin into escrow held by Gitcoin. Using BTC Relay, the deposit can be proven inside Ethereum using a smart contract call. Once a bounty is complete, or if it expires and should be refunded, the smart contract can track Gitcoin’s commitment until the final payment is sent and proof provided to Ethereum by way of another smart contract call.

Flow:

  1. The bounty funder (referenced as ‘funder’ below) requests to fund a bounty with Bitcoin.
  2. Gitcoin generates a new Bitcoin address and stores it with the funder’s user id.
  3. The funder makes a standard Bitcoin transaction to the address provided.
  4. Gitcoin monitors the address by checking periodically for a new transaction.
    • This may expire after x time. However if the transaction fee was set too low, expiring may result in a support ticket.
    • You could check for transactions with an API such as Bitaps' getAddressTransactions which returns the transaction hash.
  5. Wait for the transaction to be detected and for 6 confirmations to complete.
  6. Gitcoin calls BTC Relay’s getFeeAmount for that block hash.
  7. Gitcoin makes a smart contract call to BTC Relay’s relay transaction.
  8. BTC Relay’s smart contract then forwards the call to Gitcoin’s contract.
    • Method signature: processTransaction(bytes rawTransaction, uint256 transactionHash) returns (int256)
      • The return value is simply returned from the original call to BTC Relay’s relay transaction. This could be used for anything you need. However it may be best to not return anything so error codes from BTC Relay are not lost.
      • Example smart contract
    • Use a proxy contract to receive the processTransaction call. That proxy contract extracts the relevant information and then forward just the necessary information to your bounty smart contract.
    • Use Solidity-BTC-Parser to getFirstTwoOutputs in the proxy contract, which returns the address and value sent.
      • Confirm Gitcoin received coins from this transaction.
  9. At this point, Gitcoin’s smart contract has a Bitcoin transaction that we know has at least 6 confirms. Now the bounty has been funded.

Once the bounty has been completed:

  1. The funder confirms payment should be released with a smart contract call.
  2. At this point, Gitcoin is responsible for payment. However the smart contract knows how much is owed and to whom.
  3. Gitcoin creates a standard Bitcoin transaction sending funds to the bounty hunter.
    • From this you have the raw transaction and the transaction hash.
  4. Once 6 confirms complete, then call BTC Relay’s getFeeAmount and then call relay transaction.
    • Reference a different Gitcoin proxy contract then what was used above so it’s clear this is intended to be a payment (vs funding a new bounty).
    • This can be used to confirm Gitcoin honored their commitment to pay.

Notes:

  • You could verifiably refund an uncompleted bounty using the same general steps shown for paying bounty hunters.
  • There are fees to deal with. 2 Ethereum transaction fees plus 2 BTC Relay processing fees plus 2 BTC transaction fees which will need to be paid. These are not very predictable and need to be accounted for before paying a bounty hunter or refunding an uncompleted bounty.

Alternative:

  • At step 7, you could have the bounty funder make the smart contract call instead of having Gitcoin make that call.
    • Even if you do not make this the primary path, bounty funders could always use this smart contract call as a fallback, reducing the need to trust Gitcoin.
    • Pro: fees are pushed back to the bounty funder, simplifying accounting for Gitcoin.
    • Pro: easier implementation.
    • Con: The user has a multi-step process and must wait for 6 confirmations to complete between steps.
    • Implementation note: the API’s referenced such as bitaps are JS, so they could be called from the front-end implementation (in other words, this is potentially little more than a button for the user to press.)
  • Using the same tech, you could not hold the funds in escrow but instead have the funder prove they sent money directly to the bounty hunter after a task has completed. The downside is the bounty funder does not have skin in the game and could walk away, leaving bounty hunters disappointed. The upside is decentralization.

General thoughts
This may be a nice addition, but it does not sit well knowing that Gitcoin has complete control over the escrow funds. This proposal mitigates that by creating a record of Gitcoin’s commitments which can be validated by anyone.

Another technology to consider may be Rsk which allows for smart contracts using pegged Bitcoin. That may allow for a trustless solution.

@gitcoinbot
Copy link
Member

gitcoinbot commented Aug 13, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 100.0 DAI (100.0 USD @ $1.0/DAI) has been submitted by:

  1. @hardlydifficult
  2. @writeprovidence

@owocki please take a look at the submitted work:


@writeprovidence
Copy link

Hello@owocki this is the link to the research report about bitcoin funding on gitcoin.

https://medium.com/@writeprovidence/an-architecture-that-describe-how-an-integration-between-gitcoin-and-btc-relay-would-work-3e1e79e1e64a

@owocki
Copy link
Contributor Author

owocki commented Aug 13, 2018

tghanks! im very excited about this. will review it soon

@owocki
Copy link
Contributor Author

owocki commented Aug 13, 2018

This is awesome... Thank you!

At this point, Gitcoin is responsible for payment.

I wonder if there is a way to do this without Gitcoin holding the Bitcoin private keys. There's legal considerations here as we are not a money transmitter.

Another technology to consider may be Rsk which allows for smart contracts using pegged Bitcoin. That may allow for a trustless solution.

This could be a possible scenario that'd be really exciting for us. From what I undrestand, RSK allows solidity contracts to be deployed to it; so we could perhaps submit StandardBounties to their blockchain.

Though I wonder what kind of web-wallet we could use for RSK.

@owocki
Copy link
Contributor Author

owocki commented Aug 13, 2018

@writeprovidence any chance youre interested in implementing this ? :):)

@HardlyDifficult
Copy link

I wonder if there is a way to do this without Gitcoin holding the Bitcoin private keys. There's legal considerations here as we are not a money transmitter.
Under alternatives I mention you could have the funder pay the hunter directly. This means you never hold onto funds. We won't be able to prevent the funder from spending the funds on something else while the hunter is hard at work... but we could at least validate the funder's account holds enough BTC before the bounty is accepted. Still... a risk to hunters.

@deguvunor
Copy link

@owocki yes.

@0xbitcoin
Copy link

0xbitcoin commented Aug 15, 2018

@owocki Hey so I wish you ALL of the luck on this project!! I went down this road and I tried so hard. I tried so so hard and after all of my research I found the same thing.... somebody has to hold or manage some BTC private keys on the Ethereum side and a smart contract cannot do that. Maybe BTCrelay is an option, I am not sure.. It seems dead for the last 180days.. no Tx on smart contract. It seems impossible to do in a totally decentralized way thus defeating the purpose and you may as well use Coinbase or something, a centralized bridge. Maybe it can be done with unreleased future technology.

In any case, you CAN use a bitcoin-like token on Ethereum as an ERC20 token. It is a pure-mined token and it uses the SHA3 hashing algorithm. Every single token had to be PoW mined and everyone can verify this by reading the smart contract. It is already very popular (not as popular as bitcoin) but it has a big following now and Gitcoin finally accepts it, it works on Gitcoin for bountys. SO its basically like Litecoin but as an ERC20, if that makes sense.

Therefore this is a partial solution to your problem, maybe a complete solution to your original goal. The ERC20 token is called 0xBTC and right now about 3m of 21m have been mined. The difficulty automatically adjusts exactly like BTC and it is currently mined using CPU and GPU since ASICS have not been developed for it quite yet.

https://etherscan.io/address/0xb6ed7644c69416d67b522e20bc294a9a9b405b31

https://0x1d00ffff.github.io/0xBTC-Stats/?page=stats&

You can start mining it if you have a GPU, one pool is http://mike.rs and another is http://tokenminingpool.com

This is an 'analog' for Bitcoin so it does not share the same ledger or Genesis block but it is 100% operational and working on Ethereum today and it is pure mined and ERC20 compatible.

@owocki
Copy link
Contributor Author

owocki commented Aug 15, 2018

thanks @0xbitcoin --- checking out 0xBTC now

@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 100.0 DAI (100.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @HardlyDifficult.

@HardlyDifficult
Copy link

@owocki Just came across lddex which sounds promising. It could allow for a trustless solution, and would be a much easier integration than using Rsk.

@owocki
Copy link
Contributor Author

owocki commented Aug 23, 2018

this is interesting; i wonder if theres a way to manage the volatility of ETH (vs BTC) after the exchange

@HardlyDifficult
Copy link

I'm happy to dive deeper on this if you are interested in doing another bounty ;)

@owocki
Copy link
Contributor Author

owocki commented Aug 23, 2018

@HardlyDifficult what do u think the deliverables would be there

@HardlyDifficult
Copy link

Same as above, outline the integration flow and point out any pros or cons that stand out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants