Pages:
Author

Topic: 300 BTC Coding Contest: Distributed Exchange (MasterCoin Developer Thread) - page 10. (Read 129207 times)

legendary
Activity: 1106
Merit: 1026
on mine, total of 0.1 was bought.
on yours, total of 0.2 was bought.

That was actually my transaction. This is what happend:

  • Create sell offer for 1 TMSC, price: 0.001 BTC/TMSC, required fee: 0.0001 BTC, block time: 5
  • Send accept offer for 0.5 TMSC (= 0.0005 BTC)
  • Send payment of 0.0001 BTC (= 0.1 TMSC)
  • Send another payment of 0.0001 BTC (= 0.1 TMSC)

It appears that Masterchain consideres the accept offer as finalized after the first partial payment. However, there was still time left, so the second was legit, if I got everything correct. See also: spec #67 which clarifies the behavior of underpaid transactions.

The involved transactions were:

https://masterchain.info/selloffer.html?tx=187f48afaf8a1c39ad2332937be5a5d44535af9b9fab22b65a167f29948d145b (sell)
https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba (accept)
https://masterchain.info/btcpayment.html?tx=d09ffc8f6b41176dc5a63f3110574cc42fb9fa8668b696b63b516bc0206001df (pay #1)
https://masterchain.info/btcpayment.html?tx=aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180 (pay #2)
sr. member
Activity: 284
Merit: 250
Zathras,

I am comparing the parsing the sell accept on masterchain.info:
https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba¤cy=TMSC
to yours:
https://masterchest.info/lookuptx.aspx?txid=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba

on mine, total of 0.1 was bought.
on yours, total of 0.2 was bought.

The price is:
0.001 ฿/TMSC

The payment is:
https://masterchain.info/btcpayment.html?tx=d09ffc8f6b41176dc5a63f3110574cc42fb9fa8668b696b63b516bc0206001df¤cy=TMSC
which includes 0.0001 BTC to 1HG3s4Ext3...
This means than 0.1 TMSC.

I suspect that you have calculated also the next bitcoin payment (aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180) as another valid payment for the same accept.
Is it allowed to pay few payments? I thought that only one payment per accept is valid.

Grazcoin

newbie
Activity: 1
Merit: 0
I would like to contribute to this project, but I'm having trouble getting a development environment setup on Mac OS X 10.9.1 Mavericks. From what I have seen, the two camps are either Linux (omniwallet, which requires installing sx) or Windows (MasterChest, which requires Visual Studio).  I spent an hour or so trying to get sx installed with homebrew instead of apt-get, but wanted to check in to see if anyone else is doing this first.

Are any other developers using Mac? If I am the first, would it be worthwhile to sort through all of the issues and write instructions for future Mac-based developers? What mastercoin-related project would be easiest to get setup on my platform?

Thanks for any help you can provide. I'm very excited about working on a distributed exchange platform.
sr. member
Activity: 449
Merit: 250

(Balance ,reserve , available)

(100,0,100)

Sell offer  5 (100,5,95)
Purchase offer 5 (100,5,95)
Partial sold 1 (99,4,95)
Partial sold 1 (98,3,95)
Change sell offer 10 (98,10+3,85)

In the second change sell offer  is the seller allowed to sell 10 or only 5. Since he has a purchase offer of 5 already?

Purchase offer expires (98,10,88)



sr. member
Activity: 449
Merit: 250
After removing the invalid transaction (reparsed the test server) due to version 0 with action code

MM=1.12345 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHEST=2.23456112
MM=8.335 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHEST=8.035
MM=39.99247169 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538


MM=8.8766 1MCHESTbJhJK27Ygqj4qKkx4Z4ZxhnP826 MCHAIN=8.7532
MM=8.43 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm MCHAIN=8.33
MM=0.082 1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6 MCHAIN=0.072
MM=1.12345 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHAIN=4.23456112
MM=8.335 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHAIN=9.33499999
MM=39.99247169 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHAIN=37.38688888
sr. member
Activity: 449
Merit: 250
Please check this transaction

e02efd2d3265c13894e05acff8082ad263132787d1a5b65ad22d92c801903ed1      
Version 0   Action 3

e541d8ef699cc7bdf30d90ce694f7f0e00b5cf102257b9e94a7067c3fb8593df
Version 0   Action 1
      
If there is an Action in a Version 0 transaction, it is invalid.



Edit  The following tx will also be invalid

cf68983afd0fb6126fd8bc49650831ccd7cbc6d1b257cf9617e5203542e295d2     
15595590636afdf807462551fb58655a18419cfdb9a0ad9c866cf00f74108bc5     
ab68bf2b0cd7fcd1f5acf03b286d565016335448c68737ba39600968b998cd9e     
1b928ff05d0895dda13b691209948ac453c1b8f5bc59f08925814a2fc853116e     
8708d411b92bb5741c2219452931a849c2e312906ec51f18e8499dcf9e1377eb     
effcb1a90f15b39ef2295d8b1d5b3fa5c4a156936b5cfcb770ca68ac1e7ace0e     
b85c843d40ff16a7ef71f233d0f0f8fa7931bbf16532df40149ef1f3533cade3     
03597f0bc804ecc355b2c4344cd1526c51209f9e3efa6d62192ec4dd923755e6     
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
I'm still missing summaries from a couple key people!! I'm going to wait a bit longer, but please fill out the form if you haven't yet!!!

Here's the link again to the form: https://docs.google.com/spreadsheets/d/175XceNMqPv6LNNosIj0MYdfUvm3MGUQuQQkvZFW6cOU/edit?usp=sharing

Here are the responses received so far: https://docs.google.com/spreadsheets/d/175XceNMqPv6LNNosIj0MYdfUvm3MGUQuQQkvZFW6cOU/edit?usp=sharing

Also, I haven't been able to identify the person who wrote "Roughly 16 hours testing the security of the omniwallet. There are a few open tickets on Github Issues." Sorry I didn't have a name field the first time around.

Thanks!

-J.R.
legendary
Activity: 1106
Merit: 1026
There is also a minimum fee that the seller can impose.    This means if someone would like to accept an offer, he has to pay a minimum miners fee.   If the seller post a high minimum fee, it will be expensive for the attacker to shut down the Dex.

Gotcha, thanks a lot! My very first thought was that this fee is to make sure the transaction confirms in time, but this makes a lot more sense now.

I assume the reason why Bitcoin payments are not combined and included in the accept transaction is to prevent the case that two users buy at the same time and one of them is screwed. And only after balances are locked after the accept offer transaction was confirmed, it's really safe?

This kind of dos protection could lead to very interesting mechanics and questions, e.g. "is it more profitable to sell higher and disable competitors or play fair" etc.

Here is an idea: from a seller point of view I'm in conflict with my interests, because I want to have a minimum of fee required to have an edge against competitors, but at the same time I don't want to run into the risk of being dos-frozen. What if the dos-fee is sent to the seller instead of the miners and credited/considered as form of advance payment?
sr. member
Activity: 449
Merit: 250
Everytime you make a payment, the number of coins paid for is deducted from the Accept Offer balance until it is zero.

I was thinking about potential abuse scenarios.

Is there anything that could be done for the case that someone with bad intentions submits a lot of accept offers for all available sales, then never pays or only pays a fraction and repeats this over and over again, every time a new sale is created or out of lock state to shutdown/freeze the complete order book?

You are correct.  It's equivalent to DoS the Distributed exchange. (  DosDex Smiley. That is probably why the time limit must be kept to 10 or below.  This means after 10 blocks and payment hasn't been received, it is an open sell offer again.  

Edit.

There is also a minimum fee that the seller can impose.    This means if someone would like to accept an offer, he has to pay a minimum miners fee.   If the seller post a high minimum fee, it will be expensive for the attacker to shut down the Dex.
legendary
Activity: 1106
Merit: 1026
Everytime you make a payment, the number of coins paid for is deducted from the Accept Offer balance until it is zero.

I was thinking about potential abuse scenarios.

Is there anything that could be done for the case that someone with bad intentions submits a lot of accept offers for all available sales, then never pays or only pays a fraction and repeats this over and over again, every time a new sale is created or out of lock state to shutdown/freeze the complete order book?
sr. member
Activity: 449
Merit: 250
Updated the Parsing.  Cancel is allowed even if BTC Desired=0

MM=2.2345679 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHEST=2.23456112
MM=38.88135379 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538

Only rounding problems causing a difference.


MM=8.43 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm MCHAIN=8.33
MM=0.082 1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6 MCHAIN=0.072
MM=38.88135379 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHAIN=37.38688888
MM=2.2345679 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHAIN=4.23456112

sr. member
Activity: 449
Merit: 250
When you create an Accept offer, MyMastercoins saves the Accept Offer Balance.

ex. Balance 0.0005 

Everytime you make a payment, the number of coins paid for is deducted from the Accept Offer balance until it is zero.

ex. 
Payment #1 0.0001    Balance 0.0004
Payment #2 0.0001    Balance 0.0003

I was curious how the different exchanges behave in a live comparison and did the following test:

  • Create sell offer for 1 TMSC, price: 0.001 BTC/TMSC, required fee: 0.0001 BTC, block time: 5
  • Send accept offer for 0.5 TMSC (0.0005 BTC)
  • Send payment for 0.1 TMSC (= 0.0001 BTC)
  • Send another payment for 0.1 TMSC (= 0.0001 BTC)

I noticed that there are several (visual) differences, e.g. mymastercoins shows two sales a 0.1 TMSC, masterchest combines that into one a 0.2 TMSC and masterchain shows two sales a 0.5 TMSC or one sale of 0.5 TMSC, depending on which side of the trade is observed.

Most notably: the final balance of the buyer is off by 0.1 TMSC on masterchain - it appears that the accept offer is considered as closed after the first payment got in, at least for one side of the trade:

https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC (open accept: -0.5?)
https://masterchest.info/lookupadd.aspx?address=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm


I made screenshots at the exact same moment of all related and relevant pages and it may be worth to take a look and do a side-by-side comparison: http://bitwatch.co/dextest/dex01.zip (or mirrored: http://imgur.com/a/VA1l0) Transaction ids and website links are listed and included in a text file in the zip.

All three websites needed a few minutes to actually show a new state, so is unclear to me what happens when. I have three questions:

How do you handle incoming transactions, e.g. treat them instantanious as valid, after x minutes or after n confirmations?

Assuming an "accept offer" locks the amount and reduces the amount up for sale - how are under payments handled?

How are multiple payments that are within the block time span after the accept offer handled?
legendary
Activity: 1106
Merit: 1026
I was curious how the different exchanges behave in a live comparison and did the following test:

  • Create sell offer for 1 TMSC, price: 0.001 BTC/TMSC, required fee: 0.0001 BTC, block time: 5
  • Send accept offer for 0.5 TMSC (0.0005 BTC)
  • Send payment for 0.1 TMSC (= 0.0001 BTC)
  • Send another payment for 0.1 TMSC (= 0.0001 BTC)

I noticed that there are several (visual) differences, e.g. mymastercoins shows two sales a 0.1 TMSC, masterchest combines that into one a 0.2 TMSC and masterchain shows two sales a 0.5 TMSC or one sale of 0.5 TMSC, depending on which side of the trade is observed.

Most notably: the final balance of the buyer is off by 0.1 TMSC on masterchain - it appears that the accept offer is considered as closed after the first payment got in, at least for one side of the trade:

https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC (open accept: -0.5?)
https://masterchest.info/lookupadd.aspx?address=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm


I made screenshots at the exact same moment of all related and relevant pages and it may be worth to take a look and do a side-by-side comparison: http://bitwatch.co/dextest/dex01.zip (or mirrored: http://imgur.com/a/VA1l0) Transaction ids and website links are listed and included in a text file in the zip.

All three websites needed a few minutes to actually show a new state, so is unclear to me what happens when. I have three questions:

How do you handle incoming transactions, e.g. treat them instantanious as valid, after x minutes or after n confirmations?

Assuming an "accept offer" locks the amount and reduces the amount up for sale - how are under payments handled?

How are multiple payments that are within the block time span after the accept offer handled?
sr. member
Activity: 449
Merit: 250
Zathras,

The only difference we have is rounding the calculations.

Ex. Payment tx
724fc55b3f65ea1659d537be068cd3012a192e0c027c936b5fd2adc9b8d2f04b

mymastercoins 0.01792169 TMSC            
Masterchest. 0.0179217


I calculate is as
Amounted of coin bought = round8decimals (btc paid * amount of coins to sell / btc desired)



MM=2.2345679 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHEST=2.23456112
MM=38.88135379 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538
sr. member
Activity: 449
Merit: 250
Zathras,

Consensus is very near Smiley

For 1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6 The reserve is 0.01

786bc231878df369c6c5f14fe795d5b7623148357d77558578c5a3b28b35584a Is not a cancel sell.  It is invalid because btc desired is 0

1B4dzdSTt8p1qfMba4MTPUvABDXDYTHT2S  The. Reserve is 0.001
d063437a4735b3fdb1f6d44af745257b193ce1acffe32b80457d502c5bc65635 Is not a cancel sell.  It is invalid because btc desired is 0


MM=2.2345679 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHEST=2.23456112
MM=0.009 1B4dzdSTt8p1qfMba4MTPUvABDXDYTHT2S MCHEST=0.01
MM=0.072 1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6 MCHEST=0.082
MM=38.88135379 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538

legendary
Activity: 1260
Merit: 1031
Rational Exuberance

At least on my entry I have no write permissions, and the table looks empty - one has to scroll down a long way to see something.
I could repeat it here with my name and BTC/MSC address though.
Grazcoin


Yeah, you can't edit the results spreadsheet, but you should be able to do the form again to update the spreadsheet.

Adam pointed out that I can add fields even after you guys start doing submissions, so I added fields for name and BTC/MSC addresses
sr. member
Activity: 284
Merit: 250
Ok thanks.

The last sell offer is
1b8572009435e554a68fc640f43efa50c9117f6881813ae56eab5b10f9b3fd53
For  0.01 tmsc

Your reserve is 0.029 tmsc
https://masterchain.info/Address.html?addr=1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6¤cy=TMSC

It should be 0.01 since we can only have 1 seller offer.



Bitoy,

You can visit the transaction page on:
https://masterchain.info/selloffer.html?tx=8b2deeb03c2590bbc6698ab3d663eb920e8bb7e89437a7984a54b8d0154d6741¤cy=TMSC
and see that "Depracated Sell Offer" means that it was replaced by an updated sell offer. Just follow the link of "Updated by sell offer" recursively.
Accepts which were done before the update are valid and can be paid (and it looks that the two were paid).


You are mostly correct.
It is important to note that after a sell offer update, there was still an accept running against the old sell offer.
The accepted part of the old sell offer required a reserve of 0.019, and the new one required 0.01 - in total 0.029.
Obviously my code did not release the 0.019 after the accept expired - I will check that.

EDIT:
fixed on https://github.com/grazcoin/mastercoin-tools/commit/2803ab4c7deaeeff2484113aef5952af6f5d46ee
now I have the same values.
Bitoy, Zathras - please make sure you have this short period when reserved goes up to 0.029.
I will generate such a scenario which tests exactly this case, e.g. a simple send during this short time which would have been valid if reserved does not include the running accept against the old sell offer, but it gets invalidated due to "balance too low" if the correct reserved funds are taken into consideration.




sr. member
Activity: 284
Merit: 250
Grazcoin,

For 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb

Our difference is this tx
20f6bc00fe792a063021f24b7194ceab9c23afa457a126ab2164edf63f39083e

https://masterchain.info/simplesend.html?tx=20f6bc00fe792a063021f24b7194ceab9c23afa457a126ab2164edf63f39083e¤cy=MSC

In your site is says invalid because balance is too low.


Indeed it needed a rescan.
Updated.

sr. member
Activity: 284
Merit: 250
Sorry - I should have posted it on MastercoinTalk too. Here's the link to Ron's post there: http://mastercointalk.org/index.php?topic=184.msg345#msg345

You can view everything submitted so far here: https://docs.google.com/spreadsheets/d/175XceNMqPv6LNNosIj0MYdfUvm3MGUQuQQkvZFW6cOU/edit?usp=sharing

Humorously, the results spreadsheet does not include any info about WHO submitted the form. I naively assumed that it would give me the Google Account info. If you did not put your NAME or FORUM HANDLE in your submission, please update your submission to include that, so we know WHO to pay for your work.

I also did not include a form for BTC or MSC addresses, which was equally silly. Please add your address(es), otherwise I will just use the ones you gave me for the last contest.

Thanks,

-J.R.

At least on my entry I have no write permissions, and the table looks empty - one has to scroll down a long way to see something.
I could repeat it here with my name and BTC/MSC address though.
Grazcoin

legendary
Activity: 1260
Merit: 1031
Rational Exuberance
Sorry - I should have posted it on MastercoinTalk too. Here's the link to Ron's post there: http://mastercointalk.org/index.php?topic=184.msg345#msg345

You can view everything submitted so far here: https://docs.google.com/spreadsheets/d/175XceNMqPv6LNNosIj0MYdfUvm3MGUQuQQkvZFW6cOU/edit?usp=sharing

Humorously, the results spreadsheet does not include any info about WHO submitted the form. I naively assumed that it would give me the Google Account info. If you did not put your NAME or FORUM HANDLE in your submission, please update your submission to include that, so we know WHO to pay for your work.

I also did not include a form for BTC or MSC addresses, which was equally silly. Please add your address(es), otherwise I will just use the ones you gave me for the last contest.

Thanks,

-J.R.
Pages:
Jump to: