ANTPY - Atomic Name Trading Pythonscript

Forum rules
Warning !
Avoid using binary softwares from untrusted users.
Prefer compiling it yourself and verify sources.
biolizard89
Posts: 1932
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by biolizard89 » Fri Jun 20, 2014 6:22 am

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.
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

ryanc
Posts: 147
Joined: Wed Dec 18, 2013 8:10 pm
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by ryanc » Thu Dec 11, 2014 6:17 pm

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.

domob
Posts: 1083
Joined: Mon Jun 24, 2013 11:27 am
Contact:

Re: ANTPY - Atomic Name Trading Pythonscript

Post by domob » Fri Dec 12, 2014 8:22 am

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?
BTC: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID: https://nameid.org/

ryanc
Posts: 147
Joined: Wed Dec 18, 2013 8:10 pm
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by ryanc » Fri Dec 12, 2014 7:39 pm

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.

ryanc
Posts: 147
Joined: Wed Dec 18, 2013 8:10 pm
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by ryanc » Sat Dec 13, 2014 3:03 am

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.

ryanc
Posts: 147
Joined: Wed Dec 18, 2013 8:10 pm
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by ryanc » Sat Dec 13, 2014 8:35 pm

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.

phelix
Posts: 1625
Joined: Thu Aug 18, 2011 6:59 am

Re: ANTPY - Atomic Name Trading Pythonscript

Post by phelix » Tue Oct 20, 2015 7:44 am

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...
nx.bit - some namecoin stats
nf.bit - shortcut to this forum

phelix
Posts: 1625
Joined: Thu Aug 18, 2011 6:59 am

Re: ANTPY - Atomic Name Trading Pythonscript

Post by phelix » Tue Oct 20, 2015 3:10 pm

btw: if anybody has suggestions for how this should look in a GUI form: the time is now :)
nx.bit - some namecoin stats
nf.bit - shortcut to this forum

grewalsatinder
Posts: 10
Joined: Mon May 09, 2016 8:43 am

Re: ANTPY - Atomic Name Trading Pythonscript

Post by grewalsatinder » Wed Jun 01, 2016 4:18 am

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

biolizard89
Posts: 1932
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: ANTPY - Atomic Name Trading Pythonscript

Post by biolizard89 » Thu Jun 02, 2016 4:39 am

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.
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

Post Reply