I had this idea randomly after reading through the CryptoKitties source code. It felt like a great way to learn about crypto. I was inspired to power through and build the demo when I saw William Mougayar talk at ETHDenver about the "remaining 50% of middleware that needs to be built" for a successful crypto ecosystem. I think this app fills a huge whole in the middleware space.
What it does
QuickETH offers merchants the ability to add a "Pay Crypto via Credit Card" button to their site. Before being allowed to complete a transaction, a consumer needs to verify their email, phone number, and connect a social network account that is at least 1 year old. They enter their credit card, and upon a successful transaction, a QuickETH non-fungible token is sent to the merchant.
That token has 2 properties: a "value" (which corresponds to the amount of ETH the NFT represents) and a "revocation window expiry" timestamp. Upon receiving the token, it is immediately transferable to anyone just like any other token. Until the revocation window has passed, the issuer (me) can revoke the token. The token will be revoked in the event of a chargeback. Once the revocation window passes, the token can be burned in exchange for cold, hard, immutable Ether.
The smart contract is pre-funded with ETH and keeps track of its NFTs collective accounts payable. If the accounts payable amount gets too close to the ETH amount, it will not issue any more NFTs.
How I built it
Smart Contract (SC) I used Truffle and Ganache for development. Wrote a lot of SC tests. I copied the ERC721 code from Zeppelin instead of importing since I had to modify the burn function to allow the contract owner to burn a token, not just the token owner (this makes exchanging for ETH easier later on).
Payment App This is a rails application that verifies identity, collects CC payment, and calls the ETH Gateway API.
Demo Merchant App This is a rails application that simulates a merchant who has embedded our "Pay Crypto via CC button" button.
Challenges I ran into
Signing web3 transactions server side is extremely convoluted. There was one oddity where my code worked fine locally, but upon deploying the sth-gateway app to heroku, I had to make this change: https://github.com/ryana/ethden-eth-gateway/commit/58e6161f5073b4206a1580e14bb430921388815d
Accomplishments that I'm proud of
I wrote some pretty extensive tests around the token. When I went to deploy to Rinkeby, everything Just Worked™ the first time. I was floored that happened. /ht truffle test framework
What I learned
There is no proper blockchain explorer for ERC721 tokens yet. I already knew error messages from the EVM were bad, but wow. We need to fund a public "Summer of Code"-esque project to really kick up the backtrace game from EVM reverts.
What's next for QuickETH
- Create a better blockchain explorer webview/API so that merchants and token owners can see when a token's revocation window expires.
- See if people want to use it
- Raise some money to fund the contract with 10-50 ETH
- Build out the Payment App fraud mitigation techniques and jack up security and error checking on the ETH Gateway