Articles on: Features

rhino.fi and StarkEx

rhino.fi is built on StarkEx, a scalability rollup created by our partner, StarkWare, on Layer 2 of the Ethereum blockchain, designed to validate transactions using zero-knowledge technology. The use of StarkEx is fundamental to our decentralised trading model, enabling us to provide fast, low-cost and self-custodial transactions.

Here we explain how StarkEx shapes the trading experience on rhino.fi, and how it impacts everyday users.

StarkEx model

StarkEx is a SaaS product designed to provide a high-speed, low-gas method for settling transactions. It inherits the robust security of the underlying Ethereum blockchain and maintains total self-custody.

User transactions are batched off-chain by the operator, in this case rhino.fi, and sent to StarkEx, which validates the transactions in bulk and generates a single proof (known as a STARK), attesting to the validity of all the transactions in the batch. This proof is then posted on-chain (in other words, the Layer 1 Ethereum blockchain).

Zero-knowledge, or zk, technology is key to the StarkEx model. Essentially, the StarkEx tech stack is divided into two key parts: a proving engine known as the Shared Power Service, or SHARP, which exists on Layer 2, and a verifier contract which exists on Layer 1.

First, the proving engine processes a batch of transactions according to StarkEx’s core business logic, then it submits the batch to the verifier. To validate each transaction in the batch, the verifier sets the prover a series of mathematical challenges that would be impossible to resolve had the prover not followed the correct steps when processing the trade.

This avoids the need to reveal the details of either party in the transaction (hence the term ‘zero-knowledge’), and provides efficiency gains over alternative validation mechanisms.

This diagram shows the StarkEx structure (credit: StarkWare).



Specific advantages

The name STARK stands for Scalable Transparent Arguments of Knowledge. This acronym emphasises the benefits conferred by STARKs over other forms of zk-validation technology.

‘Scalable’ refers to the speed of STARKs: each proof requires minimal computation, which improves the scalability of Ethereum, and the vast majority of data is kept off-chain, with only the final proof submitted to Layer 1.

In addition, the system creates a natural and significant asymmetry between prover and verifier in terms of computation load; as its name suggests, the SHARP prover operates across various StarkEx applications, and the cost is divided between them. This means the prover’s computational work scales quasi-linearly, while the verifier’s computational work scales logarithmically. This makes STARKs a natural candidate for scaling blockchains.

'Transparent' means the system requires no trusted setup (unlike other proof systems).

The validity proofs generated by StarkEx ensure that as soon as transactions are made and posted on-chain, they’re final, and the security guarantees are the same as those on the underlying chain.

With Optimistic proofs, another form of validation technology which assumes all transactions are valid by default, it is possible for people to post invalid state updates on-chain. With zero-knowledge validation, it is impossible to post an invalid state.

In fact, by batching transactions and posting them on-chain, rhino.fi’s StarkEx trading system provides certain advantages over a centralised exchange.

With a centralised exchange, a user’s transactions are only confirmed when they withdraw. Until the withdrawal takes place, the exchange could theoretically go back on the transactions and roll everything back.

Once StarkEx has posted a transaction on-chain, there is no possibility of rolling back. So the user’s transactions are guaranteed without them having to withdraw.

Role of StarkEx in the rhino.fi trading system

StarkEx provides a central hub for rhino.fi’s multi-chain ecosystem, connected to the various blockchains we support via smart contracts.

When opening a gateway to a new chain, rhino.fi establishes a liquidity outpost on the chain in question (in other words, a vault of liquidity from rhino.fi’s own funds) and builds a bespoke version of our smart contracts, enabling users to deposit their disposal asset on their origin chain and receive an equivalent amount of funds in their desired asset on the new chain. The entire process is triggered by user signatures.

StarkEx acts as a router in the system. Rather than transferring their funds to the new chain directly, users give their disposal funds to StarkEx and receive their new funds from StarkEx in return. This provides greater speed and avoids the need to pay native gas fees on the chain in question.

When a user deposits into StarkEx, the funds are still in their custody. However, they provide rhino.fi with a receipt. So, for example, if the user wants to teleport their funds onto another chain, they can basically say ‘Ok, I will transfer these tokens on StarkEx to you’.

Once rhino.fi has this receipt, we, as the operator, can give funds on whichever chain they wish to explore, as long as we have established liquidity on that chain.

So the user’s funds are held on StarkEx, and they swap these funds for funds held on another chain.

Purpose of the StarkEx model

rhino.fi (previously called DeversiFi) started out as a trading platform that was similar to a conventional trading exchange, enabling users to trade against other parties in a decentralised way, using order books.

StarkEx was one of the first production-ready solutions to allow this functionality on Layer 2: it is ideally suited for applications that allow people to create trading orders or transfer funds between one another.

As rhino.fi has scaled to provide other trading possibilities (such as AMM trading and yield opportunities), so StarkEx has facilitated these options. The SaaS product supports several use cases out of the box, including AMMs, spot trading, payments, derivatives, DeFi pooling, and even NFT minting and trading.

Security

All the core security protections of the StarkEx model are embedded in the smart contracts. The rules of interaction are established in the code and each contract is thoroughly validated and audited before it goes live.

No additional protections are required from rhino.fi. We simply provide an interface for StarkEx, order the transactions and match-make them. We don’t handle users’ funds ourselves.

User flow

The use of StarkEx has no material effect on the rhino.fi trading experience. Rhino.fi users do not face any additional steps to activate or interact with StarkEx.

Trusted or custodial elements

The StarkEx model, which stores the vast majority of data off-chain, does require a certain amount of trust, as the data is stored with a third party.


Starkware aims to solve this with a Data Availability Committee (DAC) comprising eight independent members, who receive a copy of all transactions. If the Layer 1 contract is frozen, the committee is required to release this data so users can produce the proof necessary to withdraw their funds.

Risks

The risks of using StarkEx are the same as those of any other contract that has control over users’ funds, notably the risk of hacks.

To minimise these risks, rhino.fi has put rigorous checks in place and we attempt to avoid pushing any unnecessary changes. Our contract changes are rigorously audited internally prior to release, and receive regular external audits from industry-leading blockchain security experts, such as PeckShield.

If you would like to discuss our process for cross-chain swaps, or any other aspect of rhino.fi’s technology in more detail, please contact us via Twitter or Discord.

Updated on: 30/05/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!