Seaport
An overview of the Seaport protocol and how it powers OpenSea.
Overview
Seaport is a marketplace protocol for safely and efficiently buying and selling NFTs on the blockchain. Seaport was developed by OpenSea in 2022 and is the most used protocol for NFT transactions. Seaport powers the OpenSea website -- all orders created or fulfilled on OpenSea use the Seaport protocol.
Notable Links
How does it work?
Each Seaport order has many components, but we'll first discuss the: the offer
and the consideration
. To oversimplify:
offer
: what I am willing to give up (ETH / ERC20 / ERC721 / ERC1155)consideration
: what is required in return (ETH / ERC20 / ERC721 / ERC1155)
For example, if you want to place an offer on an NFT for 1 WETH, the offer
struct would look similar to this:
Offer Example
{
itemType: ItemType.FULL_OPEN,
address: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,
identifierOrCriteria: 0
startAmount: 1000000000000000,
endAmount: 1000000000000000
}
Breaking it down:
The address
and the identifierOrCriteria
represent which token is being offered (in this case, WETH), and the startAmount
and endAmount
represent how much of that token you're willing to pay. Again, this is just a basic offer at a set price, which is why the amounts are the same.
If the NFT of interest is the Cool Cats #1 NFT, then the consideration
would look something like this:
Consideration Example
{
itemType: ItemType.FULL_OPEN,
address: 0x1a92f7381b9f03921564a437210bb9396471050c,
identifierOrCriteria: 1
startAmount: 1,
endAmount: 1,
recipient: <your_address>
}
Breaking it down:
The address
is the address of the Cool Cats NFT contract, the identifierOrCriteria
is 1 because we want the NFT with tokenId 1, and the startAmount
and endAmount
are also 1 because we are offering for a single NFT (with ERC1155s, the amounts are often greater than 1).
How does it work with the OpenSea website?
If you place this offer through the OpenSea website (ex. offering 1 WETH for Cool Cats #1), OpenSea generates a Seaport order with those offer
and consideration
structs (and a bunch more info). OpenSea asks you to sign the order, and when you do, the order is submitted to the Seaport contract directly.
OpenSea constantly listens to and stores events on the Seaport protocol. Next time the owner of that NFT logs in, they'll see that offer on their NFT. If they choose to accept, OpenSea generates a "counter-listing" that is then submitted to Seaport.
Once Seaport sees the corresponding counter order, and if the offers are still valid, Seaport makes sure both the seller and the buyer receive the items they expect, and the transaction completes. This was a very high level overview
Updated 10 months ago