DeFi for ZEC: Shielded ZEC DeFi wallet for Ethereum, BSC and Polygon

DeFi for ZEC:
Shielded ZEC DeFi integrations in RAILWAY WALLET for Ethereum, BSC and Polygon

Prepared by The Right to Privacy Foundation
In collaboration with RAILGUN Privacy System

Applicant Background

The Right to Privacy Foundation

The Right to Privacy Foundation (“Right to Privacy”) is a UK-based non-profit organization that conducts privacy focused research, particularly within the software & blockchain sphere, creating strong relationships with cryptographers and developers.

Right to Privacy has proven to be an extremely effective developer and organizer of new privacy-focused tools. Right to Privacy was the first to develop a Groth16 zk-snarks prover for mobile, and successfully funded the development of RAILWAY WALLET, which combines both RAILGUN privacy technology and Status.im Waku privacy technology for a multi-chain anonymity wallet This wallet has been audited by Trail of Bits and works today on web. Based on this demonstrated success, Right to Privacy is confident to produce new, working privacy wallet software quickly and reliably.

Right to Privacy holds contracts with privacy focused developers who will be building the advanced shielded ZEC DeFi integrations for Ethereum, BSC and Polygon. The team’s members are also big fans of the Zcash movement.

RAILGUN Privacy System

Additionally, core contributors of the RAILGUN project team have set aside time to assist in this grant’s design and development efforts.

The RAILGUN Privacy System is a smart-contract-based private wallet system that enables anonymous DeFi interactions. It currently operates on Ethereum, BNB Smart Chain, Polygon and Ropsten Testnet, with plans to expand to Solana, Polkadot, Arbitrum and Near in the coming year. Most recently, RAILGUN became the first smart contract system to enable end-to-end private token swaps of ERC-20 assets.

The RAILGUN Privacy System is developed by the RAILGUN DAO, a decentralized organization with global contributors.

Description of Problem or Opportunity

Zcash is a digital currency with the strongest privacy features on the current market. ZEC enables end-to-end private, efficient and safe value transfer with low fees. This purpose is closely aligned with the priorities of Right To Privacy, which aims to support projects that advance the usage and market depth of privacy, especially within the cryptocurrency ecosystem.

As it stands, Zcash is currently limited by functionality restraints – it is currently used primarily as a system for private value transfer and a private memoing system. Advanced cryptocurrency use cases, such as staking, liquidity provisioning, token swapping and other Decentralized Finance tools, are currently inaccessible or challenging to access for ZEC users.

If Zcash is to reach its goal of a billion regular users, it will require many more complex interactions and capabilities, including advanced DeFi functionality.

Proposed Solution

We at Right to Privacy believe that DeFi functionality through the RAILWAY WALLET will dramatically increase the usability, security, adoption and accessibility of Zcash/ZEC, helping to enable long-term scalability to a billion users. For one, this will enable users to buy Zcash with USDT/USDC directly, via DEX trading, with no party in the middle. It will also allow anonymous & private yield deposits of ZEC in DeFi contracts on other chains (Ethereum, Polygon etc.) to earn interest from lending ZEC.

We propose an integrated wallet solution for ZEC balances, which is embedded into the privacy-centric RAILWAY WALLET. This wallet will be available on all common platforms, including desktop web, native mobile iOS and Android.

This Zcash-integrated wallet will be capable of dApp functionality that makes it incredibly easy to bridge ZEC to Ethereum, BNB Smart Chain, and Polygon through Ren Protocol, with the end-to-end privacy of RAILGUN. For example, this means that renZEC assets will be entirely shielded in the RAILGUN asset pool after they are bridged to Ethereum. This will be accomplished using a custom Zcash RAILGUN Adapt module, and means that users can enjoy anonymity while performing any ZEC DeFi interactions, as well as end-to-end privacy when bridging ZEC between Ethereum, BNB Smart Chain, Polygon and the Zcash chain itself.

Furthermore, multi-chain renZEC assets will enable advanced DeFi interactions. Through the RAILWAY WALLET, users will be able to stake shielded renZEC, privately provide liquidity of renZEC, and use a multitude of dApps anonymously with ZEC on the click of a button.

The proposed Zcash RAILWAY WALLET integration will unite privacy evangelists under a single secure platform, which greatly extends the functionality of ZEC/Zcash, and will be usable on both desktop and mobile devices, with security and anonymity established at the very core.

Solution Format

  • RAILWAY: Privacy-first web application with Zcash wallet integration deployed at railway.xyz, available worldwide.
  • RAILWAY: Privacy-first mobile application with Zcash wallet integration deployed to App Store and Google Play, available worldwide.
  • New features:
    • Transfer and store ZEC in a private Zcash balance in RAILWAY WALLET
    • Bridge ZEC directly to shielded renZEC on Ethereum, BSC and Polygon
    • Swap shielded ERC20 tokens directly to private ZEC balance
    • Stake shielded renZEC tokens to earn rewards
    • Provide liquidity through shielded renZEC tokens
    • In the future, bridge ZEC to shielded renZEC on Arbitrum and Solana

Technical Approach

Here are our primary product goals for this integration.

Usability:

Just over $1 million of renZEC has been minted on Ethereum to date. Easier access to private DeFi functionality can increase this by a large margin over the first year. Currently, users have to bridge their ZEC into a public Ethereum balance in order to gain access to staking and liquidity provisioning. Through the RAILWAY WALLET, ZEC can be bridged to a shielded renZEC balance, which is apt for Zcash proponents. This will unlock a slew of new functionality and use cases, entirely privately.

Privacy + Security:

The RAILWAY WALLET is the most private and secure blockchain wallet on the market today. Unlike most web and mobile applications, there is no backend storage system for RAILWAY, and every data piece is stored heavily-encrypted, offline, on-device.

Security features are baked into the application core and user experience. For example, a PIN or password is required when the application accesses the user’s private key or seed phrase; this password is hashed to reference an encryption key that is used to store sensitive data onsite. User Agent data is stripped from external data requests. Shielded contract executions are dispatched through a Relayer network, which uses Waku protocol for anonymous, decentralized communication.

The RAILWAY Zcash integration will inherit these strong privacy standards and security fundamentals as instilled and validated by four auditors to date: ABDK, Zokyo, Trail of Bits and Hacken.

Adoption:

We aim to make it easy for users to adopt the Zcash privacy system, obtain ZEC privately (off-exchange) and bridge shielded ZEC into their Zcash balance. RAILGUN and Ren protocol can enable one-click swaps into a private ZEC balance on Zcash. And it will be fully private, end to end.

Here’s how it will work:

  1. A user shields an ERC-20 token (say, WBTC) into their private RAILGUN balance on Ethereum.
  2. The user initiates a private swap from their shielded RAILGUN balance. This contract call uses the RAILGUN Relay Adapt module and 0x Exchange to swap WBTC for renZEC.
  3. The renZEC can be either automatically deposited back into their shielded ETH balance, or bridged directly to the user’s Zcash ZEC wallet through their shielded address.

Accessibility:

The Zcash RAILWAY WALLET integration will be available through a public web interface, accessible via browser at railway.xyz. It will also be installable through a native application on mobile devices, including native iOS and Android apps.

The RAILWAY WALLET will be internationalized to a variety of languages, making it one of the most accessible places to store, transfer and use ZEC for all kinds of DeFi applications, anywhere in the world.

Dependencies

We require very little direct development support from ZF, ECC or external Zcash developers – the final products can operate without new ZIPs. However, it will be helpful to have guidance from Zcash engineers on SDK usage, connectivity, debugging, test environments and cross-chain development.

We’re in touch with the REN Protocol team, and will look for guidance from them on REN protocol development and debugging. Similarly, we are already connected to the 0x Exchange team, and will look to them for guidance on 0x protocol development and debugging.

Execution Risks

The technical process has been de-risked, as the RAILGUN v1 protocol was deployed in May 2022, and the RAILWAY WALLET launched in June 2022. The team has extensive experience shipping large-scale products to production, across distributed web, mobile and smart contract layers, so there are few execution risks on the technical side.

There is a small risk for deployment to the Apple App Store. Apple has an extensive iOS App Store review process, and can restrict app launches for a number of reasons. However, the RAILWAY WALLET iOS app was previously approved with Ethereum, BSC, Polygon and Ropsten integrations, so we are optimistic that the Zcash integration will not pose a significant hurdle.

Unintended Consequences

As with any large-scale software product, the Zcash-RAILWAY integration will require considerable long-term maintenance. We have budgeted for a period of 6 months of hard-core product engineering, as well as 12 months of technical support and iterative development, during which period we will have developers on-call to respond to feedback and fix issues as appropriate.

Continual development of a released product also requires continuous QA and user testing. These may cut into time devoted to Right to Privacy’s other priorities, but we are prepared to commit to supporting the Zcash integration at our fullest capacity, no matter the opportunity cost.

Evaluation Plan

Quantitative statistics:

  • Amount of minted renZEC (across Ethereum, BNB Smart Chain and Polygon)
  • Zcash adoption and usage rates
  • Number of daily/monthly active Zcash wallets
  • RAILWAY mobile app install rates on iOS and Android

Qualitative observations:

  • Commentary on ease of integration
  • User feedback and issue reports

Budget

Milestones:

  • Zcash/ZEC RAILWAY WALLET integration and NU5 support, web and mobile
    • $280,000: 13 weeks (July-Oct)
  • renZEC integration for in-wallet bridging to private DeFi
    • $115,000: 5 weeks (Sept-Oct)
  • renZEC shielded staking, including shielded NFT mint
    • $150,000: 6 weeks (Oct-Nov)
  • 0x integration for private swaps from ZEC (Zcash) to any shielded ERC20 asset
    • $125,000: 5 weeks (Oct-Nov)
  • Security and privacy audit on all new ZEC features and connections
    • $225,000: 8 weeks (Dec 2022-Jan 2023)
  • Internationalization, translations and accessibility support
    • $55,000: 3 weeks (Jan 2023)
  • NU6 support and upgrades
    • $75,000: 4 weeks (Jan 2023, depending on readiness)
  • Ongoing technical support and maintenance (1 year following project completion)
    • $240,000: 52 weeks (Jan 2023 - Jan 2024)
  • Ongoing marketing and promotion (1 year following project completion)
    • $120,000: 52 weeks (Jan 2023 - Jan 2024)

Total budget (18 months): $1,385,000

The team aims to allocate 3-4 senior frontend engineers, smart contract developers and design/product staff to each milestone/project. The exact figure may vary depending on overall scope and timeline constraints.

Budget was determined by an estimate of $5,000 per developer-week, plus additional budget for project management, product testing, and quality assurance.

How was the project timeline determined?

The project timeline is based on our current team size, allocated headcount, and modest growth expectations. We have estimated a number of hours for development based on prior projects that our team has delivered. We have also budgeted for appropriate testing and release schedules based on size and complexity of each project/feature.

Thank you

Thank you for reading. We look forward to your consideration and collaboration.

4 Likes

Please see the full application here:
https://zcashgrants.org/gallery/25215916-53ea-4041-a3b2-6d00c487917d/28599680/

It’s good to see more parties interested in doing something with Zcash.

What is your opinion on the multitude of other wallets currently in development? Disappointed with wallet experiences lately

Is your team aware of the ZSA grant in progress?

1 Like

Hi @pkr, great questions.

Our team has performed research on existing released Zcash wallets, and we have overall been unimpressed with app stability, reliability of block syncing, privacy/security, and overall user experience and native design. After reading that forum post (thanks for sharing), it seems we’re not alone.

We recognize that the privacy space is nascent, so one might expect unreliability in early interfaces. However, it should never take someone up to 12 hours to sync and transfer ZEC for a private payment. If this is the par use case, privacy buffs will just opt for cash.

Not all Zcash wallet apps share the same problems. ZecWallet Lite has crashes and sync problems, and no protection/security of a PIN or FaceID when viewing your seed phrase. Nighthawk is only available on mobile, crashes on “Delete wallet” and other common actions, and only enables one wallet seed at a time. YWallet has common sync failures, its design feels non-native, and it also only allows a single seed/wallet. Edge wallet has a very slick design, but it’s non-private, as it requires an account registered with their backend, and you have to share personal info (country/location) as part of the core user experience. Edge, YWallet and ZecWallet Lite only support the English language at this time, which limits adoption abroad.

Note that we’re not here to criticize the other wallets – that’s not productive. We researched other apps on the market to aggregate our favorite designs, and to understand what’s available and what’s missing.

Our favorite app on the market is Unstoppable. Based on UX and UI alone, it really feels like a native mobile app. The backend is decentralized and private by design. But its massive sync-time for ZEC makes it impractical. And like the other apps on the market, it is limited by functionality to sending/receiving and memoing.

We want to unify all this research and create the most optimal native user experience for any ZEC user on both mobile and desktop. Besides setting a high bar for reliability, user experience and native design, the primary outcome of the Zcash/RAILWAY integration, is an expansion from the use cases of sending/receiving and memoing. Native in-wallet support for shielded renZEC opens the doors for DeFi functionality that is not possible today in any ZEC wallet, and we believe this will have a dramatic impact on usability.

2 Likes

We’re bullish on the ZSA work, and our understanding is that development is going well.

Our desired outcomes and value props are significantly different from ZSA, and will require no new ZIPs or changes to core Zcash functionality.

Outcomes:

  1. Zcash holders can get access to private DeFi without using a CEX or transparent address.
  2. It will be incredibly easy to bridge shielded ZEC to existing blockchains that have massive usage, where DeFi app functionality is already present and mature.
  3. Privacy-focused users in BSC and Polygon ecosystems can get easy access to Zcash Layer 1.
  4. It will be possible to acquire ZEC through a shielded channel that never involves a CEX.

We believe this is highly valuable functionality for the existing Zcash ecosystem, and can coexist with ZSA shielded assets on Zcash Layer 1 itself. As Zcash becomes more prominent, we think that a variety of applications and use cases will help to mature the entire ecosystem.

3 Likes

Fund It!

ZEC on BSC and Polygon is worth the cost alone

4 Likes

Edge wallet is private, open source, non-custodial wallet. The goal of Edge is to build an app that is familiar to the masses that already know banking applications. The account is encrypted and backed up so even if it is backed up on a server, the username and password are encrypted. Users have access to each individual wallet private keys to each individual wallet created on that account. Having the private seed separate for each wallet in the account is safer compared to for example if a new user who has 17 different wallets that can be restored from 1 seed that got compromised, then all of those wallets on the accounts are done for.

If Edge ever goes down or servers are out, the user can still access their account offline without internet via the FULL password or biometric as the keys are stored on the device. The user would lose access to basic functions such as seeing exchange rates or PIN logins, anything that required a server. But the user would still be able to decrypt their keys with the full password offline.They could then access it and restore on another device or wallet app that supports the cryptocurrency type or seed phrase type.

Sharing location is NOT required and optional and solely use for 3rd party services within the app giving the user the freedom if they choose to do so use centralized services for buy/sell or maintain the privacy by not accepting any of the location data. VPN is something that combined with Edge makes this a killer app.

Edge also has support for ZEC as well as a number of NO KYC swap partners as well as being able to connect to DeFi such as Uniswap or AAVE using WalletConnect which Unstoppable also has is something that has become a common feature across mobile apps to connect to a dApp.

Lastly, Edge does have different languages but it depends on your device settings. Set it to Spanish, Russian, Italian, Chinese, German, etc. and these are translated all though some more so than others.

I like the goal trying to unify all this research and create the best and most optimal user experience for any ZEC user and I think that is where people perhaps your team and I or the Edge team can try to make that dream a reality. However, a lot of the wallets out there also do not see from a user point of view how that the ease of use even with Unstoppable is not ready for the masses.

Edge wallet is one of the few, if not only non-custodial wallet with phone call support that has been in the space since 2014 (as Airbitz) doing that. Edge even has a direct line with a help button to tap to call or live chat with but in Unstoppable I cannot even find any support to talk or contact a person whether phone or live chat. However, Unstoppable does have a nice FAQ and Academy built in. The goal with Edge is to make crypto familiar so that it can be unleashed the the masses while retaining the core values of crypto such as non-custodial ownership and privacy foremost.

If you have seen support in any industry, then you’d also know that the amount of users even with the most simplest UI and warnings in place, will still have herds of users reach out to talk to someone for help. I ask you this, what non-custodial wallet out there whether it supports ZEC or not, already exists out there with phone type support that have the experience? Centralized cryptocurrency platforms do not count as the support there have no idea in anything crypto related and wouldn’t be able to tell you how to recover BCH sent into a Segwit address or that it was even possible. Centralized support persons that work in Coinbase or Nexo, they don’t troubleshoot and know how to do forensics or investigate a blockchain explorer. The support there is mickey mouse stuff and at least with non-custodial wallets whether it be Edge, Unstoppable, Exodus, etc. I am sure have technical support that know how to actually navigate and know the rules of the different cryptocurrencies.

I’ve worked with a double digit high net worth millionaire and many other high net worth non-technical users to be able to move funds to experience DeFi or get help with learning how to use the tools to hop across from main net to a token like USDC on Polygon to be able to LP stake on Uniswap v3 to earn 200-600% APR or to move funds from bank which you know earns shit interest when they could park millions much more on DeFi. Even the concept of explaining to them about gas fees or getting funds stuck not bor not able to deposit because the paired tokens haven’t been combined yet. Or let alone trying to hop all the way back across chains into main net and back to the bank.

When Wall St comes along with nation states and trillions come into the market, do you think that financial people will even “get” this with the way most non-custodial wallets are? I’ve met multiple young financial people that are educated or have worked for example in big 4 accounting firms yet had NEVER used a password manager or even use the same password across different websites and services. The vast majority of people have no regard for security. It might be possible one day that once all this money comes in that there will be lots of fund managers and companies simply willing to start paying or hiring DeFi operators to “drive” and move money on their behalf which also defeats the purpose about ownership of your own keys. If this happens then it’s just gonna be the opposite of the fiasco of Celsius where they 1 entity holds mass amount of users funds cause they never had the keys except this time it might be operators who have the keys to move fund around for big companies because a lack of ease of use and need for it.

The account creation difficulty for the masses is not there yet with most of the non-custodial wallets in where a user still in this day and age 2022 that a user is still expected to write down a seed like this as if this is still 2012 or 2013 where I still have to write that down almost a decade later. Where are the other apps that are like Edge where this is familiar and done behind the scenes?

Even if there are others that are like Edge, there is still so much more to do to make DeFi ready for the masses. Need something like a Western Union app that constantly warns the user about the dangers of sending money to a scam and with all the education and support in hand but even at that I bet you that there will still be a massive amount of volume of angry customers and calls for help no matter how much info and warning you put in an app. Now imagine with all the crypto wallets out there. Where is the one that is the most bank familiarity with the best support yet has everything under the covers that retains the values of privacy and non-custodial use??

I remember before mobile wallets when Multibit was my go to wallet on desktop but the interface would be so confusing for the average user. Really users they don’t want to see all the advanced options but something familiar! They just want to see it go and 90% of the time tap to fast to even go through the warnings or deleter the app if it takes too long or are required to write enter the seed again! I was so excited when Mycelium came out which was one of my 1st mobile wallets to use but even then that was too much for the user (if any one remembers the UI and can relate to Mycelium?).

Railway is really interesting and so is ZEC but it’s going to continue to be a niche not ready for the masses unless usability is seriously addressed. What I would love to do is if I can find the right teams and people to connect together is to use what I’ve learned in the space for the last 10 years in crypto to connect people, companies, apps etc. to combine ideas to make or enhance that perfect product. I’m tired of seeing many different wallets and iterations of the same thing thing but slightly different. We should have it where the different groups in different disciplines focus on one thing and then combine those features with ease of use, privacy, and non-custodial.

If Edge security model + ZEC/Monero + DeFi cross chain/swaps + Uniswap + AAVE + a Bank App (think familiar) had a baby together and made a wallet that was easy to use for an average person familiar to banks yet was private, anon, non-custodial by default with the ability to lend and borrow or stake as well as interact on DeFi that would be a beast of a wallet. Maybe throw in an NFT feature there and that wallet would be my favorite wallet to use. Add in having world class support with someone to talk to on the phone or even a paid service for 24/7 for whales and there you go that product should be golden!

5 Likes

IMO Zec on BSC, Polygon and FTM should be the first chains. The one with the highest volume or the most amount of dApps to use. Maybe Polygon just for AAVE then BSC.

1 Like

This is very interesting regarding the Edge Wallet, which we will continue to research. We also appreciate your depth of understanding and commitment to privacy and UX – it’s refreshing to read.

We share the vision for a user-friendly, universal, private-by-default wallet, and very importantly, built by a team with mobile-first best practices for stability and reliability. Live support can be a challenge with a limited budget, but could certainly be integrated as a paid service. Support also becomes very difficult with fully private transactions and balances, which should be considered as well.

It would be great to get your feedback as the Railway Wallet develops with these shared goals in mind.

2 Likes

@righttoprivacy, after consideration from @ZcashGrants, the committee has decided to reject this proposal. The committee feels it is unclear why the Zcash Community Grants should carry the funding of this proposal for a non Zcash first wallet. But the committee is interested in having a conversation with yourself and the team to learn more about Railgun and this specific project in more detail and would be potentially open to considering a smaller proposal down the line.

4 Likes

Hi @decentralistdan, we would be happy to chat about the Railway wallet in more detail, and possibly re-scoping the project to align with goals of ZCG.

Please message me and we can set up a chat with our developers. Thanks!

3 Likes

So I’ve come to believe that the likelihood of ZEC gaining great usability with only “Zcash first wallets” is slim. In order to do this, we would have to have the developers who are already working on Zcash switch everything they are doing and focus on interoperability. Instead, we could work with like-minded developers like the Railgun project to integrate ZEC into their platform.

Right now, ZEC is a money coin (or at least, that is its current functionality). I’ve been thinking about other successful money coins and USDC and USDT come to mind. Their goal is not to have massive price appreciation, instead their goal is maximum adoption. Therefore, they get on every chain. I think Zcash should learn from USDT and USDC and focus on being usable on as many blockchains as possible.

The benefit of USD as a currency is its global usability and recognition, as well as being backed by whatever mechanisms there are that give it its relatively stable “value” or “price” (I’m no expert). The benefit of ZEC is the shielded transfer and store of digital value. This (theoretically) is a very desirable thing in the modern world. So, in the analogy between UDSC/T and ZEC existing on many chains, they both have a redemption mechanism - USD/T for USD (cashola) and wrapped ZEC for pure, pristine, privacy-preserving shielded ZEC.

Now, the Railgun folks have offered to help ZEC get more usability on EVM chains, but even further, they offer to do it in a privacy-preserving way! This is the best of both worlds. So my point is - we should try to cultivate this relationship with Railgun and see how we can work together to get ZEC-Railgun integration.

Lastly, I’ve come to realize that one of the main reasons why more crypto people may not use Zcash, even though privacy is core to the very ethos of crypto as a whole, is because privacy is only one component of the ultimate goal of crypto - freedom. The other major component is usability. People want maximum freedom, and 100% privacy is not always the way to get there if you get more freedom by something that has a level of usability that outweighs the lack of privacy. Essentially, its like the graph below. We need to do everything possible to get ZEC as far to the upper right corner of this graph for it to succeed. I think a partnership with Railgun is a step in that direction, and I hope our two communities can work together.

image

4 Likes

Just came across this post. I think some kind of partnership with Railgun as @David_Heisenberg mentioned above would be awesome… If we could send shielded assets across chains once Zcash supports ZSA it would be a dream come true.

I actually heard about these Railgun guys a while back and made a post here… Railgun: Privacy when using DeFi possible ? (zk-SNARKs on ETH!?)

They just released an update and seem to be deploying on Arbitrum. With all the activity lately on there it sounds like a great move. Apparently they will be integrating with Gains Network to add private derivatives trading.

1 Like