Skip to main content

9 posts tagged with "amm"

View All Tags

· 7 min read
J.

banner

Hello friends and fellows of Chia, welcome back to another post from Hashgreen! It's been a while since we had an update. Please forgive us for not having as many updates recently, as the development of Hashgreen DEX has come to the point where we think current features should suffice for over-the-counter (OTC) trading purposes. What follows consecutively is the development of the first ever AMM in Chia that is currently underway. We believe the ability to trade at will independently from counter-parties is a critical primitive of on-chain decentralized finance.

In today's blog, looking back from the experience of launching Hashgreen DEX to the construction of AMM, we are going to walk you through the landscape of the existing development in Chia and introduce an easier development in which the services could function in a more responsive and scalable manner to meet the needs of both end users and developers.

The current development in Chia

There are many existing dApps around the concept of a peer-to-peer trading protocol called “Offers” now. While it is decentralized and secure, the wallet is responsible for, other than just storing your private keys securely, managing these transactions/trades against peers and tracking their statuses on the blockchain by continuously pulling data from full nodes and verifying them.

Below is a figure showing the general picture of the system design that are commonly seen in Chia:

Figure: The current development in Chia.

The system, at a brief glance, looks reasonable and works reasonably well: dApps and wallets independently communicate and interact with the blockchain, processing users' transaction requests. Together they support an array of functionalities, including but are not limited to smart contract ("smart coins" in Chia's case) management, transaction activity management, and analyses of the blockchain. Smart coin management ensures the states in which users are trying to change are up to date on the blockchain and hence the transactions are valid when submitted; activity management and chain analysis are means to ensure, while complicated operations are behind the scenes, users can rest assured and observe high-level abstraction of their own activities as seen below.

Figure: Transaction activities displayed in the wallet.

Yet, current dApps (and other dApps on the way) are replicating an overlapping set of logic with the wallet underneath, performing smart coin management and blockchain analysis parallel to the wallet. In a simpler sense, dApps have to spend resources to set up their infrastructure (i.e. Chia full nodes) to deal with the abundance of activities on-chain. This creates two problems:

  • Functionalities are very entangled that transactions may go through either the dApp's own infrastructure, or through wallet's infrastructure. This trilateral relationship is unfavored in computer system design as it ambiguates the responsibilities and roles of dApps and wallets.

  • Development effort of dApps is high owing to the nature of the complexity of blockchain node deployment. The need for a dedicated infrastructure unavoidably creates an incredible entry barrier for blockchain enthusiasts, whose desire is no more than a backend-less web3 application. We all agree this would hinder the ability for the Chia community to grow rapidly.

We have not even mentioned that current Chia wallets (including official PC wallets and browser extension wallets) have spent so much effort dissecting the whole blockchain simply to locate your transaction in the ocean of activities. This burns away much computational power and energy from your computer, and it bears asking if we can find a better design that hits two birds with one stonemaking dApps easier to develop and allowing wallet to offload most of the heavy lifting.

Web3 does not have to be inefficient

dApps or wallets do not necessarily have to deal with all the nuisances. We can build a supporting system for web3 projects to allow them to read from and write to the blockchain with APIs (application programming interface). The idea is that blockchain in itself does not require everyone to trustlessly maintain a replica of the chain, but rather, one should be able to fetch and verify any piece of information from the chain. With that in mind, users on the edge can save their precious computation power and device pattern if they choose so, accessing the web3 world through this supporting system.

Let me explain to you why and how exactly does having such a service, or a trusted gateway system to the blockchain, could improve the scalability of the system and thus provide a real-time experience to the end users.

A lightly trusted gateway to the blockchain

Figure: What the development would look like if we apply the gateway system.

A trusted gateway system to the blockchain is structurally decentralized in its backend and it provides endpoints users can call to execute their web3 business via APIs. It interacts with the blockchain, as well as the dApps and wallets. This system will focus on solving these problems:

  • With the help from the gateway system, dApps can deploy without their own infrastructure and communicate with the wallet directly for information on the blockchain. Some current wallets do not support or intend to support this feature owing to their own infrastructure implementation, but we envision a future where gateway systems are easily accessible to every developer through wallets.

  • Wallets can be a lot snappier now since a significant amount of computation has been offloaded to the gateway system, for all the web3 services (as shown in the figure above). The gateway system will also have a high-performance backend that is responsible for cashing, access control, and bi-directional communication via websocket.

The gateway system to the blockchain could be beneficial to the users and the developers for it could enhance the scalability and responsiveness of the system. It will achieve a greater level of convenience if the demand and usage of dApps in Chia grow higher. But the challenge for the system would be to earn trust from the users and other developers in the defi world.

Even more possibilities?

The aforementioned gateway system is just an idea that we envision and below are some more of the functionalities we can think of that also serve well:

  • An activity-based analysis of the whole blockchain can be easily carried out by the gateway system. For example, standard Chia farming and transfer events, CAT minting/melting/transfer events, NFT minting/transfer/royalty collection events, etc. This activity feed can be collected by wallet users or blockchain explorers, avoiding showing end users coin sets which are hard to parse for human eyes.

  • If the users provide an observable wallet public key, the gateway system can even effectively provide a non-SPV wallet to browser extension users. That means, you will have a seamless experience transitioning from Chia official wallets to extension wallets!

Summary

We talked about the current development in Chia and painted a picture of an easier development in which responsiveness and scalability are achieved via a lightly trusted gateway system. We believe that such a gateway system could be favorable to the users and developers, and maybe you have a better idea to foster the ecosystem!

· 3 min read
J.

banner

🌱 Hello Chia holders and Hashgreen readers, welcome back to another weekly update. In the previous update, we explained two fundamental ideas in decentralized finance (DeFi), that is, order books and swaps. Some of you may already know these concepts, but we believe a succinct explanation is needed to let everybody know what's going on and what product they are using.

This week, we have a few updates that we would like to tell you about.

tl;dr

tutorial page, my orders pagination, adjustment of landing page on the mobile, and the update for amm.

What's Been Done

  • The tutorial for Hashgreen DEX is out now! Considering the complexity and the novelty of DEX, we release a tutorial segment as a guidance for users who are new to our page or not familiar with the landscape of DeFi.
Figure: Tutorial will pop out for first time users.

  • We will guide you through the main features of Hashgreen DEX, in the hope that you will quickly understand how to trade in Hashgreen DEX. (You can also visit our Docs for more information. 💖)
Figure: Follow the steps to learn key features and how to trade.
Figure: You can always find the tutorial here in the navigation bar.

  • We've added pagination in My Orders. A page can display up to 8 transactions, and below the panel lay the pagination buttons where you can click to see your transactions collated and presented in different pages.
Figure: Click different pages to view your orders.

  • Our team has made a few adjustments to the appearance of our landing page on different mobile devices.

What's Rolling

  • We at Hashgreen have had some gradual progress along the way building the AMM. The development is now in full swing. Our team has almost finished the smart contract's high-level design and only micro adjustments are needed for future implementation. We want to secure a seamless end-to-end trading experience in which our dApp interacts smoothly with the connected wallet.

  • Concrete plans of tokenomics and functionalities will be out around early September, and the same goes for the whitepaper. We will release an alpha version, "Alpha Testing", on the testnet and start testing it around early November. Alpha Testing is opened to community members on Testnet10. You are absolutely welcomed to join our Alpha Testing and if you do so, you can accrue alpha tester status (possibly rewards!). Once we make sure everything is well prepared and settled after Alpha Testing, we will formally launch the service, set to release in 2023, on Mainnet. By the time "Mainnet Launch" gets going, it will be available to everyone, accompanied by the releasing of Hashgreen token.

timeline

· 4 min read
J.

banner

Welcome back to another Hashgreen's weekly update! Previously on Weekly Update #11 we talked about the design features that began to take shape for the AMM, hankering for the best outcome to our users and to the ecosystem. We also announced a few updates and a call for volunteer translators. If you are willing to help with the translation, please visit our Discord.

This week we will be taking you through two topics: the AMA we attended earlier this June and our thought and expectation for offer2 according to the feedback from the community.

Hashgreen at Chia in China's AMA

What Chia is trying to solve with its NFT standards

In the AMA held by Chia in China, we introduced our products and talked about offer features and Chia's NFT standards. Below are three factors we mentioned about Chia's NFT during the AMA, namely what Chia is trying to solve and realize with its NFT standards.

  • Autonomous offer trading: to trade without authorization from a third-party platform.

    Chia does not need you to authorize a third-party platform to operate for you. This could fundamentally prevent users from getting scammed.

  • Decentralized Identifier (DID): to verify the authenticity and to prove the ownership.

    Has it ever happened to you when you bought an NFT and later discovered that it was an impersonation scam? This is what Chia wants to solve with its NFT1 standard. DID is like a digital identification that confirms the authenticity. With such method, creators or project owners can have their NFTs connected with their DIDs, proving the ownership with the digital identity.

  • Royalty: to pay profit-sharing to the author of an NFT.

    How many percent of royalty payment should be given to the author of an NFT is what Chia's figuring out and this is going to be one of the core ideas for NFT1.

Chia's NFT is definitely a worthy path to take and a pull factor that attracts developers, investors, and users to come, especially when there's a variety of paths such as DEX, NFT, and DeFi that people have embarked on to develop or build Chia's infrastructure.

Regardless of which path you are going to take or have taken, we, Hashgreen, are always pouring ourselves into helping these projects, including NFTs. Most importantly, providing a steady and strong base for Chia's community is what we expect and choose to do to allow all tokens in Chia to be able to trade.

Committed and Uncommitted Offers

What we think offer2 can hold for us

Offer files (”offers”, “offer1 standard”) have been one of the biggest drivers for the community activities in Chia, as it provides a p2p way for people to trade trustlessly and securely. As one of the first adopters of offer1, we love it so much that we start to think what we ultimately want it to evolve into based on the feedback of many DEX users. We heard these feedback:

  • Why does my attempt to fulfill the offer fail?

    Ok, so this relates to how current offers are structured: they are not commitments on the chain to indicate token swap intentions, but merely a memorandum of understanding. The offer makers can withdraw their offers any second by spending the recorded coins in the offer, while you, the offer taker, have to check if the coin still exists beforehand.

    Can we make this process better? Yes! In fact, the offers should be on chain with two possible exit paths: either via settled swaps or clawback after some timeout. You can be assured that the offer is still 100% valid as long as you peek into the coins and you know for how much longer they will continue to remain valid.

  • Is there a limit price I can put? Partial fill?

    No limit price. No partial fills. Ouch.

    This is most of our experience with the current DEX on Chia, and we understand it so much more. We would call it lack of feature rather than a bug for offer1, as the logic for limit price and partial fills are very custom to fungible tokens. The logic for offer1 is perfect, for example, for NFTs as they need to be exchanged in whole. We think a good offer2 design should leave rooms to house some custom logic, including things like “allowing transactions to go through as long as prices are above this price” and “self re-instantiation if certain conditions are met”.

From an AMM building perspective, we think having an offer2 that satisfies the above criteria would allow an easier exchange of funds, thus increasing liquidity and capital efficiency in the Chia Blockchain. So, rest assured folks, while Hashgreen Labs continues to build on Chia!

· 3 min read
J.

banner

What's Been Done

AMM's Design Features Explained

Hi Chia holders! We at Hashgreen have some updates on the long awaited AMM! Over the past weeks, while we have implemented basic building blocks for the smart schemes, more importantly we are composing these blocks to ensure users have great experience trading and participating in our ecosystem.

  • A sustainable token and distribution scheme for the Hashgreen ecosystem:

    We want to bake our tokenomics directly into our AMM by highly incentivizing the first batch of supporters for their rapid adoption. On the other hand, we are considering allowing not only liquidity providers to earn (liquidity mining), but also protocol owners — each and every one who owns the Hashgreen token — to earn.

  • Fair pricing of token pairs:

    We all know there are huge Miner Extracted Values (MEVs) in the Ethereum ecosystem, and especially when it comes to trading, miners can easily manipulate the orders of contract interaction in their favor. Chia Blockchain does not have this problem, and we enforce a rule of single price per block to prevent market manipulation. Everyone who interacts with the AMM gets the same price and does not get front-run.

  • Name your slippage tolerance and commitment period:

    When you put orders in to buy from/sell to the AMM, on top of the assured fair prices, you can additionally specify a maximum slippage tolerance you are willing to accept, and until when the order is valid. These fully adjustable parameters will make interactions with AMM a very familiar experience compared to existing ones you have used before.

There are many more design features we are currently working out! If you have questions, feel free to shoot message at our Twitter or Discord!

What's Rolling

  • Language switch option is about to be released again in the near future! As we would like to support as many languages as possible, we are looking for volunteer translators! If you are interested in providing help, please head to our Discord server and write a message in #translators or DM @HG | Daisy and @HG | James to let us know.

  • Lately we've noticed that there's some impersonation scams in Chia's community and people have been affected by it. Thanks to the community's effort and your report, we were able to identify it and withdrew it from circulation in our DEX. Please be extra careful when you make any transaction, and make sure you have a full understanding of the background of the tokens you're going to trade. The effort in identifying and terminating scams is also attributed to the token listing mechanism in our DEX, where the data is reviewed after being imported from TAIL database API. We are currently working on adding warning messages in the DEX to help you and please keep careful watch for potential scams whenever you trade.

· 4 min read
J.

banner

Hello to all the readers, who have stayed with Hashgreen along the way!

My name is James, the newly hired community lead of Hashgreen. I will take charge of the Weekly Update series and carry on providing information for future product updates. Harry will still publish tech blogs from time to time, leading you through finer details of Blockchain technology related to Chia and Hashgreen.

Over the month, the Chia community seems to have been less active than before, yet with the recent release of Chia Blockchain 1.3.4. As for us, we have made a few updates on Hashgreen DEX.

What's Been Done

  • Over the past few weeks, our DEX development team has implemented multi-offer upload into the web interface to make the process of transactions quicker and easier! Users can now upload multiple offer files simply by clicking the upload button or dragging and dropping offer files directly into the page.
Figure: You can now upload more than one offer file!
  • A new design of open orders and order history (now called my orders) is released. It's easier now for you to check the status of your orders and even make adjustments to it with a few clicks. Details of the trade information will be shown in the display board. The two dropdown menus at the top allow you to filter certain types of offers that you wish to see. You can also cancel your offer using the cancel button in the action column. Or you can cancel multiple offers by selecting them at once.
Figure: Click all markets or all status to manage your orders.
  • Our team has updated a new interface for the order book, in which we re-oriented the menu of the offers. Offers asking or bidding a certain coin will be aligned with each other. You are able to expand or close the panels, to either compare the asking and bidding price or leave the order book with only one of the offers presented.
Figure: You can zoom in to see specific types of offers.
  • We have released an update for the header! We add a control button where old headers are put together with the user ID button that was temporarily removed. Light/dark scheme switch and language options are moved to the header as well.
Figure: User ID allows you to sync between different devices.
Figure: Here is the button to copy your user ID.
Figure: To merge records, press import once you enter your user ID.
  • We've continued to iterate with new features in the DEX, some of which are dedicated to the feedback from our Discord community.

What's Rolling

  • AMM is still under slow but steady development. Enabling AMMs on the Chia Blockchain turns out to be a really hard problem! If you'd ask us when you will have HashgreenSwap to test out on the testnet, we expect it to be here in another two quarters! In the meantime, we are starting to think about the tokenomics for the Hashgreen Token, to not only allow the profits to circulate back to the community but also create an active and healthy scheme that lasts long.

  • In order to ameliorate the user experience, the UI/UX team will continue to remodel the web interface. We are working hard on the new landing page besides a few more integrations!

· 3 min read
H.

banner

What's Been Done

  • Over the past weeks, fees on the Chia Blockchain seems to be here to stay. To allow our users get their transactions on chain quicker, we now provide users with the ability to supply fee by adding to the supplied Chia amount or removing from the requested Chia amount in their offers. The suggested fee is hinted on the pop-up window for order book items, and is currently 0.0001 XCH. We chose this number since it not only suffices to be on top of the mempool, but is miniscule (7 cents USD at the time of writing) for users. In the future, we plan to implement more accurate fee estimators to give better fee hints and save you some bucks.
How is it done?

With Chia offers, Hashgreen is able to redirect the provided fees into a temporary address, then we generate a SpendBundle on the fly to spend the extra amounts as fee. This SpendBundle is then aggregated with the user offers before we push it to the Chia Blockchain.

Figure: These are two different options you can provide to match an offer you like

fee-prompt

  • We made it easier for users to submit your orders! Simply copy the amounts provided in the pop-up panel when you hover on the offers you want to match against with the copy button. You can also paste your offer file string directly on the web interface.
Figure: Here are the button to copy your preferred amounts to supply

copy-fee

Figure: In the official Chia wallet, use this copy button to copy the raw offer file into your clipboard

copy-offer

Figure: Press this big paste button to upload your offer file

paste-offer

  • Many partners are starting to integrate our Market Statistics API into their platforms. The previous generation were slow and bulky, taking nearly 30 seconds to complete a call. We have optimized it to return the results in under half a second.

  • New market selection menu is now available at UAT interface. If you want the UAT interface to connect with mainnet, head to UAT settings and toggle on PROD.

market-selection

  • We fixed many bugs on the frontend interface, including incorrect display of order status (sometimes it shows "Confirming undefined"), and user token retrieval errors.

What's Rolling

  • The smart coin team is coding up the first version of AMM coin driver for an MVP AMM protocol. As time goes on, we will gradually implement more standard functionalities in current AMMs!

· 3 min read
H.

banner

This is a long overdue update to the community! During the past two weeks, we are looking at other aspects of development on the Chia Blockchain.

What's Been Done

  • We worked with many project developers, including NINE, NioCoin, Zomb Studios, and FundMyLaptop on their airdropping campaign with our in-house airdrop tools. The need for such a tool for project developers cannot be overstated, and we managed to test it fairly thoroughly over the duststorm, sending out thousands of transactions on Chia. The airdrop tools is aimed for a open source later this month.

  • The chialisp team is developing a chialisp library that enables secure smart coin development on Chia, much like OpenZeppelin on Ethereum. The goal is to not only establish a set of tools for easier smart coin development, but also re-implement some standards (e.g., CATs) for these advanced developers to understand the use case. Below is an sneak peek on the square root function we implemented which would be a core utility function for AMMs!

(
;; Babylonian method for square root.

(defun cypher.math.sqrt-loop-babylonian (var var1 var2)

(if (> var1 var2)
(cypher.math.sqrt-loop-babylonian
var var2 (/ (+ (/ var var2) var2) 2))
var1
)
)

(defun cypher.math.sqrt (var)
(if (> var 3)
(cypher.math.sqrt-loop-babylonian var var (+ (/ var 2) 1))
(if (> var 0) 1 (if (= var 0) 0 (x)))
)
)
)
  • The backend team wrapped up integration with the TAIL Database. We now have all the community CATs in our database, and once the new market selection menu is rolled out, you will be able to easily search up token markets!

  • The UI/UX team worked through the first draft on the user interface refactor on Figma.

  • We onboarded a frontend engineer, Henry, to help with mobile wallet integration. He will work with Goby wallet to enable that one-click trading experience.

What's Rolling

  • Goby integration is apparently the most requested feature! However, unlike offerpool and offerbin, Hashgreen implements our technology to be an offer aggregator so the raw offer files are never exposed to fellow users. We instead ask the wallet to upload a counter-offer to our website, which we can then be combined with existing offer on Hashgreen for blockchain execution.

  • Due to the shear number of CATs out there, we are prioritizing the market selection menu refactoring. The upgraded menu would allow you to easily navigate hundreds of CATs, star your favorite ones, and group CATs by their types.

  • We noticed that there is a need for a robust transaction micro-service to handle dApp requests, especially during the duststorm where fee is non-zero and when everyone suffers. This transaction micro-service will not only deterministically make sure a transaction is delivered, but also provide on-chain fee estimates for our upcoming dApps.

· 3 min read
H.

banner

What's Been Done

API Access

Trading API has been the biggest update for the week. We are committed to provide a diverse set of API for developers so the community can grow with us. At the same time, we would like you to be explicit about the usage of Hashgreen APIs in your products to spread the words! Let us know your story and the creative use of both open market information and statistics.

  • We added USD quotes and USD volume in the market stat endpoint. The fully diluted market cap for the base currency in USD (the token in the front of the trading pair) is also provided as a ball park measure of how big the token is.

Note that the reference prices are only estimates are can be vulnerable to self-trading exploits. Please do not use currency price quotes directly in mission critical systems but only as a good reference.

User Interface

  • The frontend team has been working hard on i18n (check out the beta site), and will be soon be pushed to the production site. We are offering Chinese and Spanish as a taste test, and are preparing for a community-based translation campaign!

i18n

  • The aforementioned market statistics are now displayed as a part of the market header. You can easily judge market liquidity based on the USD volume.

i18n

  • We've also worked through a bunch of frontend bug fixes including market selection menu overflow and asset filter menu. We won't bother detailing them but rest assured we are incorporating community feedback.

What's Rolling

  • Now that we have the fully diluted market cap, we are making a market overview menu to highlight the most traded and the highest cap tokens.

  • The fully diluted market cap does not holistically represent the true market capitalization as any whale can HODL the majority of the tokens. What is more representative is the market cap based on circulating supply which can be tricky to automatically detect on Chia. We are working on some smart algorithms to pick that up from the blockchain.

  • In the long run, we realize we need a more elegant product UI to streamline user experience. The recently onboarded UI designer is starting to work hard on the refactor.

  • We had some very fruitful discussion on the mathematical design of automated market makers (AMM). There are some pretty important implications translating everything from account-based to coin-based models, and we are pretty sure we nailed it correctly.

· 3 min read
H.

banner

Happy lunar new year everyone! The Asia-based Hashgreen dev team had a great lunar new year over the past week! We find that our Discord community has been very active, and some updates might get buried under the exciting updates on new CAT tokens joining the family every other few days. Hence we are starting to update you about our technical progress on a weekly basis.

What's Been Done

User Interface

  • We added the light/dark scheme switch to make your eyes more comfortable, located in the footer section.
  • Right beside the market selection button, there is a row of market statistics showing 24h high, 24h low, volume, and the current price.

API Access

  • To facilitate automatic trading, we released our first API doc on trading, including the ability to list markets, order books, and personal order creation/cancellation. We envision more and more participants can be in this process to reach the best market efficiency, involving arbitrage loops across Hashgreen DEX and other exchanges. In the loop, you will have to involve Stably Prime as they are the only stablecoin issuer on Chia right now.

  • The statistics of markets can now be retrieved via stat API. In the first version, we provide 24-hour statistics on the traded volumes, and are working towards representing the volumes in USD.

Personnel

  • We onboarded a UI/UX designer, Ann, to help us improve our product further. There are some complicated integration with our partners including the official Chia wallet, a in-development Chrome extension wallet, and potentially one other browser-based wallet. We imagine the UX flow to be increasingly complicated, and hence it is time to involve specialists.

What's Rolling

  • I18n is coming! We aim to build Hashgreen DEX to be a platform everyone in the world can enjoy, and we soon will need your help to translate our product!

  • The smart contract team is working on several chialisp designs, which can be a pretty prolonged process as it requires not only security audit but implementation and integration with wallet partners. One of the most immediate improvement to the Hashgreen DEX is to use an alternate version of offers to allow partial filling of offers.

  • The next critical piece for the on-chain economy and DeFi will be Automated Market Maker (AMM)! AMM implementation on the Chia Blockchain will require some bells and whistles though, and we are working very hard to propose a first draft. This set of chialisp implementation will not only be secure and fair from a user's perspectively, eliminating potential extractable values. All of these are still in development, but we want to stay tuned for more exciting updates!