Page 2 of 2

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Fri Jun 20, 2014 6:22 am
by biolizard89
phelix wrote:https://github.com/phelixnmc/antpy


ANTPY - Atomic Name Trading Pythonscript

phelix / blockchained d0t com

v0.1beta

Transfer a Namecoin name for NMC in a single Namecoin transaction.


How to use

1.) Buyer starts ant_buyer.py to create a half finished transaction and sends it to the seller as an offer.
2.) Seller starts ant_seller.py to accept, finish and broadcast the transaction.

To copy/paste you might have to click the icon on the top left of the command window.

Note this is an early version and there might still be vulnerabilities and bugs.
Ooh, nice work! I'll have to play with this sometime.

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Thu Dec 11, 2014 6:17 pm
by ryanc
I had an idea yesterday, and tried testing it (but screwed up a wee bit - will try again). It appears to be possible to improve on phelix's method in an interesting way.

You can generate a signed partial transaction which constitutes an offer to buy or sell a name.

A buy offer works like this:

Alice is willing to buy d/example for 25NMC. She creates and signs the following transaction using SIGHASH_SINGLE|ANYONECANPAY and publishes it:

Input 0 (Alice): 25NMC (must be a single output)
Output 0 (Alice): NAME_UPDATE, d/example, NEW_VALUE_HERE -> Alice's Namecoin address

Bob owns d/example and sees Alice's offer to buy it. He amends the transaction as follows, signs it, and transmits the transaction to the network:

Input 0 (Alice): 25NMC (must be a single output)
Output 0 (Alice): NAME_UPDATE, d/example, NEW_VALUE_HERE -> Alice's Namecoin address
Input 1 (Bob): d/example
Output 1 (Bob): 24.99NMC -> Bob's Namecoin address
Fees: 0.01NMC

A sell offer works like this:

Alice owns d/alpacasocks and is willing to sell it for 42NMC. She creates and signs the following transaction using SIGHASH_SINGLE|ANYONECANPAY and publishes it:

Input 0 (Alice): d/alpacasocks
Output 0 (Alice): 42NMC -> Alice's Namecoin address

Bob sees Alice's offer to sell d/alpacasocks and decides to buy it. He amends the transaction as follows, signs it, and transmits the transaction to the network:

Input 0 (Alice): d/alpacasocks
Output 0 (Alice): 42NMC -> Alice's Namecoin address
Input 1 (Bob): 42.01NMC (may be multiple outputs)
Output 1 (Bob): NAME_UPDATE, d/alpacasocks, NEW_VALUE_HERE -> Bob's Namecoin address

This has the following over phelix's method:

Advantages:

* When offering to buy a name, you do not need to know where the funds should go.
* An offer to buy a name is not invalidated by updates to that name.
* It is possible to offer to sell a name without a buyer being known in advance.
* It is easier to validate that the single input and output aren't fishy.

Disadvantages:

* Slightly more complicated.
* When offering to buy a name, you must have an output that has exactly the amount you want to offer in it.

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Fri Dec 12, 2014 8:22 am
by domob
That's very interesting! The method looks fine at a quick glance. I think signing with modified flags is possible with "signrawtransaction" already. But I guess one needs additional RPC calls or other tools to add inputs to the tx when accepting an offer, right?

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Fri Dec 12, 2014 7:39 pm
by ryanc
Yes, signrawtransaction can do SIGHASH_SINGLE|ANYONECANPAY. I was able to use pybitcointools and namecoind's RPC together to do all of the steps listed. I do not yet have something fully scripted but it should be straightforward.

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Sat Dec 13, 2014 3:03 am
by ryanc
Possible problematic scenario:

Alice makes an offer to sell d/example for 10NMC and posts it somewhere

Bob makes an offer to buy d/example for 25NMC and posts it somewhere

Charlie finds both these offers and makes a transaction where Bob gets d/example, Alice gets 10NMC and Charlie gets 15NMC minus transaction fees.

Is this a problem?

I'd argue it isn't really. I think it's kind of a dick move by Charlie, but this is just a more efficient version of Charlie buying the domain from Alice and then turning around and selling it to Bob. He is effectively paying himself a finder's fee. At least he's not doing this and then jacking up the price.

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Sat Dec 13, 2014 8:35 pm
by ryanc
Also, on if Alice makes a sell offer and Bob accepts it, Charlie can sever Bob's portion off of the transaction, replace it with his own, and try to double spend. May not really be a problem since Charlie still has to pay for it. Buy offers do not have this problem.

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Tue Oct 20, 2015 7:44 am
by phelix
I am currently looking into integrating ANTPY into nameGUI. (With nametrade I am less familiar and don't know how comfortably prepare the input with the correct balance).

With domob's help (thank!) I first got the script version to work with Namecoin Core (which was all but trivial because of a couple of changes).

Now there is one issue left: The seller can not check the fee height of the transaction because he does not know the balance on the inputs from the buyer. For some reason this (mostly???) worked on the old client. Any idea to get around this? Otherwise I think we will have to live with it...

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Tue Oct 20, 2015 3:10 pm
by phelix
btw: if anybody has suggestions for how this should look in a GUI form: the time is now :)

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Wed Jun 01, 2016 4:18 am
by grewalsatinder
Hi Phelix,

What's the update on this project?
What features and functions it has so far?
I see there are py scripts on your repo which are around an year old or so.
Is this project stuck somewhere in some process? What are the glitches which needs solving?
Why you think it's good for command line, I think GUI should be good to have this kind of name trades.

https://wiki.namecoin.info/?title=Atomic_Name-Trading
The instructions mentioned on this page are up to date?
Does this atomic name trading work with the latest namecoin code which is built using bitcoin codebase ?

And importantly is there any bounty on this project? :) I couldn't find any.

This is interesting project, I'd love to see it in GUI. If the API is there, I can probably look into it and see if I can do something about GUI design.

Cheers
Satinder

Re: ANTPY - Atomic Name Trading Pythonscript

Posted: Thu Jun 02, 2016 4:39 am
by biolizard89
grewalsatinder wrote:Hi Phelix,

What's the update on this project?
What features and functions it has so far?
I see there are py scripts on your repo which are around an year old or so.
Is this project stuck somewhere in some process? What are the glitches which needs solving?
Why you think it's good for command line, I think GUI should be good to have this kind of name trades.

https://wiki.namecoin.info/?title=Atomic_Name-Trading
The instructions mentioned on this page are up to date?
Does this atomic name trading work with the latest namecoin code which is built using bitcoin codebase ?

And importantly is there any bounty on this project? :) I couldn't find any.

This is interesting project, I'd love to see it in GUI. If the API is there, I can probably look into it and see if I can do something about GUI design.

Cheers
Satinder
I'm not Phelix, but I'll answer your questions as best I can, as Phelix is taking a break from development at the moment.

As far as I know Phelix's code is fully functional; I'm aware of people successfully using it in the wild. (At least one squatter insists on using ANTPY to sell names.)

I would love to see this added to the Namecoin-Qt GUI. Conveniently, Brandon's rewrite of the Namecoin-Qt name tab codebase (see https://github.com/namecoin/namecoin-core/pull/67 ) is likely to make this much easier to do. If you'd like to help, feel free to talk to Brandon (brand0 on #namecoin-dev , brandonrobertz on GitHub) or Daniel (domob1812 on GitHub) about coordinating.

AFAIK it should work fine with Namecoin Core.

There aren't any bounties that I'm aware of at the moment, but I wouldn't necessarily be opposed to adding one. I'm actually not sure how much money we have at the moment (I'd have to ask Phelix), but if you have suggestions for bounties of any kind, post in the Bounties subforum and we'll definitely consider it. (Make sure the title of your thread makes clear it's a suggestion and not an offered bounty).

Cheers.