All about Osmosis — Chain Marker #1

DSRV
DSRV
Published in
7 min readJul 14, 2023

Osmosis, the Cosmos ecosystem’s representative decentralized exchange (DEX) chain, is a unique platform designed to support specialized chains. Instead of putting several smart contracts on a single chain like Ethereum, Cosmos creates application-specific chains. These chains are easy to develop because the Cosmos SDK takes care of the basic groundwork, allowing developers to focus on unique features.

The Cosmos SDK’s smart contract in Tendermint (Tendermint and CometBFT) and InterBlockchain Communication (IBC) are included in all chains in the Cosmos ecosystem. Through IBC, tokens from various chains in the Cosmos ecosystem can be imported into Osmosis for trading. Even tokens from chains outside the Cosmos ecosystem like Bitcoin and Ethereum that do not support IBC can still be traded on Osmosis through the Axelar Bridge.

Osmosis Features

1. Diverse AMM Support:

Initially known for its Constant Product Market Maker (CPMM), Osmosis later added Constant Function Market Maker (CFMM a.k.a Curve StableSwap). Time Weighted Average Price (TWAP) and Geometric TWAP defend against price manipulation attacks. Also, Osmosis recently introduced its own version of Supercharged Liquidity.

2. CosmWasm:

Application-specific chains require a hard fork upgrade every time a new feature or modification is added, making them less flexible. To address this, the smart contract platform CosmWasm was introduced. CosmWasm applies WebAssembly to blockchain in order to develop efficient web applications across heterogeneous systems. Although not a fundamental component of the Cosmos SDK, chains such as Osmosis and Juno have adopted CosmWasm. One of the important points about CosmWasm in Osmosis is that it is not permissionless, thus governance is required for contracts. This governance aspect ensures that the platform remains secure and accountable. InterChain Name Service (ICNS) is also implemented as a smart contract, allowing the use of easy-to-remember names instead of long code addresses. CosmWasm smart contracts can access modules in the Cosmos chain, enabling the creation of programs closely related to the chain, such as liquid staking derivatives.

3. Diverse Transaction Fee Tokens:

Osmosis supports the use of various transaction fees, including tokens that have crossed over to IBC — such as ATOM and asIUSDC — in addition to its own OSMO token. The authorized tokens for use as fees are calculated and paid based on the Osmosis DEX market price.

4. IBC Rate Limits:

Through IBC, Osmosis prevents large-scale token transfers for a specific period to prevent serious issues or hacks on chain. The criteria for deciding whether to prevent something or not are primarily determined by considering the platform’s risk tolerance and governance discussions.

5. Superfluid Staking:

Liquidity providers can stake a portion of the OSMO supplied as liquidity in approved pools like ATOM/OSMO. Liquidity Provider Tokens (LP Tokens) serve as collateral for price fluctuations and slashing. In addition to liquidity rewards, liquidity providers can also receive staking rewards. This is possible due to the unique characteristic of Osmosis, where locked LPs also secure the chain. By staking their LP tokens, liquidity providers contribute to the overall security and stability of the Osmosis network, further incentivizing their participation in the ecosystem. Osmosis plans to introduce Interfluid Staking, which involves staking tokens like ATOM paired with OSMO on the corresponding chain.

6. Protocol-Owned MEV:

Maximal Extractable Value (MEV) is the profit obtained by manipulating the order of transactions. As a result, users end up unknowingly trading at unfavorable prices. Osmosis is currently reducing MEV by adding arbitrage transactions at the end of each block. Unlike regular transactions, arbitrage transactions cannot be sandwiched in between other transactions. The profits from arbitrage trading will be collected in a public fund for use.

Osmosis Developer Tips

API

Osmosis offers four types of APIs: REST, Tendermint RPC, gRPC, and Indexed Data. The Cosmos SDK provides gRPC services primarily but also HTTP services like REST and Tendermint RPC for user convenience. The HTTP services depend on gRPC services and may not support all gRPC functions.

  • REST provides information on chain modules via the HTTP API and uses port 1317. All That Node offers this service as a REST API.
  • The Tendermint RPC enables interaction with Tendermint by offering a low-level API that grants access to various functionalities such as retrieving information about raw blocks, peers, and consensus. This API operates on port 26657 and is specifically designed for consensus algorithms within the Cosmos SDK. Using the low-level API abci_query in Tendermint RPC, all gRPC APIs can be accessed, even in HTTP. However, encoding parameters in Protocol Buffers format is required. All That Node provides Tendermint RPC services, except for WebSocket.
  • gRPC is the default information channel in the Cosmos SDK. Unlike HTTP, which communicates in human-readable text, gRPC uses a binary format that is more efficient but requires the use of libraries. All That Node is preparing to provide a gRPC service.
  • Indexed Data https://api.osmosis.zone/ is an API that provides processed Osmosis information by Imperator.co and is used in the Osmosis UI. All That Node does not currently provide Indexed Data service.

Although the automatically generated OpenAPI specification from the source code has many missing parts, the situation has improved with the enhancement of the Osmosis documentation last year. On the Osmosis documentation page, you can see menu buttons for Tendermint RPC, REST, Indexed Data, and IBCGO, which are for IBC-related calls during REST. However, in some cases, developers may still need to refer to the module documentation or source code for parameter values and descriptions. Familiarity with the Cosmos SDK, Tendermint, and CosmWasm used by the current Osmosis version can be helpful.

Transaction Fees

The node sets up a minimum gas fee and rejects any transactions with fees lower than that. Initially, Osmosis did not have a transaction fee, but the recommended minimum fee was increased to prevent spam transactions. Through the latest governance vote, the minimum gas price was set to 0.0025 uOSMO.

Allow Smart Contracts to be Uploaded

To upload a CosmWasm smart contract on Osmosis, governance consensus is required. Once the team account has gained the trust of the DAO, there is no need to obtain consensus every time a smart contract is uploaded. Conversely, if the community loses trust, governance can rescind this permission through a governance vote to remove smart contracts.

Querying at a Past Block Point

Using the x-cosmos-block-height header in an HTTP request allows you to query information from a past block height. This is useful for checking the account balance at a specific point in the past and accessing information visible only in a certain block. For example, individual account voting records can only be viewed during the voting period for governance votes. After the vote, only the total number of yes and no votes remains. Therefore, individual account voting records can only be queried at the block height when the vote ends.

All That Node provides an archive node that can freely query previous states, unlike a full node that can only query the recent block states. However, Cosmos SDK chains often start a new chain while maintaining the state of the last point in time, which may make it impossible to query the state of the chain before the restart. The Osmosis mainnet (osmosis-1) has not been restarted yet, but the testnet (osmo-test-5) cannot retrieve information from the previous testnet.

Daily Downtime

While other Cosmos-based chains may be available 24/7, Osmosis operates differently and experiences a brief downtime once a day. This is because the pool rewards are calculated on a daily epoch that starts at 17:00 UTC. Recent records show that blocks were not created for about 6–7 minutes, next block being created at 17:16 UTC. But there’s no need to panic — this is just a normal part of the Osmosis ecosystem.

All That Node Osmosis Service

All That Node currently offers shared plans and dedicated plans for Osmosis, providing reliable services for users that need more advanced functionality. However, due to the heavy workload and requests with response sizes in the hundreds of megabytes, the free-tier has been temporarily discontinued to maintain service quality and prevent errors regarding node synchronization. But existing users need not worry, as services will still be available. At the moment,

All That Node provides Tendermint API (JSON-RPC API, Websocket API) and LCD API (REST API) services for both mainnet and testnet archive nodes. The team plans to start providing gRPC service soon, and they are working on optimizing heavy requests to reduce the burden on the network. This means users can expect even more advanced services in the future, making it easier than ever to get the most out of the protocol.

Osmosis plays a central role in the financial hubs that contribute to the Cosmos ecosystem, especially in its role as a DEX. With a diverse set of features like AMM support, CosmWasm integration, and flexible transaction fee tokens, Osmosis provides Web3 engineers with powerful tools for innovation.

By leveraging All That Node, you can maximize your building experience with Osmosis, which is leading the future of decentralized finance.

Stay tuned for the next article from our new series!

About All That Node

All That Node, powered by DSRV, is a multi-chain node and data provider service that has supported numerous developers and companies since 2021. With DSRV’s expertise in Web3 infrastructure, developers can focus on their projects without the hassle of Dev/NodeOps, uptime, scaling, and other concerns. All That Node handles nearly 1 billion requests per month on over 25 networks worldwide.

Keep up to date with All That Node!

Website | Twitter | Discord | Blog

Written by
Jeongho Jeon, Protocol Specialist, DSRV All That Node Team (Twitter @maczniak)

Edited by
Domitille Colin, Brand Communications Manager (Twitter @domitille_marie)
Hyunjie Yu, Brand Marketer, DSRV Brand Marketing Team (Twitter @CathyYu220314)

Designed by
Heeyoung Moon, Brand Designer, DSRV Brand Marketing Team

--

--

DSRV
DSRV
Editor for

EVERYTHING DISTRIBUTED, SERVED COMPLETE. — DSRV is your easiest access to blockchain infrastructure solutions.