Invisible Infrastructure Phase 01 | Co-creating with Global Developers, Comprehensive Analysis of OKX Web3 Wallet API
Under the drive of innovation genes, the OKX Web3 wallet excels both internally and externally: continuously optimizing products internally while broadly exploring co-creation externally.
In terms of broad exploration and co-creation, the OKX Web3 wallet leads in open-source code on one hand and increasingly strengthens API construction on the other. This move is significant in the blockchain technology ecosystem, as it not only promotes technological innovation and development efficiency but also enhances system transparency, interoperability, and security, driving the construction of the Web3 community and ecosystem, improving user experience, and promoting industry standardization.
Moreover, the OKX Web3 wallet lowers the development threshold and establishes extensive connections through open-source code and open APIs, enabling collaboration, mutual learning, progress, and creation with global developers, thus promoting the construction of infrastructure in the crypto industry.
Functions like APIs, which everyday users may not easily notice or that are not prominently displayed, are akin to the "invisible infrastructure" of the OKX Web3 wallet; although important, they are seldom known by the broader user base. As there is currently no introductory content regarding the OKX Web3 wallet API on the market, this article will focus on the API aspect. By comprehensively analyzing the OKX Web3 API functions, we hope to attract and assist more developers in realizing their ideas and bringing innovations to fruition. This is the first installment of the OKX Web3 invisible infrastructure content and the first installment of the OKX Web3 API series. The second installment will delve into the stories behind the OKX Web3 team's API construction through dialogue.
OKX Web3 Wallet API Framework
API, short for Application Programming Interface, is a set of definitions and protocols for building and integrating application software. APIs allow different software systems to communicate and exchange data. Through APIs, developers can leverage existing functionalities and data without having to write code from scratch. APIs can significantly improve development efficiency, promote system interoperability, and drive technological innovation.
As an industry-leading one-stop Web3 entry point, OKX Web3 provides a complete Web3 development solution—OnchainOS. As a multi-chain Web3 development engine, OnchainOS standardizes the access to chains and services, greatly reducing development cycles and investment costs, encompassing major modules such as wallets, DEX aggregators, marketplaces, DeFi, and more, as well as trading liquidity to on-chain data solutions. If developers wish to build their own Web3 services, adopting OnchainOS will be a more efficient and economical choice.
To better serve developers, significantly lower the development threshold, and improve efficiency, OKX Web3 provides very comprehensive, detailed, and illustrated API documentation: https://www.okx.com/zh-hans/web3/build/docs/waas/okx-waas-what-is-waas, interested developers can click to view at any time and follow the steps to use it.
The OKX Web3 wallet now supports over 100+ public chains and provides a unified user experience across three platforms: app, plugin, and web, covering five major areas: wallet, DEX aggregator, DeFi, NFT marketplace, and DApp exploration. It has also launched a Bitcoin inscription and rune trading market, dedicated to providing users with comprehensive Web3 services.
Next, the article will introduce some API-related content using the wallet, DEX aggregator, marketplace, and DeFi sections as examples.
Wallet API
As the core of the entire product, the wallet section API provides a non-custodial wallet's underlying technical solutions, helping developers easily build on-chain services and applications. For example, Web3 multi-chain wallets, built-in wallets for DApps, multi-chain Web3 applications, exchange wallet services, and so on.
The wallet API has the following three core functions in wallet services: 1) Multi-chain address aggregation, providing asset statistics capabilities for millions of addresses; 2) Multi-scenario, easily accessing 60+ networks, supporting heterogeneous multi-chain ecosystems and various BTC asset protocols; 3) High availability and stability. Implementing interfaces and system monitoring ensures smooth access.
Developers can efficiently and securely build wallets using the wallet API in just three steps, easily accessing 60+ networks, including popular EVM, Solana, TRON, BTC, etc., and also supporting cutting-edge ecosystems like inscriptions. In the future, the wallet API will gradually provide capabilities and solutions for MPC wallets and AA smart wallet accounts. Through powerful wallet services, developers' Web3 wallet development needs can be fully met, simplifying the entry process for Web3 wallets.
Specifically, the wallet API covers multiple core modules to meet users' basic asset management and trading needs. For example: address and wallet generation, on-chain asset and coin price information queries, transaction management, as well as queries for currency information, gas prices, and address authorization information among other commonly used data. The transaction management module provides a rich array of services, including building, signing, broadcasting, tracking transaction queries, supporting transactions on EVM and other account model networks, and supporting transactions on UTXO model networks like BTC. Overall, developers can use the wallet API for account management, asset management, transaction management, common information queries, and Webhooks (real-time subscription to on-chain data), etc.
First, in account management. Unlike the general single-address query model, the wallet API provides a structured subscription query for multiple addresses, allowing developers to associate multiple addresses with one account, efficiently querying asset status and transaction history in multi-chain scenarios. The wallet API offers two types of accounts: wallet accounts and observation accounts. Among them, 1) Wallet accounts require message signatures for authentication, can freely add custom tokens, and can send transactions. 2) Observation accounts do not require message signatures, default to displaying all tokens listed on the OKX platform, and cannot send transactions.
Developers can use the account management API to create wallet accounts and manage addresses under wallet accounts, aggregate observation account addresses, update wallet accounts, update observation accounts, delete accounts, query the list of created accounts, query addresses under accounts, etc.
Second, in asset management. This includes adding subscribed currencies to accounts, obtaining corresponding asset balance amounts, viewing total assets, and deleting assets that are no longer of interest. Notably, for wallet accounts, developers can add and manage custom currencies. For observation accounts, custom addition or management is not possible; they can only obtain the asset balances of currencies currently supported by the wallet API.
Developers can use the asset management API to add currencies, obtain wallet account token balances, obtain observation account token balances, obtain specified currency balances, obtain total asset balances, delete currencies, query currency lists, etc.
Third, in transaction management. This includes how to send transactions and query transaction records. Developers can use the transaction management API to obtain data required for signing, gas price, gas limit, nonce, etc., and perform address verification, query transaction details by transaction hash, query transaction details by order ID, query transaction lists by account, query transaction lists by address, etc.
Fourth, in other aspects. Developers can also query chain-related information such as UTXO and currency information through the API; or subscribe to block events and transaction events through Webhooks, with a maximum of 20 subscriptions created in batches each time, etc.
DEX Aggregator API
The OKX DEX aggregator is a one-stop multi-chain, DEX, and cross-chain aggregator, currently aggregating over 25 cross-chain bridges, 40+ public chains, and more than 400 DEXs. It achieves a single transaction using multiple DEXs through X Routing smart routing, providing users with better prices, better liquidity, and 0 transaction service fees, while also featuring DEX market boards, limit orders, and KYT security checks.
Its core mainly includes single-chain Swap and Bridge, both of which require on-chain data parsing to complete the entire transaction process. Single-chain Swap and Bridge can be combined into different trading modes based on the currency pairs exchanged. For example, transactions can be completed through source chain Swap + Bridge, or through Bridge in one step, as well as through source chain Swap + Bridge + target chain Swap for cross-chain transactions. Among them, the self-developed XBridge contract of the OKX DEX aggregator is the core of the entire transaction, supporting cross-chain transactions between mainstream EVM chains, heterogeneous chains, and cross-chain transactions between EVM chains and heterogeneous chains.
Developers or professional users can use the DEX aggregator API documentation to build the required Web3 trading services and applications, such as Web3 wallets, DApp projects, and DeFi projects in various application scenarios.
The OKX DEX aggregator API features multi-chain support, multiple cross-chain bridges, support for multiple DEXs, as well as stability and high availability. Its response time is within 100 milliseconds while providing better inquiry paths for free. Currently, the OKX DEX aggregator API mainly covers: exchange API, cross-chain API, limit order API, which are convenient, easy to understand, and secure to use.
First, in terms of exchange functionality, the OKX DEX aggregator aggregates liquidity sources from decentralized exchanges such as Uniswap, Curve, and Balancer, and can split a single transaction across multiple DEXs, providing users with better prices through efficient routing. The OKX DEX aggregator will automatically find liquidity pools on-chain with better liquidity depth, comprehensively calculate prices, slippage, and transaction costs, and through a smart order-splitting algorithm, based on a comprehensive comparison of DEX and PMM quotes, select the best quotes for users across three dimensions: greater liquidity, lower slippage, and better prices.
Developers can use the exchange API to obtain the list of chains and currencies supported by the OKX DEX aggregator, liquidity lists, transaction authorization, exchange prices, transaction data, etc.
Second, in terms of cross-chain functionality, the OKX DEX aggregator aggregates high-quality cross-chain bridges such as Circle CCTP, Stargate, Across, Wormhole, and SWFT, providing users with multiple cross-chain path options. This allows for exchanging on the source chain, then performing cross-chain bridge transactions, and finally exchanging on the target chain for the desired tokens. The OKX DEX aggregator's self-developed superior algorithm X Routing can automatically find liquidity pools with better depth on-chain during source chain transactions, comprehensively calculate prices, slippage, and transaction costs, and obtain better exchange quantities through a smart order-splitting algorithm. It will then compare prices across multiple high-quality cross-chain bridges, comprehensively calculating the quantities to cross, bridge fees, slippage, and transaction costs to obtain better cross-chain quotes.
Developers can use the cross-chain API to obtain the list of chains and currencies supported by the OKX DEX aggregator for cross-chain exchanges, bridge information, path information, transaction authorization, transaction data, query transaction status, etc.
Third, in terms of limit order functionality, the OKX DEX aggregator limit order is a process where users buy or sell tokens at a specified target price in decentralized exchanges. If the current market price meets the user's specified target price, the DEX aggregator will automatically complete the order transaction. Through the DEX limit order API, users can create and query limit orders through the interface and aggregate liquidity into the DEX aggregator, enjoying better prices.
The OKX DEX aggregator limit order API features that limit order transactions need to wait for DEX aggregator users to fill the orders, limit order creators experience no slippage, and support partial order fulfillment. Developers can use the limit order API to obtain the list of chains supported by the OKX DEX aggregator, transaction authorization, currency lists, create limit orders, query limit orders, etc.
Marketplace API
OKX Marketplace covers EVM NFT markets, Runes markets, Ordinals markets, and issuance markets, supporting a total of 26 mainstream popular public chains including Bitcoin and Ethereum.
First, in terms of the EVM NFT market. The OKX NFT market is a one-stop decentralized NFT aggregation trading platform that has aggregated platforms such as Opensea, Magic Eden, and Looksrare, allowing NFT holders to list their NFT works on multiple markets simultaneously and achieve higher liquidity at lower transaction costs. Additionally, it supports multi-chain NFT creation and cross-platform trading, providing real-time on-chain data for users and developers, dedicated to building a decentralized, multi-chain NFT ecosystem. Currently, the OKX NFT market gathers order depth from multiple mainstream markets and platforms and includes a vast amount of NFT collection data, providing timely order data for developers and users, and offering real-time accurate on-chain data.
The OKX NFT API provides two main functionalities: data querying and trading. In terms of data, it includes NFT and collection information queries, transaction data queries; in terms of trading, it supports one-click listing on multiple markets and bulk purchasing of lower-priced orders across multiple markets. Developers can use the NFT marketplace API to obtain NFT details and lists, collection details and lists, networks and markets that have been integrated, query listings, bids, purchase orders, etc.
Second, regarding the OKX Runes market. The OKX Runes market is the industry's first platform to provide rune trading on the app side, allowing users to perform bulk purchases and engravings of Runes assets with zero platform fees. In the future, the OKX Runes market will continuously optimize and add more new features based on user feedback.
Developers can use the OKX Runes market API to obtain collection information, get popular collections, access transaction history, retrieve wallet assets, obtain order information, submit listings, etc.
Third, the OKX Web3 wallet Ordinals market is the largest BRC20 inscription and BTC NFT trading market. The OKX Ordinals market is fully decentralized, interaction-free from platform service fees, and supports one-stop transfers, trading, and engraving of BRC-20 and BTC NFTs among other functionalities.
Developers can use the Ordinals market API to create Ordinals listings, obtain inscription asset lists, submit listings, get Ordinals collection lists, orders, transaction history, and related models, etc.
DeFi API
OKX Web3 DeFi is a leading one-stop DeFi trading aggregation platform in the market, making it easy for users to quickly and accurately find educational products that meet their needs. OKX Web3 DeFi has currently integrated over 80 protocols, including Aave, Compound, Curve, Yearn, and Uniswap, and supports more than 15 networks such as Arbitrum, Ethereum, and Polygon.
The OKX Web3 DeFi API details the data interaction process during user transactions, including subscription processes, redemption processes, and reward claiming processes. By integrating the OKX Web3 DeFi Open API into applications, developers can enable users to easily and quickly access all DeFi protocols and enjoy the fun of earning tokens while trading DeFi.
Specifically, developers can achieve various functions through the OKX Web3 DeFi API. First, in terms of information querying, it supports developers in querying protocol lists, token lists, product lists, product details, network lists, etc. Second, in terms of calculations, it supports querying estimated calculation information for subscriptions and redemptions. Third, in terms of transactions, it supports generating calling data for pre-transaction authorizations, generating calling data for subscription transactions, generating calling data for redemption transactions, and generating calling data for reward claiming transactions. Fourth, at the user level, it supports querying users' positions, querying users' balance lists, and querying users' redemption application lists.
Innovation as the Foundation, Walking with Global Developers
In today's rapidly evolving blockchain and cryptocurrency field, open-source and open APIs have become important driving forces for technological innovation and industry development. The OKX Web3 wallet, by promoting code openness and open APIs, not only provides global developers with stable and reliable technical support, rich resources, and convenient tools but also enhances the overall industry's transparency, interoperability, and community collaboration.
Among them, the design and implementation of the OKX Web3 wallet API are based on a profound understanding of innovation and a continuous pursuit of it. The OKX Web3 wallet provides a powerful and flexible platform for global developers through API construction, offering a standardized interface to access and utilize its platform functionalities, allowing developers to innovate on existing foundations and quickly develop and deploy new decentralized applications (DApps). For example, developers can use the API interface to build innovative DeFi protocols, decentralized exchanges (DEX), and other blockchain applications, enabling them to unleash their creativity and technical prowess in the blockchain and cryptocurrency fields, proposing new ideas and solutions, and jointly pushing the boundaries of technology.
At the same time, open APIs allow developers and users to clearly understand and utilize the various functions of the OKX Web3 wallet. This transparency helps enhance user trust in the platform, promoting its adoption and use. For instance, developers can refer to the API documentation to understand the specific functionalities and usage methods of each interface, thereby better utilizing these resources for development. Through open APIs, the OKX Web3 wallet demonstrates its open and transparent attitude to the community. This stance not only enhances the platform's credibility but also attracts more developers and users to participate in the ecosystem, enriching the application scenarios of the entire ecosystem and jointly promoting the platform's development.
In the long run, by attracting more developers and projects to join, the OKX Web3 wallet can deeply integrate with other blockchain platforms and service providers, forming an interconnected blockchain ecosystem that not only promotes technological advancement and application expansion across the entire blockchain industry but also lays a solid foundation for building a more open and collaborative ecosystem. It also drives the prosperity of its own platform.
In summary, the construction of OKX Web3 on APIs showcases a higher vision, "What we do now is all for the future."
Disclaimer
This article is for reference only. It represents the author's views and does not reflect the position of OKX. This article does not intend to provide (i) investment advice or recommendations; (ii) offers or solicitations to buy, sell, or hold digital assets; (iii) financial, accounting, legal, or tax advice. We do not guarantee the accuracy, completeness, or usefulness of such information. Holding digital assets (including stablecoins and NFTs) involves high risks and may fluctuate significantly. You should carefully consider whether trading or holding digital assets is suitable for you based on your financial situation. Please consult your legal/tax/investment professionals regarding your specific circumstances. You are solely responsible for understanding and complying with applicable local laws and regulations.