Skip to content

Instantly share code, notes, and snippets.

@drwasho
Last active March 17, 2016 16:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save drwasho/d923d2d37f544ea22e6f to your computer and use it in GitHub Desktop.
Save drwasho/d923d2d37f544ea22e6f to your computer and use it in GitHub Desktop.
Auctions on OpenBazaar

Auctions on OpenBazaar

Dependencies

  1. Ricardian Contracts on OpenBazaar
  2. P2P Lending on OpenBazaar

Introduction

It is becoming increasingly clear that OpenBazaar will become a powerful platform that will support a variety of peer-to-peer market transactions. One of the most fundamental market transaction types is the auction of a good by a seller to discover the market price. In this article, we cover one possible way of auctioning a good using Ricardian contracts.

It should be noted that this proposal essentially describes the 'back-end' of implementing Ricardian contracts into auctions on OpenBazaar. It is important that the end-user (i.e. your mother, grandfather etc with novice skills) will be unaware of digital signing, hashing etc occuring in the background unless they choose to be, in order to lower the technical barrier of entry for using OpenBazaar.

Auctions

The seller firstly selects an auction template contract in OpenBazaar. In this type of contract, the product and auction details of the good to be sold are entered into required fields within the JSON or XML file. The product auction details would include:

  1. The name and description of the item
  2. A minium sell price, if any
  3. A 'buy now' price, if desired
  4. An expiration date for the auction
  5. A blank field for a bidder to enter their price

For example, let's imagine Alice wants to sell a yellow pinata on OpenBazaar. After digitally signing it, the auction_contract looks something like this:

Contract hash: 8f9cfa1255e4f4c1a5cc1d21c7dd7ce233aa0c9b

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

<?xml version="1.0"?>

<!-- Seller's NYM -->
<nym_id> Alice-NYM-ID-HASH </nym_id>

<!-- Node Address -->
<node_addr> Westeros </node_addr>

<!-- Bitcoin Pubkey -->
<btc_addr> 03d728ad6757d4784effea04d47baafa216cf474866c2d4dc99b1e8e3eb936e730 </btc_addr>

<!-- Product Details -->
<item_name> Yellow Pinata </item_name>
<item_description> Good condition, never busted. </item_description>
<item_image> https://img0.etsystatic.com/000/0/6342324/il_570xN.326696084.jpg </item_image>
<min_sell> 5 mBTC </min_sell>
<bid_price>  </bid_price>
<buynow_price> 30 mBTC </buynow_price>
<auction_expiration> 2014-06-25 21:00 UTC </auction_expiration>

<!-- Sellers's PGP Key -->
<PGP_Public_Key>
- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Mailvelope v0.8.2
Comment: Email security by Mailvelope - http://www.mailvelope.com

xsFNBFODLW8BD/9rmoBRBASaZuNpPBG+Gj7/aJcE7aQ4Sti7lKaERFD7/rHd
WHm+o+FnyQvxpkOuuU6G4q739tP5ZqHx/bn9rhpAKKa+o7es70jlpenHyge4
0QyIU1/9jXzwlMsXkq9XfbOhqtgiBRpeZ83/ZjUsf5/wQXhrGWvG4rnKj5kh
YNq8PHzqJO21cDcD7LJy6yPuOgrBfb4MMa3+9lauIZ5Ye2kXR4m1OuWrig0M
7SwgFZwo3GbmcWe5KCK60nHW0AZh47B/yC18s/uR3t2bGrkQwL6AgTiOd2hX
/K2l1ccgIPnWo1s/5fMc7HiGpPkioOYhWgDm+2bimh56D2Tq7ikZQSDZIhw4
2pOQCevN/efak7vc2vaaaKqGreF8EwQ5vahF9bS6aNzXzdG1t6PYVAIupdWz
Ct0vrZr1ynBaIEEBJlFuI3vEyp+X85BVqV9B7gWbcE6vLeUPUB/Nu4NEdg5V
4Np+URFQvW9NKfN04kGfuEViVe0sfgSEc86h+eJ3gWTI8NdhJZdRkzKzlB7Q
FzMfL0TzxKSkOSu47eWx64e4xsyvkAVirkDb5VRzoeOOpJ/5ZOE1Cv8XJWEU
Zd/WAyp60LT2Ga8mCqhUrPAkcQKsPhccEn23mxIH8Pt3xWfnDFqtma7Tu2fB
CM4UKpd/dAjTVnZNNjSuBb+4SGBuGiUkA3yvdwARAQABzR1MaW9uZWwgRGVu
dCA8bGlvbmVsQGRlbnQuY29tPsLBcgQQAQgAJgUCU4Mt1gYLCQgHAwIJEKnO
FXGYSKNNBBUIAgoDFgIBAhsDAh4BAAAzQQ/9GArtJ4cNqPqM//NJCsQHCy35
mKOpErbEkia/U10wlISD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N PGP SIGNATURE-----
Version: BCPG v1.47

iQKBBAEBAgBrBQJTixgpZBxEciBXYXNoaW5ndG9uIFlhbWFuZHUgU2FuY2hleiAo
MjAxNCBLZXlwYWlyIGZvciBuZXcgZW1haWwgYWRkcmVzcykgPHdhc2hpbmd0b24u
c2FuY2hlekBvdXRsb29rLmNvbT4ACgkQ4HjIrr/yMs/xVhAAu6lUosqqw0TfG61L
XDjGo9U+EPqztU4Rt24QyMj5iNF6/2yNNWofrJLrPJXQJ7ZDhX18ZrAhCh7VGm7x
B86XwyAnlDRbIhZiKuXWlKG6vJAyLI66KrmU4me4+JY95aLQ/o9wgzv1QVV3kBEv
Cy3DJAmpqmHtLQ7EgL/mIANtoGMBs2bkhmudk3Dq4d1DQv+cokj3JfBvDqFLXte9
OfZPJY/mS5nSNUeNpjNwHtlQXQeabKX5IiP3tVRryMM63Sd+ZbJUF6TGCO8Yv6Uv
V1sz6Gdqk+vLvPMvqulzkQ8zSM2UAsBT+ylUjfoB9Gjie8uuVnTkg+3zoI5aqLRU
2cINQgkf0XSjU1kmxSiA/osxO51JKi0/1QV3RvBKBkKDJ/fQFzx/WVBfGhn1oYgg
digXDpUEgOqJ/CamT+XGAWKGpJb8gnE2fEsRIxKe5W1Al1FWiDrqO32+GEdJ40I4
h1pHFJP2ZFXykCs1Vkp4TONJIdGwonJAnQQBTUIf5i1aW1P9Jfobt1wHo4N5pvwv
FNK6M+dWuQtFzvVd6PxR9kPgP5PxpfHdZlJcRTh/GFrOuYPdeoKSqdTz680o7/1w
etGML8rzAKOEJNgewX58yNqvMq2t4VT5nNXu2RnMj5rJvzggZwkwa2i9pzvgtkGk
0eFXeq8J2lxvYVgNJJsSTX8olHA=
=O2ib
-----END PGP SIGNATURE-----

Bob accesses the contract and chooses to bid on the pinata. To place a bid on the item, he draws up the following digitially signed bid contract:

Contract hash: 57074779f93235c88a07b7c6de8285c8478cc6a6

<?xml version="1.0"?>

<!-- Buyer's NYM -->
<nym_id> Bob-NYM-ID-HASH </nym_id>

<!-- Node Address -->
<node_addr> Essos </node_addr>

<!-- Bid details -->
<auction_contract> 8f9cfa1255e4f4c1a5cc1d21c7dd7ce233aa0c9b </auction_contract>
<bid_price> 7 mBTC </bid_price>

<!-- Buyer's PGP Key -->
<PGP_Public_Key>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.47

mQINBFODLW8BD/9rmoBRBASaZuNpPBG+Gj7/aJcE7aQ4Sti7lKaERFD7/rHdWHm+
o+FnyQvxpkOuuU6G4q739tP5ZqHx/bn9rhpAKKa+o7es70jlpenHyge40QyIU1/9
jXzwlMsXkq9XfbOhqtgiBRpeZ83/ZjUsf5/wQXhrGWvG4rnKj5khYNq8PHzqJO21
cDcD7LJy6yPuOgrBfb4MMa3+9lauIZ5Ye2kXR4m1OuWrig0M7SwgFZwo3GbmcWe5
KCK60nHW0AZh47B/yC18s/uR3t2bGrkQwL6AgTiOd2hX/K2l1ccgIPnWo1s/5fMc
7HiGpPkioOYhWgDm+2bimh56D2Tq7ikZQSDZIhw42pOQCevN/efak7vc2vaaaKqG
reF8EwQ5vahF9bS6aNzXzdG1t6PYVAIupdWzCt0vrZr1ynBaIEEBJlFuI3vEyp+X
85BVqV9B7gWbcE6vLeUPUB/Nu4NEdg5V4Np+URFQvW9NKfN04kGfuEViVe0sfgSE
c86h+eJ3gWTI8NdhJZdRkzKzlB7QFzMfL0TzxKSkOSu47eWx64e4xsyvkAVirkDb
5VRzoeOOpJ/5ZOE1Cv8XJWEUZd/WAyp60LT2Ga8mCqhUrPAkcQKsPhccEn23mxIH
8Pt3xWfnDFqtma7Tu2fBCM4UKpd/dAjTVnZNNjSuBb+4SGBuGiUkA3yvdwARAQAB
tB1MaW9uZWwgRGVudCA8bGlvbmVsQGRlbnQuY29tPokCMgQQAQgAJgUCU4Mt1gYL
CQgHAwIJEKnOFXGYSKNNBBUIAgoDFgIBAhsDAh4BAAAzQQ/9GArtJ4cNqPqM//NJ
CsQHCy35mKOpErbEkia/U10w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GP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQIcBAABAgAGBQJTixr6AAoJEKnOFXGYSKNNKBcP/j9NtM5KK8/YvXfONAxBEkuB
e4NhcMigMewYM2RJjWIV+AsSQoEOmd4NpWjKzeIqEYeLBKadfY1mqatYXV50Pww0
UwwrmJcs4M0HgCDQlHwMqFPkGVfd8CfBmdDsaWwztyGbmZgzOSRKSJHHQGS3CO6S
fUqYIt+e3sEHWqf1Tj/5rJ5tuYn8awtaSkTAFPsDkpGiHq1Dr61gWD/DOyeQb1si
NMgzstC2GJ+bhq5kpUhqkE56ZRUFvgAM2dLK/NXMDgTozamrUFau532Lg3CRmhP2
0//P6Uos5KXXvcCuw64i15AdwqsKGrZ/RR2filot2Hen2y0JHvtGzqzVrKfwXqXV
cReEThDSn27y/rhqtRzmUwQSjz0IbemOIwQWRzB4T32THa+tQ3M9Enb4Q65N4W8k
AGgCy6v7ggYHvhQ15OGRE3C7gORfsQoL4FohhRAKmMCwBGj5V5a3pHHv3AwAy4Pz
j03emOwKASzyKbpT6QM+yIYqzYB+3OJJr6SDfBWH4r4D8kQYrwBbwMo4HIXbp5D9
qRPVDBvvmDv3p7ar7SqBhzS469rbnn5gIZH8kM2h2WfnBh1JwiDdVEeVdU7vY7CQ
SOL9iJiOUm4fkbPO141oovynn/4AZ1ORTR2Pw/godX5SsplWnuF16px7BXuDiomu
7PbH/QRFV4c5aSOZpwjb
=oB4I
-----END PGP SIGNATURE-----

Alice may receive five different bids on the yellow pinata and according to her conditions, the originally contract is updated with the latest bid price. At the end of the expiration date of the contract, Alice digitally signs the final winning bid contract, sends it to the arbiter for digitally signing and creating a multisignature bitcoin address for the winning bidder, Bob.

Due to the architecture of the P2P network setup, Alice may not be available 24/7 during the term of her auction contract to update the market on the latest bid price of the item. As a result, she may choose to upload her contract on a 24/7 accessible node (a negotiator node) that acts as a contract server. If so, the negotiator node will create their own contract for the item, digitally sign bid contracts, update the <item_price>, and turn over the final bid contract to Alice for her digital signature at the end of the contract/auction expiration date. If Alice digitally signs the contract, the contract is sent to an arbiter for sigining and creation of the multisignature bitcoin address for Bob, the winning bidder, to send funds to. As a reward for hosting the contract, the negotiator node is rewarded by a fee paid for by Alice (via another multisignature address setup with anoter arbiter). If Alice disapproves of how the contract was negotiated by the negotiator node on her behalf, she can simply refuse to sign the contract and raise a dispute to the arbiter for a refund of the fee from the multisignature address.

Insurance

For the seller (Alice), she can have confidence that the funds for the item actually exist once Bob has sent the required amount of bitcoins to the multisignature bitcoin address, upon which she will ship the item to Bob's designated address. Similarly for Bob, he can retrieve the funds from the multisignature address if he can prove to the arbiter's satisfaction that he goods either did not arrive, or did not arrive in the condition specified in the contract.

To further promote good behavior, the arbiter may require a surety bond from one or both parties. The surety bond is a quantity of bitcoins sent from either the buyer or seller (or both) held in a multisignature bitcoin address that is refundable upon a successful trade. If a dispute arises, and one party is found to be at malicious fault, the funds within the surety bond are transferred to the arbiter and opposing party as compensation.

A non-malicious versus malicous fault may be, for example, a shipping comapany damaging the goods during transport (non-malicious) versus the seller knowingly sending a damaged good (malicious). The value of the surety bond is negotiable and completely optional. However, it is reasonable to expect that surety bonds will become less necessary between individuals with a high web of trust reputation and/or proof of burn identity.

Conclusion

Ricardian contracts have sufficient flexibility to support eBay-style auctions on OpenBazaar, leveraging the authenticity and fidelity features that digital chain signing and contract hashing it has to offer. While the P2P network infrastructure and contract distribution protocol is still under development, we propose here a means of using a third party negotiator node to host contracts on behalf of a seller, updating price changes in real-time.

@drwasho
Copy link
Author

drwasho commented Jun 4, 2014

Good idea.

@Piste
Copy link

Piste commented Mar 17, 2016

Small typo:
the originally contract is updated with the latest bid price.
should read
the original contract is updated with the latest bid price.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment