shakedex - Non-Interactive, Reverse-Dutch Auction Name Swaps
Posted: Mon Feb 08, 2021 5:04 am
Hey there!
I'd like to introduce shakedex, a CLI-based decentralized exchange for Handshake names. It works under the hood using the non-interactive name swap protocol described here, but uses CLI interface to make things much simpler:
Installation:
shakedex talks to your hsd full node's wallet, so be sure to install that too.
Sell side:
Then, on the buy side:
The purpose of the locking script is to make sure that the swap can complete atomically by preventing the name from being updated, revoked, or renewed while the auction is active.
The pre-signed auction transactions form a reverse-Dutch auction. Reverse-Dutch auctions are auction in which the auctioneer sets a high starting bid and decreases it over time until someone chooses to fulfill the bid. With shakedex, each pre-signed auction transaction uses nLockTime to prevent name swaps of lower bid amounts until a certain time is reached. The create-auction command lets you configure this.
I've attached an example set of auction presigns to this post - I'll create a mainnet auction once I finish buying a couple of throwaway names.
Buy side footnotes:
Once name buyers execute the fulfill-auction command they'll need to wait 48 hours for Handshake's transfer lockup to expire before being able to update the name. However, because of the locking script the name is effectively theirs the moment their fulfill transaction is confirmed.
Example presigns:
I'd love to get some feedback on this project. If anyone has a name that they are willing to part with on mainnet to help me test this, I'm willing to pay up to 500 HNS for it. Just let me know.
I'd like to introduce shakedex, a CLI-based decentralized exchange for Handshake names. It works under the hood using the non-interactive name swap protocol described here, but uses CLI interface to make things much simpler:
Installation:
Code: Select all
npm i -g shakedex
Sell side:
- Transfer your name to a locking script using shakedex transfer-lock <yourname>.
- Finalize your name to the locking script using shakedex finalize-lock <yourname>.
- Create an auction by running shakedex create-auction <yourname>. This will spit out a list of pre-signed auction transactions that anyone can fill in order to execute the name swap.
Then, on the buy side:
- Download a list of pre-signed auction transactions.
- Fulfill the best bid at the current time by running shakedex fufill-auction <path to the presigns>.
- Finalize the swap by running shakedex finalize-auction <name>. That's it!
The purpose of the locking script is to make sure that the swap can complete atomically by preventing the name from being updated, revoked, or renewed while the auction is active.
The pre-signed auction transactions form a reverse-Dutch auction. Reverse-Dutch auctions are auction in which the auctioneer sets a high starting bid and decreases it over time until someone chooses to fulfill the bid. With shakedex, each pre-signed auction transaction uses nLockTime to prevent name swaps of lower bid amounts until a certain time is reached. The create-auction command lets you configure this.
I've attached an example set of auction presigns to this post - I'll create a mainnet auction once I finish buying a couple of throwaway names.
Buy side footnotes:
Once name buyers execute the fulfill-auction command they'll need to wait 48 hours for Handshake's transfer lockup to expire before being able to update the name. However, because of the locking script the name is effectively theirs the moment their fulfill transaction is confirmed.
Example presigns:
Code: Select all
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qy89693mvr9wahqx0czy8x706efd8d7ad932s78","price":10000000000,"lockTime":1612601826,"signature":"10dd0c9e384bf76f9e21d50201cfbffa417216efe5f1eb87c143c691713dd25c2829454ccabee5a61474f2c3fedc1116d6589d14df1279ca484063c9ec7aa55e84"}
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qhdaj3czcgma3xd8lxan2fv29rlagkqe6vd90qe","price":9587500000,"lockTime":1612605426,"signature":"bf8cf96d339a7c96687610e09c00bd723d10cf69565fe31b0b3e77c6fd0f188c3b6cd05ba0ee9b6e79ec31dcc2fa320b1e9d8b5ad083bb0aad6a1aec3095ed6d84"}
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qggsn5c5exadzt7l34mnsfyaj3aakeyuur6n7dd","price":9175000000,"lockTime":1612609026,"signature":"43aa149f81013d6832619118c8a8d60de6d8a525b248d8813a8a4f12c7c2ecaa45cbe20485a41678264528c33b04f7dab89be7bb5ffda91a4bd9a641fed57fcc84"}
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qc0u7zk098tykac4emfhymp74ruh4tyjjc0puqw","price":8762500000,"lockTime":1612612626,"signature":"e8fa4943e238164bb4904b839dc8aa9ba0945fa149eff33fa4ddeb6c20350f4c6e7eb40042be125dad765efea0282d9d7c52629d5298dd115320175267c97eb884"}
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qa3l34tntpck55cfraftpqy830wztjc882cagm4","price":8350000000,"lockTime":1612616226,"signature":"a277c1ffd07689609f1632da640ad241349ccf5d45e3a23e9f7c8f44ddc5c1727b3f5fa6ee13b7e70fe88f2d4ec6a0e61a8ad5eb3c8f42a973b5f1a9bf39e59c84"}
{"name":"yeet","lockingTxHash":"4d36784c48da73283541ff7321aa6f484a5125458845e2df78982a01ede5d6ca","lockingOutputIdx":0,"publicKey":"03b10ad937d89152b85e5560052c4f467c489c7c9519af2a8df2cf6daa5fdce8d4","paymentAddr":"rs1qcrztsyv7u5q97rdg26mueay9spldnn0jfmz092","price":7937500000,"lockTime":1612619826,"signature":"52f37b4a1fb903961ab4262df4728e587988de223eef4705ad0e7d48ee75e2cb5180347202bb15fd6b0285adc1a4f2c78599ba2154fc03865e04b12ed0de99d084"}