Stellar Quests Level 1: Manage Offers
Tags: xlm, stellar, blockchain, tutorial
Published: 2022-10-21 22:16:34

## What are Offers?

An offer, on the Stellar blockchain, is when a party/person/thing decides to buy/sell one asset for another at a specific exchange rate; ex. I want to sell 100 XLM for 1,000 SALT. This takes place on Stellar's decentralized exchanged (DEX). There are three different types of offers on Stellar: Buy Offer, Sell Offer, and Passive Sell Offer. Technically, all offers are both buy/sell offers. The difference in wording is to help others "reason" about their offers.

How promptly an offer is executed depends on whether or not there's a relevant counter offer on the decentralized exchange (DEX). If there aren't any relevant counter offers, then the offer will sit until a counterparty takes it or until it's removed.

## Manage Buy Offer

Buy offers are created by building a transaction of operation type "Manage Buy Offer". This operation asks for six inputs: selling, buying, buy amount, price, offer id, and source. *Selling* is the asset you're giving in exchange. *Buying* is the asset you're getting in exchange. The *Amount* is the required total of the buying asset you want to receive for this offer. The *Price* is the "price of *one unit* of buying in terms of selling"; so if we're selling 100 XLM for 1000 SALT, then each unit of SALT we're buying costs .10. *Offer ID* tells the transaction to do one of two things: create a new offer (Ex. 0), or update an existing one (Ex. 3948329). The *Source Account* is the public key of the account that'll be creating the offer; this input is optional because if the offer won't be created by the account which has built the transaction, then the public key entered here will refer to the account that will create the offer. **NOTE:** All transactions **MUST** be signed off by all source accounts mentioned; in this case, the account which built the transaction and the account which is actually creating 
the offer.

## Manage Sell Offer

Sell offers are created by building a transaction of operation type "Manage Sell Offer". This operation asks for six inputs: selling, buying, buy amount, price, offer id, and source. *Selling* is the asset you're giving in exchange. *Buying* is the asset you're getting in exchange. The *Amount* is the required total of the buying asset you want to receive for this offer. The *Price* is the "price of *one unit* of selling in terms of buying"; so if we're buying 100 XLM with 1000 SALT, then each unit of XLM we're buying costs 10. *Offer ID* tells the transaction to do one of two things: create a new offer (Ex. 0), or update an existing one (Ex. 3948329). The *Source Account* is the public key of the account that'll be creating the offer; this input is optional because if the offer won't be created by the account which has built the transaction, then the public key entered here will refer to the account that will create the offer. **NOTE:** All transactions **MUST** be signed off by all source accounts mentioned; in this case, the account which built the transaction and the account which is actually creating 
the offer.

## Passive Sell Offer

This is a concept I'm still struggling to understand because the definition itself has a lot of contradictions- lol. Take a look...

> A Passive Sell Offer creates an offer to sell one asset for another *without* taking a reverse offer of equal price (??? Okay). This allows you to maintain an order book that both buys and sells an asset equally without the offers actually executing (??? What).


![... so anyway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdz3ije9g6z1zda7x5j9.gif)

## Outro

I plan on writing corresponding blog posts with relevant code examples. For now, I'm simply learning the basics of the Stellar blockchain and utilizing the Stellar Laboratory in order to interact with the test net. If you wish to learn about the Stellar blockchain, and earn while doing it, then please visit: https://quest.stellar.org/