1. Buyer and Seller generate 3 keypairs, swapping pubkeys, producing 3 2-of-2 addresses
2. Buyer deposits BTCamount to address A
3. Seller deposits BTCamount to address B
Am I right so far? How does the rest go?
You're right so far.
The magic is that the buyer and seller exchange the release transactions partially signed to each other.
qwertyoruiop's last idea is to make two addresses instead of three :
One is the payment address, the other is the bond address : let it be a multisig one and make it
so the vendor signs a transaction that sends coins back to him and other coins to buyer.
So, buyer gives up his part of the privkey to the vendor, and the payment is settled, then bonds.
Vendor creates a transaction that send half of the bond to him and the other half to the buyer, signs it, doesn't broadcast it but send it over the buyer. Buyer signs it and sends it.
If anyone tries to cheat the system the other party will simply not allow it. This could also let buyer and vendor settle a % refund in case package goes missing.
First address contains payment, second multisig one contains bonds from both the buyer and seller. When buyer releases the payment the seller gets it, but then the seller wants the bond back. But to do it, buyer must sign the transaction. So, seller creates a transaction that gives the buyer bond back to buyer and his bond back to him. Seller signs it, sends to buyer. If buyer agrees with the settlement of bonds, it signs it : bonds are back.
Also lets say that vendor wants to give a % back to buyer because of an error or something, he can specify it and buyer gets it back as part of the bond.
Instead let's say vendor is dishonest and wants more money : buyer sees the settlement and doesn't agree, coin is lost, vendor just got his bond back from the unlocked payment, so both parties are at a loss, and coins can't be spent until they settle.
The fact that bitcoin is deflationary is what I think will incentivize the eventual resolution of aging disputes, because doing it will end up worth ridiculously more to both parties than leaving the coins locked forever (which is still a loss).