Pages:
Author

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

sr. member
Activity: 284
Merit: 250
Can you give me an example where it doesn't work?

That was on a sellaccept page, when clicking on an address link. Tested all pages a few minutes ago, the only one left is btcpayment when clicking on an address.

Example:
https://masterchain.info/btcpayment.html?tx=aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180¤cy=TMSC

To 1EXoDusjGw...: https://masterchain.info/Address.html?addr=1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
To 1HG3s4Ext3...: https://masterchain.info/Address.html?addr=1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj
To 1LifmeXYHe...: https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm

The payment was a BTC payment for TMSC.


updated.
now all links from btcpayment include the currency variable.

legendary
Activity: 1106
Merit: 1026
Can you give me an example where it doesn't work?

That was on a sellaccept page, when clicking on an address link. Tested all pages a few minutes ago, the only one left is btcpayment when clicking on an address.

Example:
https://masterchain.info/btcpayment.html?tx=aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180¤cy=TMSC

To 1EXoDusjGw...: https://masterchain.info/Address.html?addr=1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
To 1HG3s4Ext3...: https://masterchain.info/Address.html?addr=1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj
To 1LifmeXYHe...: https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm

The payment was a BTC payment for TMSC.

--

On a different topic:

Say, I have four pubkeys, two of them are encoded Mastercoin data packages, one is the known input pubKey and one is random junk. I know which one is the input pubKey, but I don't know the order of the data packages:

Code:
Encrypted 1: 02 8d7a29f02b6807292449947137181ae63fb60b3b1cd83bb19f0a44a8cb7fd1 68
Encrypted 2: 02 43a6b4397e00daafe0d7a76383e6808afa085577a3b8f1688279e6bea87260 70
Encrypted 3: 02 1cbdde253bea7b5ddee99b269ae74042ed6dd962efcb5ecb70973e14a86870 93 < input pubKey, pubKeyHash: 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj
Encrypted 4: 02 989a78ab3a2e8fbaa5f6003825eddaada19103096ffc5a6c01eff61779091e 49

Code:
SHA256 round #1 on pubKeyHash:
Hash 1: 999a79ab2e2e8fbaa7f6003825eddaada09103096ffc5a6c00eef61779091e 66

SHA256 round #2 on UpperCase(SHA256(pubKeyHash)):
Hash 2: 41a6b4387d00daafe0d7a76383e6808afa085577a3b8f1688279e6bea87260 a0

I could mix all encrypted with all hashes, but is this the only way and is it unamigious?

Code:
Hash 1 ^ Encrypted 1: 14e0505b0546889383bf944912f5c0
Hash 1 ^ Encrypted 2: da3ccd92502e55154721a75ba60b5a
Hash 1 ^ Encrypted 3: -- E3 is the known pubKey
Hash 1 ^ Encrypted 4: 010001001400000002000000000000

Hash 2 ^ Encrypted 1: ccdc9dc85668dd86c49e3312b4fe9a
Hash 2 ^ Encrypted 2: 020000010300000000000000000000
Hash 2 ^ Encrypted 3: --  E3 is the known pubKey
Hash 2 ^ Encrypted 4: d93ccc93472e55154521a75ba60b5a

What is the fastest way to determine the order of the packages without mixing them all and testing, if they are valid? Is it possible to allow junk at the same time?
sr. member
Activity: 284
Merit: 250
Hey grazcoin,

the interface is really awesome, gratulations! Smiley

Would it be possible, that when clicking on an address or the orderbook orderbook on a sell accept page the active currency is also preselected? E.g. https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba: a click on 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm forwards to https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=MSC instead of https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC.

If you select before TMSC (on the left on large browsers or bottom on mobile), you will get the currency you chose.

Anyway, I rolled back to previous version as the migration from my test setup to the production had some issues.
I will try again in 1-2h.


The "multi payment for accept" version (with a minor fix) is again online.

sr. member
Activity: 284
Merit: 250
If you select before TMSC (on the left on large browsers or bottom on mobile), you will get the currency you chose.

On all other pages yes, but not on sellaccept.html.

When you are on TMSC page e.g.:
https://masterchain.info/index.html?currency=TMSC&filter=accept
or on
https://masterchain.info/index.html?currency=TMSC

a click on the accept transaction leads you to TMSC currency view of sellaccept.

Can you give me an example where it doesn't work?
legendary
Activity: 1106
Merit: 1026
If you select before TMSC (on the left on large browsers or bottom on mobile), you will get the currency you chose.

On all other pages yes, but not on sellaccept.html.
sr. member
Activity: 284
Merit: 250
Hey grazcoin,

the interface is really awesome, gratulations! Smiley

Would it be possible, that when clicking on an address or the orderbook orderbook on a sell accept page the active currency is also preselected? E.g. https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba: a click on 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm forwards to https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=MSC instead of https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC.

If you select before TMSC (on the left on large browsers or bottom on mobile), you will get the currency you chose.

Anyway, I rolled back to previous version as the migration from my test setup to the production had some issues.
I will try again in 1-2h.

legendary
Activity: 1106
Merit: 1026
Hey grazcoin,

the interface is really awesome, gratulations! Smiley

Would it be possible, that when clicking on an address or the orderbook orderbook on a sell accept page the active currency is also preselected? E.g. https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba: a click on 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm forwards to https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=MSC instead of https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC.
sr. member
Activity: 284
Merit: 250
Well, maybe it would be easier for me to implement it than lobby against it :-)
I managed to think of a UI solution for this feature which will not require additional major testing effort and the actual parsing shouldn't be too difficult.
So for now - forget my request of disabling the feature.

Feature of multiple payments to a single accept was implemented.
As you could see, it wasn't a small patch, since a single payment per accept was a design assumption.
anyway:
https://github.com/grazcoin/mastercoin-tools/commit/9ec9161b0ab8ef2e33c9d848230658253bc3bd07

Parsing examples:
https://masterchain.info/Address.html?addr=1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm¤cy=TMSC
https://masterchain.info/sellaccept.html?tx=ce1939bfc5bd83e3e04fb44b1fd287433dde7f39231a3984bf6a859bf56180ba¤cy=TMSC
https://masterchain.info/btcpayment.html?tx=d09ffc8f6b41176dc5a63f3110574cc42fb9fa8668b696b63b516bc0206001df¤cy=TMSC
https://masterchain.info/btcpayment.html?tx=aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180¤cy=TMSC

I hope that brings are closer to consensus.

hero member
Activity: 644
Merit: 500
How is it possible this address has consensus across all implementations?

MCHEST: https://masterchest.info/lookupadd.aspx?address=1GZiFDzdGFGtMonkphx7aWzpU3WTd84EW4 (796.83 MSC)
MCHAIN: https://masterchain.info/Address.html?addr=1GZiFDzdGFGtMonkphx7aWzpU3WTd84EW4 (819.5 MSC)
Mymastercoin: (819.5 MSC)

It should be 819.5 MSC.

EDIT:
Problem solved.
sr. member
Activity: 449
Merit: 250
I've looked over the consensus posts, and it appears that you guys are quickly converging: Graz is going to allow multiple payments, and then we just have to make sure we all round stuff the same way. Also, we need to determine the unit price from the initial sell order and remember it forever.

Everybody please make sure your code is ready to take a block number for the switchover to allow real MSC trading on 3/15! We'll choose the block number once that day is closer Smiley

For spectators, there are currently a LOT of ways to test the distributed exchange with bitcoins and test mastercoins, and WE WILL PAY YOU! Payouts for February are being decided, and we'll have another big payout at the end of March. Please test!

Ok will wait for the block number before sending the new version.
sr. member
Activity: 449
Merit: 250
Updated MyMastercoins.com

MM=8.33 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm MCHAIN=8.23
MM=9.7505 1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc MCHAIN=9.5005
MM=8.735 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHAIN=8.335
MM=39.26343888 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHAIN=47.38688888
MM=2.23456112 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb MCHAIN=1.11111112

Grazcoin, I thought we are near consensus.  What happened to your 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV?



MM=9.7505 1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc MCHEST=9.5005
MM=8.735 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHEST=7.935
MM=39.26343888 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538


legendary
Activity: 1106
Merit: 1026
Speaking of tests. I want to make sure that everyone is aware of the Mastercoin faucet:

http://mastercoin-faucet.com

In case you need more Test Mastercoins, send me a message with a note what you like to test. Smiley
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
I've looked over the consensus posts, and it appears that you guys are quickly converging: Graz is going to allow multiple payments, and then we just have to make sure we all round stuff the same way. Also, we need to determine the unit price from the initial sell order and remember it forever.

Everybody please make sure your code is ready to take a block number for the switchover to allow real MSC trading on 3/15! We'll choose the block number once that day is closer Smiley

For spectators, there are currently a LOT of ways to test the distributed exchange with bitcoins and test mastercoins, and WE WILL PAY YOU! Payouts for February are being decided, and we'll have another big payout at the end of March. Please test!
legendary
Activity: 1260
Merit: 1031
Rational Exuberance


I was wondering about the payment itself. Currently it's simply a transaction with the seller + exodus referenced and no message. I'm trying to figure out, if there is an edge case where I could scam a seller by buying something else and at the same time making the payment for an dex offer? At least related to dex it should be fine, as long as there is only one offer at the same time per seller allowed.

Yeah, only one offer per seller is allowed. "Buying something else" at the same time would just be a bitcoin double-spend, which is a problem Satoshi solved for us Smiley

Thanks!
legendary
Activity: 1106
Merit: 1026
Thanks for the response. The more I see, the more impressed I am. It's really well thought through. Being miner friendly is also a very, very good move to combat the argument that Master transactions are "abusing" the chain. Smiley

where the seller attempts to yank their sell order just as someone tries to accept it, and pocket the fee.

Interesting case. I assume block time is used throughout the protocol to ensure all clients are in the same state, so this would create a race condition where the seller cancels and the buyer accepts at the same time.

Also, a seller could post a very attractive offer way below market with a high fee in hopes of getting a ton of fees from different people all at once.

To avoid race conditions it's not possible to "accept offer and pay" in one transaction, but if it were, I'd transform the "required fee" into something like "required minimum partial payment". From a buyer's perspective running into the risk of a race condition may even be acceptable, if the risk-reward ratio is high enough, e.g. the risk of many buyers at the same time vs. a very appealing price or simply the comfort of a faster transaction (where partial payment = full payment). I guess it's all a trade off, but I agree, such things should be avoided whenever possible.

I was wondering about the payment itself. Currently it's simply a transaction with the seller + exodus referenced and no message. I'm trying to figure out, if there is an edge case where I could scam a seller by buying something else and at the same time making the payment for an dex offer? At least related to dex it should be fine, as long as there is only one offer at the same time per seller allowed.
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
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?

Hey Dexx,

Sorry, I only just noticed your post.

I actually thought a long time about who to give the fee to. Giving the fee to the seller presents another attack vector, where the seller attempts to yank their sell order just as someone tries to accept it, and pocket the fee. Also, a seller could post a very attractive offer way below market with a high fee in hopes of getting a ton of fees from different people all at once.

The problem gets easier if we do the fees in Mastercoin instead of bitcoin, but requiring a mastercoin fee in order to purchase mastercoin shuts out anybody buying for the first time.

All this game theory makes my head hurt!

edit: also, paying lots of larger-than-average fees to miners endears us to them, and we want them to like us!
sr. member
Activity: 449
Merit: 250
Grazcoin,

2 payments from  1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj to 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm from 1 purchase offer

aa799134259de13c1249b2c538d32103eec9d0327f1c82195409a75c6a215180  
d09ffc8f6b41176dc5a63f3110574cc42fb9fa8668b696b63b516bc0206001df

This should fix the 2 below

MM=8.33 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm MCHAIN=8.23
MM=8.335 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHAIN=8.435

724fc55b3f65ea1659d537be068cd3012a192e0c027c936b5fd2adc9b8d2f04b

Yours coins bought is .4

Edit
Mine is 0.33333336
Math.Round(BTCPaid * "AmountforSale" / "BTCDesired",   8 )
Math.Round(0.0004 *44.80423511 / 0.04480424 ,  8 )

MM=39.26343884 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHAIN=39.26343888
sr. member
Activity: 284
Merit: 250

I assume the user never thought of a price of 0.02231931864 per tmsc (btw, how many digits are here?) when he entered 1000 tmsc for 1 btc.
Also J.R. directed towards the 1/1000 calculation:

How hard is it to infer the unit price from the initial post and remember it for the duration of the sell?

What I mean is, literally don't even store the btc desired. Just calculate the unit price from btc desired and msc for sale and store that instead. Is that difficult? I think that is the most intuitive behavior.

Can we agree on this?


Ok let's calculate the price as 1/1000 but the btcdesired must also be adjusted.

Good.
No problem to internally calculate the values as you like, but if you show on the user interface the btcdesired value, you should still show the original value, just like the original amount. The sell offer values stay as they were given.




sr. member
Activity: 449
Merit: 250
Updated MyMastercoins parser
Finally consensus in 1BKpa19m5Xy9SvSzC5djPWtCfbuynSDwmb


MM=8.33 1LifmeXYHeUe2qdKWBGVwfbUCMMrwYtoMm MCHAIN=8.23
MM=8.335 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHAIN=8.435
MM=39.26343884 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHAIN=39.26343888

MM=8.335 1HG3s4Ext3sTqBTHrgftyUzG3cvx5ZbPCj MCHEST=8.035
MM=39.26343884 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV MCHEST=38.8813538
sr. member
Activity: 449
Merit: 250

I assume the user never thought of a price of 0.02231931864 per tmsc (btw, how many digits are here?) when he entered 1000 tmsc for 1 btc.
Also J.R. directed towards the 1/1000 calculation:

How hard is it to infer the unit price from the initial post and remember it for the duration of the sell?

What I mean is, literally don't even store the btc desired. Just calculate the unit price from btc desired and msc for sale and store that instead. Is that difficult? I think that is the most intuitive behavior.

Can we agree on this?


Ok let's calculate the price as 1/1000 but the btcdesired must also be adjusted.
Pages:
Jump to: