By Kenzan Boo
On July 26, 2019, Coinbase Earn launched the Dai Advanced Task. In a few days, users created more CDPs (Collateralized Debt Positions) than ever existed. In the previous 11 months, about 9,000 CDPs were created on the blockchain with MakerDAO. We chose to launch on a Friday. On the weekend after the Dai Advanced Task began, over 10,000 CDPs were created.
In this blog, we explore how one of the biggest decentralized finance apps used Coinbase Earn to help grow its network so quickly. We’ll dive into some of the engineering and product challenges along the way and how we solved them.
Coinbase Earn is a platform that connects the community of users with foundations like MakerDAO. The product allows users to earn cryptocurrencies while learning about them by watching educational videos and doing tasks. It’s a way to help educate crypto purchasers so that they are not just buying a ticker, but also understanding the foundations and networks behind the token.
Earn creates a value for the foundations as well. Foundations want to distribute tokens to its new users. Most new token projects dedicate a major portion of their tokens to initial distribution to circulate among the community. Earn is able to help them expand user participation. The more people that use it, the greater the network effect, and the more meaningful the token becomes.
MakerDAO is one of the most popular decentralized apps in the crypto community. It allows users to use ETH as collateral and create CDP’s in a stablecoin called DAI. DAI is made stable with the help of smart contracts on the Ethereum network, keeping it very closely pegged to the US Dollar.
The effects of the Coinbase Earn campaign have been lasting, even months after the first launch weekend. It’s shown sustained growth for the network far past the initial new user effect. While the lesson has introduced many new people to engaging in blockchain debt positions, it has not yet significantly changed the value of the total debt positions.
Below we’ll go through a few quick screenshots showing a run-through of the task.
Intro to the task telling users what they’re about to do. We guide them through downloading the wallet app. Text to Download if they’re on a computer. The remainder of the task needs to be done using the Coinbase Wallet dApp browser. Connect Coinbase wallet. We send the user test funds for the tutorial. Walk them through the steps on Maker. Payout immediately.
Current challenges with using decentralized finance apps:
- Fear of loss
- Difficult to use
Users of decentralized finance have a fear of losing their initial deposits if they type in the wrong receiving address. Furthermore, many of the current user interfaces are notoriously difficult to use since they’re intended for engineers with technical experience and not consumers.
Problem: Users’ fear of losing their funds.
As part of the tutorial, a very small amount of ETH was needed as collateral and to pay the network fee.
Solution: Provide the funds needed to complete the lesson.
We supplied collateral by building a backend Ruby controller which directly deposits the necessary ETH into the user’s linked wallet. By giving the user the ETH, the user would not lose their own money. Consequently, if they were not able to complete the tutorial, this would lessen any frustration. The below controller snippet highlights how we sent that allowance to the user’s wallet.
class V1::DaiSendEthController < V1::BaseController ETH_ALLOWANCE_AMOUNT = (ENV[‘ETH_ALLOWANCE_AMOUNT’]).to_f def dai_send_eth begin allowance = DaiEthAllowance.create!( user_id: current_user.id, wallet_address: wallet_address.downcase, eth_allowance_amount: ETH_ALLOWANCE_AMOUNT, … ) rescue ActiveRecord::RecordNotUnique Scrolls.log( message: “User #{cb_user_uuid} already has an Eth allowance associated” ) return head :ok end SendEthAllowanceJob.perform_async(allowance.id) head :ok end end
Problem: Volatile gas prices (network fees).
Gas is a way for Ethereum to self-balance and make sure the network is always available. During high demand times, the cost to do computing on the Ethereum network is raised to incentivize more people to contribute computing power. Most of the time, it costs a few cents to open a Collateralized Debt Position on Maker. However, at rare times of high network use, the cost to create a CDP can go up to $10, which is a lot more than the tutorial funds we provide.
Solution: We check the ETH network for our users.
As part of the Dai Advanced task, we monitor ETH gas prices for our users through an internal backend system we built with our crypto team. The CheckEthGasPrice class below monitors both internal parity price and external Eth Gas Station prices to make sure that the gas prices are within the normal bounds. If we determine that the current gas conditions are too high, we ask the user to come back at a later time to complete the task. We want the user to be able to experience the full flow in the first pass and not have to come back later after they’re halfway through the tutorial. This also helps the Coinbase support staff reduce the number of support tickets coming in.
class CheckEthGasPriceJob < ApplicationJob DISABLE_THRESHOLD = ENV.fetch(‘ETH_GAS_COST_THRESHOLD’).to_fdef perform gas_station_prices = GasStationApi.prices coinbase_parity_price = Ethereum::CoinbaseParityNode.new.gas_price_gwei eth_gas_station_price = gas_station_prices[‘average’] task_status = DaiTaskEnabled.first … if coinbase_parity_price > DISABLE_THRESHOLD Scrolls.log( message: “Gas prices is too high, task disabled”, ) task_status.update(enabled: false) if task_status.enabled else Scrolls.log( message: “Gas prices is acceptable, task enabled”, ) task_status.update(enabled: true) if !task_status.enabled end endend
Problem: The Maker UI was not designed for mobile, making it difficult to use.
When we started on this endeavor with the Maker foundation, we were tasked with designing the whole flow end to end to make it easy to use. Upon attempting to create a CDP on the Maker site, it was clear that the page was designed to work well on desktop; however, we anticipated many of our users to go through Earn on mobile. A lot of the modals were cut off or other content not visible on a mobile device.
Solution: We worked closely with the Maker team to revise the Maker app to be mobile-friendly. In the screenshot above, the top set shows the UI before the updates made for Earn and bottom shows after. By working with the Maker team, we were able to iterate and improve on the UI to create a seamless experience for our users. The end result was an easy to use flow for our many mobile users.
Problem: Determining whether a user has successfully created a CDP.
To reward the user for completing the task, we need to first figure out when they’ve completed making a CDP.
module EtherscanApi::CdpCrawler DAI_TOKEN_CONTRACT = ‘0x8…’.freeze EVENT_SUBSCRIPTIONS = [ { name: ‘dai mint event’, event: ‘mint’, contract: DAI_TOKEN_CONTRACT, topic0: ‘0x0…’, # mint event parser: ‘parse_mint’, default_begin_block: 7_491_270 # starting from block when campaign launched }, { name: ‘dai transfer event, Maker proxy’, … }, { name: ‘dai transfer event, Instadapp’, … }, … ].freezeend
Solution: Create a crawler that subscribes to all DAI events.
We built a crawler specifically to monitor DAI minting events from particular proxy contracts used by the most popular dApp. When our system sees a DAI mint event, we then try to connect that to our user’s originating wallet address in order to mark the lesson as complete. After that, we reward the user in DAI to their Coinbase wallet.
The DAI Advanced lesson has been a huge success for token development teams and for our community of users. By completing this task, many users directly engaged with a blockchain for the first time.
The DAI advanced lesson campaign has now concluded, however we’ll be working on many more community campaigns like this in the future. If you’d like to help build out the future of the crypto community, come join us.
Check out Earn here: http://coinbase.com/earn
The post appeared first on The Coinbase Blog