1.Why to verify Knidos?
Knidos already has all of its funds and trading volume on DeFi, thus at first glance everything may look secure enough: If something is already on blockchain, why to verify it more?
However, this all can actually be a big ponzi scheme: By getting more users each month, Knidos can actually be showing new deposits as profit to the older users. Unfortunately, there are a lot of platforms like that in the world.
Knidos is a legal entity and has been on the market for quite a while, so this above may sound a pretty far fetched scenario to you. However, you can never know, and we do not want you to trust us, but verify. This is the first reason why we use zero-knowledge proofs (ZKPs), to convince you that we are real and transparent and system is trustless.
The second reason is metrics & ethics. Trading agents is a competitive market, and there is a new trading agent (or service) claiming better yield every day. Even if none of these projects are ponzi, there are other very common (and hard to detect) ways of tricking users:
- The service can boost their metrics, even if not yield, to show better analytics.
- Your trader agent can buy an asset that you do not approve to boost their earnings, such as:
- Meme tokens: they may be profitable in the short term, but very dangerous in the long run.
- Unlisted tokens: some tokens are not legal to be traded in some countries, and it is your right to be able to prove that your trading agent did not trade any such assets for your earnings.
- Unpreferred assets: as a part of your ethics, culture or religion, you may actually be against gaining profit from some such tokens. In Knidos, we care about your preferences as much as your legal rights.
In simple terms, you do not only want to make sure that your agent is profitable, but also to verify how they profit. ZK achieves our goal of making Knidos Agent 100% verifiable and trustless.
2.Problems of Simple Solutions
ZK is cool, but it requires technical expertise. Thus, it is best to understand why other solutions do not work before explaining the ZK solution.
A naive approach is to publish all Knidos trade TXs in regular periods. Since these orders are assumed to be on DeFi, it is actually enough for Knidos to publish their wallets, where all orders of a wallet can easily be read by anyone. This is perfectly trustless in the sense that you can be sure that we are doing our job right.
Of course, verifying each and every order we have can be a hustle, but this is pretty easy to automize (especially thanks to AI), so this is not really a big problem.
The main issue with the naive approach is that this is actually a huge attack vector over the agent of Knidos. The Knidos agent is much more predictable than a human, once you know that it is an AI. Of course, in Knidos, we regularly rotate all our wallets to make sure no one understands our trading strategy, but if we publish all of our orders and wallet for the sake of verifiability, then wallet rotation becomes pointless.
Once you have the knowledge that a particular wallet is AI, it is easy to deduce some conclusions about the trading strategy. The revealing of the AI strategy is not just a loss of a business leverage, but an actual attack against your funds. Basically, by always playing against the Knidos bot, big whales may try to profit from the loss of Knidos users. This is a very common scenario with trader influencers, where big entities try stealing their funds once the influencer reaches a considerable amount.
In simple terms, the main issue is the fact that at the point the Knidos wallet becomes identifiable on the system, an attacker may try trading against Knidos, which may result in a huge loss for Knidos users.
Other solutions, such as trustless AI, lack essentially the same feature. For instance, if the Knidos AI was run on a TEE (trusted execution environment), then the AI's decisions can be verified to be coming from the right training data and algorithm. However, the verification of trades requires these actions being performed on the actual DEX, which again requires some type of wallet publishing.
ZKML (zero-knowledge machine learning) is also a similar story, even if the technology was practical enough to be used on our current design right now.
A final point is to discuss these solutions for centralized exchanges. Even though in the long run Knidos is aiming to only perform on DeFi, right now CEXs are also used for better liquidity and performance. In these systems, even the revealing of the wallet does not allow any verification, since you cannot access the trade history of someone from their CEX identification (e.g. Binance ID). Thus, Knidos needs to reveal the entire trade history to show that their actions were legit, which is not practical and safe, just like before.
Simply, we can identify that any solution that will prove the AI's execution will result in the same inevitable problem: revealing of the onchain identity and thus strategy.
3.A Fresh Approach: zkTrading Proofs
In Knidos, we design something called "zkTrade Proofs" to solve this dilemma. The basic idea is this:
Generate a zero knowledge proof that asserts every action that you would do yourself to understand if the trading history of Knidos is safe.
Imagine that as Knidos, we give you all of our trade data for the last month. You know that we have a claimed APY of X %, and now you want to verify this for yourself. What can you verify on our TXs?
As a start, you would check that we actually did profit the claimed APY as a result of these trades. Then, you can check for:
- Coin Inclusion: Did we only trade tokens that we said we would trade?
- Timestamp: Were all trades distributed in a meaningful sense in the claimed time interval?
- Number of TXs: Did we have enough TXs in the specific time interval?
- Worst / Best Days: What are the outliers in our trade history?
- And many more: max drawdown, win rate, sharpe, sortino, etc.
Basically, all of the verification that you would do on the trade data can actually be understood as a checklist. Being a deterministic ruleset, this checklist can then be used to design an algorithm that will perform the verification for you. In the end, if a computer does everything that you would do yourself, then there is no need to repeat everything analog.
Now imagine you put all this algorithm inside a zero-knowledge proof. zkTrade proofs are in reality that simple. By creating a proof that does anything that you would do yourself to verify a TX history is trustable, we make the entire system verifiable.
Of course, this proof also verifies that these are actual trades, all performed by Knidos and none of them are removed from the list.
The beauty of ZK is that you do not need to reveal anything but what you prove. Simply, the proof verifies the entire claim, but does not show any actual wallet address or trade to the user. By using statistical randomness and some additional tricks, we create enough entropy over the data, so that the proof stays verifiable without any significant anonymity loss.
Here, we will not describe the proof in detail. It is enough if you understand that Knidos generates a zkProof periodically (for instance at each hour) to prove the legitimacy of our trade history.
Now the question is: How to verify that proof?
4.Steps of Verification
Luckily, the proofs are not needed to be verified by hand. Knidos is supported by zkVerify, a chain specializing in ZKP verification, to enable better UX for its users. Basically, all proofs that are generated by Knidos are sent to zkVerify at each epoch, which is again, around an hour. Then, the proof is verified and its verification information is published on zkVerify.
Here, an important point is that zkVerify only asserts that these proofs are mathematically correct, but it is up to you to verify that the proof's identity is indeed what you expect. For instance, if Knidos's actual APY is 1%, then we can of course create a proof claiming to be so. Being a valid proof, it is also verified by zkVerify. However, if we claim in our website that our yield is 10%, then there is a problem. This can only be verified by you by checking that all metrics are what you want to see.
As a user, you need to perform the following steps to be able to verify the result on zkVerify:
verification-key.json in the output directory. Remember the place of this file, we will need this later.- Look at the timestamp. You should see that there are regular settlements in each epoch. If there has not been a settlement since a considerable time, then it means there is a problem (contact us).
- Look at the verification key section. Verify that this number is indeed correct in what you found in step 3.
- Look at the public inputs. Each of them tells a specific claim about the TX history. Verify each being correct.
This is all! Now you know that our trades are trustless.
Note: In full reality, you should also inspect the code that you have downloaded to make sure we did not cheat. However, this is very hard if you are not an experienced developer. Luckily, this is what auditors do: They read and analyze these codes to make sure everything is secure and there is no problem.
5.Conclusion
Now you have learned how to verify Knidos and have a trustless agent for yourself! If you have more questions on our proof system, you can check out our GitHub repository for the documentation or reach out from email.
Just a final reminder: Knidos is not trustless because you need to verify everything, but it is so because you can. Anyone in the world can verify the entire Knidos history at any moment thanks to our strong ZK infrastructure and zkVerify integration, which enables a perfect trust model, 1 of N, where only a single person is enough to make Knidos trustless for millions.
Thank you.