Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hip: xxx - non interactive nameswaps #3

Closed
wants to merge 1 commit into from

Conversation

tynes
Copy link
Collaborator

@tynes tynes commented Aug 7, 2020

This is a work in progress draft for a non interactive atomic swap based protocol for trading names on a secondary market.
I'd like to fill in more details and get some review from the community.

@brandondees
Copy link

I like this concept. It'll take me some time to read and understand the whole doc before I can comment more.

@Falci
Copy link
Member

Falci commented Jan 17, 2021

I took me a long to time understand how script works. Now it all makes sense to me.
In theory, it's pretty clear. Did you test this? I mean, is there domain swap made using this proposal already?
If not, I'd like to test it.

Also, I'd like to suggest to create a plugin, extending the hsd capabilities.
It would be interesting to have methods to:

  1. Transfer the name to the locking script (include the timerlock duration);
  2. Rollback the previous (after timerlock);
  3. Generate the partial TX with the expected amount;
  4. Fund and broadcast the previous (buyer's action);

An implementation is not required for a proposal, but it would help a lot its adoption.

@tynes
Copy link
Collaborator Author

tynes commented Jan 18, 2021

@Falci I have some proof of concept level code that can be found here: https://github.com/tynes/nameswaps/blob/538b98943fe35facd54f7c379f3d4832e68ea796/test/swapsring-test.js#L70

This test shows an example of how a counterparty would verify that the person selling their name is trustworthy. This code is not production ready and needs some major architecture improvements. The project that I was working on was implemented as a plugin for hsd, the biggest pain point that I was having was around P2WSH support in the wallet. Without that, I had to duplicate a lot of wallet code to get a similar UX to the current wallet.

@tynes
Copy link
Collaborator Author

tynes commented Jan 18, 2021

Footnote could be used for making the nameswap proofs available. I originally forked the hsd p2p networking code and added my own messages to make the proofs available. The plugin would maintain its own p2p network which seemed less than ideal but footnote didn't exist at the time and we needed a good way to make the protocol easy to participate in. A good MVP could be simple people posting their proofs to a centralized website, similar to how PGP servers work.

OP_ENDIF
```

This script could be improved upon and improvements ought to be considered for future versions of this HIP. Improvements include using `OP_CSV` to timeout the swap, enabling the seller to lower
Copy link
Member

@Falci Falci Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this?

After the name is transferred to the script (with no CSV) and finalised, the seller can create the partially signed transaction described here multiple times, with different values.

The seller should keep these TXs in secret, and only reveal the most expensive one. When the seller decides to go for a discount, he/she can release the cheaper TX.

If there's no buyer at all, the seller can do a regular transfer to his/her own address. The only benefit here would be to restore the ability to revoke the name.

@kurumiimari
Copy link

Hey there,

I've implemented a CLI tool called shakedex that implements this HIP and adds a Dutch auction layer on top using locktime. The source is at https://github.com/kurumiimari/shakedex. Would love some feedback, both on my implementation but also how else I can be helpful to the Handshake community.

Comment on lines +77 to +103
```
OP_TYPE
0x07 // UPDATE
OP_EQUAL
OP_IF
OP_RETURN
OP_ENDIF
OP_TYPE
0x0b // REVOKE
OP_EQUAL
OP_IF
OP_RETURN
OP_ENDIF
OP_TYPE
0x08 // RENEW
OP_EQUAL
OP_IF
OP_RETURN
OP_ENDIF
OP_TYPE
0x09 // TRANSFER
OP_EQUAL
OP_IF
<public key>
OP_CHECKSIGVERIFY
OP_ENDIF
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reccomend a simpler script: see kurumiimari/shakedex#5

OP_TYPE
<int transfer>
OP_EQUAL
OP_IF
  <pubkey>
  OP_CHECKSIG
OP_ELSE
  OP_TYPE
  <int finalize>
  OP_EQUAL
OP_ENDIF

@pinheadmz
Copy link
Member

@Falci I think this should be assigned a HIP number and merged, pending any updates from @tynes.

Other users can open PRs that update the protocol (for example my simplified script)

The implementation written by @kurumiimari should be included in the HIP notes as well, that is a common attribute of proposals like this and actually I think for example EIP might require an implementation before a proposal is assigned a number.

@Falci
Copy link
Member

Falci commented Feb 8, 2021

Sure @pinheadmz.

This is the first HIP 🎉 .
@tynes please, update and use the number HIP-0001

@Falci Falci added the janitor:assign Ask the janitor to assign a new HIP number label Feb 10, 2021
@tynes
Copy link
Collaborator Author

tynes commented Feb 10, 2021

I'll update with the hip number

@Falci Falci added janitor:assign Ask the janitor to assign a new HIP number and removed janitor:assign Ask the janitor to assign a new HIP number labels Feb 10, 2021
@Falci Falci removed the janitor:assign Ask the janitor to assign a new HIP number label Feb 19, 2021
@pinheadmz pinheadmz self-requested a review February 21, 2021 15:43
@agaamin
Copy link

agaamin commented Feb 21, 2021

I don't code so i cant understand but let me bring a common man's perspective as what would be a good product in the market.

A hub where TLD owners can all pool their TLDs. Different front ends can then sell SLDs for the TLDs using that hub maybe like an API.

If the TLD belongs to the company that has created the Front end then the money from the sale of the SLD/TLD goes to the front end with a small facilitation fee for the hub. If the TLD does not belong to the front end company then front end gets a small finders fee and the hub get a small facilitation fee and the rest goes to the actual TLD owner.

That way everyone who owns a TLD can gain from this, since not all TLD owners can get into a re-selling business. And Resellers don't need to generate vast resources to buy out everything under the sun.

It would be great if a very common payment gateway for fist like CC avenue can be used to accommodate Fiat payments along with crypto payments. The number of people who need and are interested in decentralized TLDs and SLDs will be way more than people with access and interest in crypto in general.

Regards :)

@Falci
Copy link
Member

Falci commented Feb 21, 2021

HI @agaamin,

Those are interesting suggestions, but SLD is completely out of the scope of this proposal. HIP-5 is closer to that.

About payment, the network has it own token ($HNS). At the protocol level, it will only accept HNS, but the app layer could offer more options for the user and convert it to HNS. Again, out of the scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants