Jedex: Decentralized Exchanges on Bitcoin Cash

Jedex is a technical demonstration of a decentralized exchange (DEX) built on Bitcoin Cash using CashTokens.

Jedex – Joint-Execution Decentralized Exchange – is a decentralized exchange design that leverages the performance and scalability of Bitcoin Cash to create a global, non-custodial, censorship-resistant token exchange. Jedex is a proof of concept that demonstrates a variety of new contract techniques made possible by CashTokens, a proposal for Bitcoin Cash's May 2023 upgrade.

System Design

Jedex is a set of contracts that work together to accept orders, match trades, and automatically settle tokens and BCH.

Batch Settlement

Buyers and sellers place orders by making a transaction from their wallet, and trades occur periodically in large batches. If a counterparty is not available, a market making algorithm automatically accepts the trade using funds or tokens held in a "liquidity pool" managed by the exchange. The liquidity pool is fronted by a liquidity provider (LP), who earns a percentage on each trade.

Serverless, On-Chain

Jedex is a protocol – it does not require a server; it can be deployed from an offline wallet and is driven entirely by user-broadcasted transactions on Bitcoin Cash's peer-to-peer network. New instances of Jedex can be deployed by anyone, for any token, at a network cost of a less than 1 cent (USD).  Once deployed, most Jedex transactions are smaller than equivalent standard transactions: Jedex authenticates its own transactions using non-fungible tokens, so signatures (~65 bytes) are replaced by just a few bytes.

Parallel Order Submission

The system maintains multiple Unspent Transaction Outputs (UTXOs) to accept orders from many users in parallel, and transactions are ordered within these "threads" by users rather than miners or well-connected nodes; this reduces the impact of market manipulation like frontrunning, and could offer better pricing and more consistent experiences for users.

Decentralized Management

Liquidity Provider (LP) administration is controlled by a non-fungible token, so a Jedex instance can itself be managed by another on-chain entity. For example, a decentralized corporation could issue shares (as tokens) allowing the public to buy into the LP, pay dividends, and conduct votes on Jedex management actions. This highlights the composability of CashToken-based decentralized applications.

Sample Use Cases

Though Jedex is a relatively simple demonstration, it exhibits valuable features for many use cases.

Chain-Issued Event Tickets

To offer a better experience for attendees, event organizers can issue event tickets on Bitcoin Cash, allowing users to hold, transfer, and redeem the ticket with their preferred wallet – no vendor lock-in.

By deploying a Jedex instance for the event, organizers can sell tickets without servers to manage (or a middleman), attendees can buy or sell tickets directly in their wallet, and event organizers can even make a percentage on ticket resales.

This system isn't limited to general admission tickets – new categories of tokens can be issued for any kind of ticket: front-row seats, priority sections, backstage passes, VIP service, season passes, box rentals, etc. Even if a particular ticket type is "sold out" (and can't be bought at any price from the liquidity pool), would-be attendees can make "standing offers" to all potential sellers using limit orders. At the right price, a seller may accept the offer, and the trade occurs automatically.

Chain-Issued Stock, Options, and Bonds

For many businesses, traditional stock, option, and bond issuance is an expensive distraction. By issuing assets on-chain, businesses can preserve company resources (by disintermediating portions of the financial-industrial complex), investors can gain wider access to investment opportunities, and holders can enjoy the benefits of greater competition among wallets, exchanges, investor protection bureaus, and other service providers.

Jedex is an ultra low-maintenance architecture that allows businesses and investment funds to quickly create public markets for new assets: the same wallet software used to create new tokens can also create public markets in which the same new tokens can be traded. With Bitcoin Cash as the ledger of record, forward-thinking businesses, their employees, and their investors can enjoy more fair, orderly, and efficient markets.

Better Privacy for Token Holders

Meaningful privacy is a critical, real-world security feature: leaked financial information puts users at risk of theft or other serious harm, and bad actors regularly gain access to centralized stores of financial information. Better financial privacy makes individuals safer and reduces violence.

Tokens often have a more limited set of holders than the wider community of BCH holders – this makes privacy harder to achieve for individual token holders; token swapping techniques are limited to other online holders, so even relatively popular tokens may present privacy concerns. Jedex allows token holders to access the privacy of the larger set of BCH holders: token holders can sell tokens for BCH and use post-CashFusion BCH to buy back the same kind of token (either immediately or after some delay).

Even if bad actors were aware of the user's token holdings prior to this privacy-enhancing transaction, once the token has been sold and the proceeds enter CashFusion, the attackers can no longer be sure that violence against the user will be "profitable": the user may have already purchased some hard-to-steal or hard-to-sell product, donated the money to charity, or otherwise disposed of the funds.

Finally, on-chain exchanges allow users in authoritarian jurisdictions to access global markets. Apolitical financial access is a lifeline for trapped families, a foundation for economic development, and a bulwark for individual liberty.

Learn More

To learn more, check out the complete technical description of Jedex and the overview of demonstrated concepts. For more information about CashTokens, see the CashTokens introduction or read the full CashTokens proposal.

A screenshot of a Jedex contract in Bitauth IDE.

Feedback and Discussion

Feedback and reviews are appreciated! The Bitcoin Cash Research topic is ideal for general questions and discussion. Issues and bugs can be reported on the GitHub issue tracker.