How Partial Transactions Create a Secure and Flexible Exchange of Assets

AliceNet
Valence Labs
Published in
4 min readMar 16, 2023

Contributors: Cameron Stow, Justin Holt, Stephanie Lynch

As Web3 advances, investors must still rely on marketplaces that are inefficient, vulnerable to attacks, and require users to relinquish control over their assets. Worse, even in a multi-chain ecosystem, so many of our activities are siloed and limited by the chains our assets live on. The lack of interoperability, proportional liquidity, and control is a thorn in the side of our industry and a barrier to mass adoption. Fortunately, AliceNet provides a solution to these challenges with partial transactions.

Partial transactions allow open marketplace orders that are written and awaiting a second participant to sign them before they can be transmitted to the blockchain. This approach allows individuals on both the inputs and outputs of a transaction to maintain possession of their assets until the transaction is validated. Better yet, there’s zero cost to list an asset or delete an open order.

In this article, we describe how partial transactions work and discuss the implications of this approach for open order book marketplaces.

UTXOs and Partial Transactions

Within a UTXO-based transaction model, a signature hash flag, or sighash, determines which portions of a transaction are included in the signed message. In Bitcoin, each transaction input is a reference to an output from a previous transaction. This means that all inputs must reference specific previous outputs, and all outputs must be listed, too, for a transaction to be valid. Once a transaction is signed, any changes to the inputs or outputs will result in a different transaction hash, and the transaction can’t be submitted to the network.

Inspired by Bitcoin’s sighash, we modified AliceNet’s transaction hashing algorithm to enable users to create partial transactions. The first participant effectively seals a transaction by inputting an asset they currently hold, outputting a specific amount of an asset they want in exchange, and then broadcasting it to the network. Later, another participant agrees to the terms set in the predefined inputs and outputs and then completes the transaction by independently generating their signature on the outputs. Only then is the transaction considered valid and can be successfully transmitted to the network.

Partial transactions on AliceNet don’t even need to be an exchange of one type of asset for another. For example, if you want to trade several assets at once, you can list these assets as a set in the input (e.g., 2 WETH, 0.5 WBTC, and 1000 XUSD) and then list an asset you want in return as the output (e.g., the current equivalent in USDT). This flexibility allows for the trading of multiple assets within one transaction.

You can also safely construct multiple valid offers for the same asset (or set of assets). For example, if you have an amount of WETH that was bridged into AliceNet, and you want to trade it for XUSD, USDT, or a specific type of NFT, you can create three separate orders, each one with a separate asset listed in the output (i.e., XUSD, USDT or the NFT, respectively), and then transmit all three orders to potential buyers. As soon as one of these orders gets filled, the other two are automatically invalidated because the UTXO originally listed as the input is destroyed, and a new one is automatically created in its place as one of the outputs. If anyone attempts a replay attack by re-transmitting the same transaction more than once, the new transaction will immediately fail because the original UTXO no longer exists.

Retain Control of Your Assets

We built this technology because we’ve seen so many problems around centralized exchanges not maintaining proportional liquidity, thus putting their clients’ assets at risk or out of reach when bankruptcy is declared. Additionally, partial transactions replace a lot of the mechanics of open order books by way of permitting individuals to possess their assets when transmitting the value being offered. “Not your keys, not your crypto” becomes a moot point when the owner of an asset retains complete control up until the moment a transaction becomes valid. Better yet, we’ve effectively solved the escrow problem without requiring smart contracts or for these transactions to be arbitrarily complex. Last but not least, because partial transactions aren’t submitted to the network until both inputs and outputs are signed, it costs nothing to create an open order, or delete one to change the inputs and outputs as needed.

Additionally, AliceNet makes it easy for anyone to effectively run their own marketplace on top of these secure primitives to host potential offers. A marketplace creator can insist that all partial transactions must include a percentage override to cover the infrastructure costs of a centralized exchange — something equivalent to the three basis points seen in Uniswap or Balancer — all without requiring users to give up custody of their assets.

In summary, partial transactions made possible on AliceNet can create new opportunities for innovation in transaction execution while also giving peace of mind to end users. Key features to remember are:

  1. Security — due to the ephemeral nature of UTXOs and their ability to resist replay attacks.
  2. Flexibility with trading your inputted asset for any number of predefined outputted assets that you’re willing to receive in exchange.
  3. Complete control of your assets until the transaction is validated.

About AliceNet

AliceNet is a layer 2 EVM-compatible blockchain that uses an unspent transaction output (UTXO) model, creating greater cost-efficiency and throughput between chains without compromising security. AliceNet is designed to enable trusted transactions and verifiable proofs of data across web3.

We believe AliceNet can become the underlying utility layer to power everything from voting protocols to state channels to payment channels to bridges.

Connect with us:
Website | Twitter | Discord | GitHub

--

--