Pages:
Author

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

sr. member
Activity: 284
Merit: 250
And the official changeover block to trade MSC on the distributed exchange is . . .

(drumroll)

290630

History suggests that our target date of 2014-03-15 00:00:00 GMT should fall somewhere between blocks 290607 and 290630. I chose the later number because I want to make sure we get every last ounce of testing we deserve Smiley

masterchain.info is ready:
https://github.com/grazcoin/mastercoin-tools/commit/80e08ca64bf09ab0ba6c6625185e494758be442f

hero member
Activity: 644
Merit: 500
And the official changeover block to trade MSC on the distributed exchange is . . .

(drumroll)

290630

History suggests that our target date of 2014-03-15 00:00:00 GMT should fall somewhere between blocks 290607 and 290630. I chose the later number because I want to make sure we get every last ounce of testing we deserve Smiley

Yes, we have an block number! Only 2 days! Thank you Dacoinminster and others. Grin
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
And the official changeover block to trade MSC on the distributed exchange is . . .

(drumroll)

290630

History suggests that our target date of 2014-03-15 00:00:00 GMT should fall somewhere between blocks 290607 and 290630. I chose the later number because I want to make sure we get every last ounce of testing we deserve Smiley
sr. member
Activity: 449
Merit: 250
Ok.  So we are invalidating only "concurrent accept".


Invalid Purchase offer transactions due to minimum miners fee not reached.

b9a870a6c1bc12c954b1b01fbdb86a8f71aa8c31ff77624dd8b58f84ef21bbfb     
b31a720e9b8ede0b6aa0c3b10ed1a7274b257d489f81e11470499281cb0402d7     
61d922eb409fcd932798cb519f97ba65de18099c501b324ae86b4658530da92b     
f6bb04e866fcf7a267f1af5659a7350a87b2c132ee1253757846c5be0b455a42     
8a8c2e7fe253fe8635d34ecc71510955d3a344546410db6961b35cd51809d3ea     
77702fd6333eb5a67fa03b6fdb0fda04981bd671fd2a9175e2bee43340770940

minimal fee enforcement fixed:
https://github.com/grazcoin/mastercoin-tools/commit/cad5aca3e371a6efa11196e2ddbcd694eb49ab3a
example:
https://masterchain.info/sellaccept.html?tx=61d922eb409fcd932798cb519f97ba65de18099c501b324ae86b4658530da92b¤cy=TMSC

invalidate concurrent accepts from the same address:
https://github.com/grazcoin/mastercoin-tools/commit/08b46cc77e17b8813d3c5e5c357ffd4f557612c6
example:
https://masterchain.info/sellaccept.html?tx=263b7c420b2456b3f04eea4d92ddf35b95703859173a321c9fdeb71e6c1f5328¤cy=TMSC

take care - once an accept offer expires or gets paid, a user can create a new one as there is no "concurrent accept" any more. I wouldn't like to prevent a user from buying at a later stage (e.g. long term sell offers that may run for years should let people buy more than once).
example for a valid accept after the previous is "done" (got fully paid):
https://masterchain.info/sellaccept.html?tx=9ecd7a40eba06ea554fa42dadca1c4c94dc301040d656484a85c45d68d80963a¤cy=TMSC

Grazcoin

sr. member
Activity: 284
Merit: 250
1. Ok will enforce the req minimum fees require for purchase accept.

2.  I think it should be.   A buyer can place only one purchase offer transaction on any sell offer transaction.

Awesome Smiley

minimal fee enforcement fixed:
https://github.com/grazcoin/mastercoin-tools/commit/cad5aca3e371a6efa11196e2ddbcd694eb49ab3a
example:
https://masterchain.info/sellaccept.html?tx=61d922eb409fcd932798cb519f97ba65de18099c501b324ae86b4658530da92b¤cy=TMSC

invalidate concurrent accepts from the same address:
https://github.com/grazcoin/mastercoin-tools/commit/08b46cc77e17b8813d3c5e5c357ffd4f557612c6
example:
https://masterchain.info/sellaccept.html?tx=263b7c420b2456b3f04eea4d92ddf35b95703859173a321c9fdeb71e6c1f5328¤cy=TMSC

take care - once an accept offer expires or gets paid, a user can create a new one as there is no "concurrent accept" any more. I wouldn't like to prevent a user from buying at a later stage (e.g. long term sell offers that may run for years should let people buy more than once).
example for a valid accept after the previous is "done" (got fully paid):
https://masterchain.info/sellaccept.html?tx=9ecd7a40eba06ea554fa42dadca1c4c94dc301040d656484a85c45d68d80963a¤cy=TMSC

Grazcoin
sr. member
Activity: 449
Merit: 250
Is this transaction invalid ?
a7120ed05e1b42f48fec59d0a3b56202d15a0bb8272653f995ac584f16e67c09


What happened is Buyer 1G3P5bws8wRVrVfKWxv8F85pRjs9qXyyA6 placed a
 
Purchase offer 0.002
6ea30cd210ae4521c58d026114f16ef4e63c86d9550de5dba72f588f789aa69c
for Sell Offer
8b2deeb03c2590bbc6698ab3d663eb920e8bb7e89437a7984a54b8d0154d6741


Paid for 0.002

Tried to Purchase again 0.007 from the same Sell Offer
8b2deeb03c2590bbc6698ab3d663eb920e8bb7e89437a7984a54b8d0154d6741
sr. member
Activity: 266
Merit: 250
Awesome, really not much of a change. Smiley

Not sure about this:

Case 4 and 5 basically allow to have no input public key included, but case 6 requires one, more or less?

Case 4 and 5 have the first master protocol packet as the second public key, which to date has been an assumed - but will now be a locked in - specification.
Case 6 has the first master protocol packet as the first public key, which moving forward has been agreed will not be valid.

Thanks Smiley
Zathras
legendary
Activity: 1106
Merit: 1026
Awesome, really not much of a change. Smiley

Not sure about this:

Case 4 and 5 basically allow to have no input public key included, but case 6 requires one, more or less?
sr. member
Activity: 266
Merit: 250
Great, please see inline Smiley

I think what Dexx is getting it is allowing a sequence of Master Protocol packets anywhere in the multisig outputs, as long as the packets are contiguous.  I'm not sure that's necessary at this stage (I think if we're to lock in packet ordering then let's keep it simple).  Also re 1-of-3, yep I know technically we can go higher but not while maintaining widespread support.  My own view is that we'll see OP_RETURN before better native multisig handling in the reference client, but that's pure speculation of course.

Dexx, I know you posted an analysis a few pages back but could you pick say two or three transactions, post them & a brief summary on why you think they're invalid/contain junk.  Happy to take a look Smiley

Thanks. Yes and I agree, keeping it as simple as possible, would be good. Smiley

Okay, I'll try to cover a few cases I found:


1. https://blockchain.info/tx/bda81e0c2117fb6ecefb92143995a6ebc3d9569f54c4a0c074ff3070bcf3e011

Input: compressed public key
Output: compressed input public key, data-package #1, data-package #2

No conflict.


2. https://blockchain.info/tx/95b10a4721a69a1028e70fd2ccd0692219095fb6f5087b9e72b155a3e0832602

Input: uncompressed public key
Output: uncompressed public key, data package #1

Conflict: "Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (has only one compressed public key)

There needs to be a spec amendment here - while I was authoring that appendix I was pushing for us to compress the sender key if uncompressed in the wallet (I was on a charge to be as 'light' blockchain wise as possible and that saved a chunk (32 bytes)).  Graz uses the key in whatever format it's in originally, and I'm going to do the same by dropping sender key compression from my library - cost more transaction space but should avoid any confusion re addresses.  The pull just needs to remove the word 'compressed' from that statement.

3. https://blockchain.info/tx/f8e2eb56f50f7a98a8c76ef45ed591aedd8aa973c5f4dfd5b7685aae4b48ae6c

Input: uncompressed public key
Output: compressed public key, data package #1

Public key was compressed, but that's no conflict.

Yeah, as above we should allow compressed public keys, but I'll no longer be actively compressing originally uncompressed keys.

4. https://blockchain.info/tx/4842af86dac35a2c294f56511c7d08362330e82bd5fcae32c07119844e019b0a

Input: uncompresssed public key
Output: compressed public key with flawed prefix byte, data package #1

Conflict: "As one signatory must be the sender for redemption purposes, ..."

"Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (not the case, because of a small flaw during the compression [prefix "02" instead of "03"], so this output is neither redeemable nor the sender's address)

As I mentioned before that first senders key is irrelevant to the Master Protocol transaction, so I'd say we should re-word 'must' to 'should' to reflect what we have in practice (another one word pull).  I still need to go over that key compression code as you mentioned, as it's of course possible I'm flipping that bit backwards.

5. https://blockchain.info/tx/2ae17011888e9a2e6c752999774cd6d88feb7c0751abe72a602be89858e44f6a

Input: compressed public key
Output: unknown package, data package #1

Conflict: "As one signatory must be the sender for redemption purposes, ..."

"Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (not the case, because the first package has no relation to the input address)

I'd have to fire that transaction up in step by step decoding (which I can do, I'm just kind of occupied right now) to take a look, but if we went with the word change above that would also address this one (should=guideline we don't have to check, must=explicit rule we must enforce - that's how I think of it anyway)

6. https://blockchain.info/tx/1ce1e44f40da1f7eddca5f81d72d76a005f8f45b83ee1f9b07ca901f3e6ec235

Input: uncompressed public key
Output: data package #1, compressed public key

This is an edge case. All data packages are ordered (it's only one) and it includes the sender's address.

This will be invalidated once we lock in that the order of each multisig needs to be {senderkey,masterpacket1,masterpacket2}
legendary
Activity: 1106
Merit: 1026
I think what Dexx is getting it is allowing a sequence of Master Protocol packets anywhere in the multisig outputs, as long as the packets are contiguous.  I'm not sure that's necessary at this stage (I think if we're to lock in packet ordering then let's keep it simple).  Also re 1-of-3, yep I know technically we can go higher but not while maintaining widespread support.  My own view is that we'll see OP_RETURN before better native multisig handling in the reference client, but that's pure speculation of course.

Dexx, I know you posted an analysis a few pages back but could you pick say two or three transactions, post them & a brief summary on why you think they're invalid/contain junk.  Happy to take a look Smiley

Thanks. Yes and I agree, keeping it as simple as possible, would be good. Smiley

Okay, I'll try to cover a few cases I found:


1. https://blockchain.info/tx/bda81e0c2117fb6ecefb92143995a6ebc3d9569f54c4a0c074ff3070bcf3e011

Input: compressed public key
Output: compressed input public key, data-package #1, data-package #2

No conflict.


2. https://blockchain.info/tx/95b10a4721a69a1028e70fd2ccd0692219095fb6f5087b9e72b155a3e0832602

Input: uncompressed public key
Output: uncompressed public key, data package #1

Conflict: "Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (has only one compressed public key)


3. https://blockchain.info/tx/f8e2eb56f50f7a98a8c76ef45ed591aedd8aa973c5f4dfd5b7685aae4b48ae6c

Input: uncompressed public key
Output: compressed public key, data package #1

Public key was compressed, but that's no conflict.


4. https://blockchain.info/tx/4842af86dac35a2c294f56511c7d08362330e82bd5fcae32c07119844e019b0a

Input: uncompresssed public key
Output: compressed public key with flawed prefix byte, data package #1

Conflict: "As one signatory must be the sender for redemption purposes, ..."

"Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (not the case, because of a small flaw during the compression [prefix "02" instead of "03"], so this output is neither redeemable nor the sender's address)


5. https://blockchain.info/tx/2ae17011888e9a2e6c752999774cd6d88feb7c0751abe72a602be89858e44f6a

Input: compressed public key
Output: unknown package, data package #1

Conflict: "As one signatory must be the sender for redemption purposes, ..."

"Has one or more 1-of-n OP_CHECKMULTISIG outputs each containing at least two compressed public keys, one of which must be the senders address" (not the case, because the first package has no relation to the input address)


6. https://blockchain.info/tx/1ce1e44f40da1f7eddca5f81d72d76a005f8f45b83ee1f9b07ca901f3e6ec235

Input: uncompressed public key
Output: data package #1, compressed public key

This is an edge case. All data packages are ordered (it's only one) and it includes the sender's address.
sr. member
Activity: 266
Merit: 250
1. Ok will enforce the req minimum fees require for purchase accept.

2.  I think it should be.   A buyer can place only one purchase offer transaction on any sell offer transaction.

Awesome Smiley
sr. member
Activity: 266
Merit: 250
I guess I'd like to hear the other devs comment about these packets with "junk" in them which are there already. Can you point a couple of them out?

I'd like to know what logic currently makes them valid. That is what will probably end up in the spec, just to avoid changing anything.
I think what Dexx is getting it is allowing a sequence of Master Protocol packets anywhere in the multisig outputs, as long as the packets are contiguous.  I'm not sure that's necessary at this stage (I think if we're to lock in packet ordering then let's keep it simple).  Also re 1-of-3, yep I know technically we can go higher but not while maintaining widespread support.  My own view is that we'll see OP_RETURN before better native multisig handling in the reference client, but that's pure speculation of course.

Dexx, I know you posted an analysis a few pages back but could you pick say two or three transactions, post them & a brief summary on why you think they're invalid/contain junk.  Happy to take a look Smiley
sr. member
Activity: 449
Merit: 250
1. Ok will enforce the req minimum fees require for purchase accept.

2.  I think it should be.   A buyer can place only one purchase offer transaction on any sell offer transaction.


We had a productive meeting today, and Craig and I were able to make some decisions regarding the last remaining consensus issues:

1) Minimum fees must be respected, as has been in the spec since the beginning. I believe Bitoy and Grazcoin both need to make this change. Without this change, someone can shut down the whole dEX with spam transactions. The fix is simple: if someone tries to accept coins without paying the minimum fee, invalidate that transaction.


2) We're going to have to disable multiple accept offers. This was a harder decision to make, but it boils down to reducing complexity. Also, since graz and bitoy both need to make the minimum fee change, we can't keep the parsing libraries static. This should also be a simple fix: only one accept offer from a buyer to a seller. Additional accept offers are invalid.

3) Zathras is going to have to drop his change to respect packet sequence numbers in class B transactions. We simply can't afford the time, and we believe we can rely on the order of outputs not changing in the transaction, so sequence numbers are probably redundant for class B transactions. If we do packets out-of-sequence someday, we'll have to change the version number of all transaction types.

Sorry that further changes must be made, but we needed to choose a direction and stick with it. Both Craig and I are committed to this direction, and I'll be updating the spec to reflect #2 and #3.

Thanks guys!

 
sr. member
Activity: 449
Merit: 250
I'm using blockchain

047992ccb171ca59d39432dc93eba2301188b68ead661dd9fdfe3dda47e2f27ebfff9a0a069d4cb 3851ce19fe5be7ea1b772ee4b678e3bdcc7769713cd675e14c7   Senders Public

021bf733f7beb3932563cd8e8a3ec13fb22047f0694a0b6e8a2ad08e63bba57cbb   This is packet 2?

026c3fe6ffe4fdf222b80142d95c275753e49587546ef02c40e3e06ee449b27109  Packet 1


The important thing in the spec is the packets must be in order.

Ex. Valid
Packet 1
Packet 2
Junk
Packet 3

Ex. Invalid.  It can't be jumbled

Packet 1
Packet 3
Junk
Packet 2


first mastercoin packet
Second mastercoin packet (if required)
Senders  public key

You probably mean:

Sender's pubKey
Mastercoin data-package #1
Mastercoin data-package #2

^ this is the order of almost all transactions that were made in the past.


Given that DEX starts in a few days, I tend to agree with Bitoy, should probably locked into the stec temporarily. But solving this should stay high priority, the more packages there are, the less trivial is the solution. With four packages (e.g. the smart propertie stuff), it's already 24 combinations, with 5 packages it's 120. If a brute force approach is used.

dexX7 is right.
Example sell offer is:
https://masterchain.info/selloffer.html?tx=ccc6c0ed758c42a950b1f54956d74db0a84783908fe41427a540b1221f5887e5¤cy=TMSC
The BIP11 part is:
"script": "1 [ 047992ccb171ca59d39432dc93eba2301188b68ead661dd9fdfe3dda47e2f27ebfff9a0a069d4cb 3851ce19fe5be7ea1b772ee4b678e3bdcc7769713cd675e14c7 ] [ 021bf733f7beb3932563cd8e8a3ec13fb22047f0694a0b6e8a2ad08e63bba57cbb ] [ 026c3fe6ffe4fdf222b80142d95c275753e49587546ef02c40e3e06ee449b27109 ] 3 checkmultisig",
Which is:

Sender's pubKey
Mastercoin data-package #1
Mastercoin data-package #2

note that if you look at the transaction on blockchain.info, the order of pubkeys inside the BIP11 looks opposite:
https://blockchain.info/tx/ccc6c0ed758c42a950b1f54956d74db0a84783908fe41427a540b1221f5887e5


legendary
Activity: 1260
Merit: 1031
Rational Exuberance
I guess I'd like to hear the other devs comment about these packets with "junk" in them which are there already. Can you point a couple of them out?

I'd like to know what logic currently makes them valid. That is what will probably end up in the spec, just to avoid changing anything.
legendary
Activity: 1106
Merit: 1026
dexx, are you suggesting something other than what is described in your github issue? :https://github.com/mastercoin-MSC/spec/issues/78

No, I'm not. The order of packages should be required.

I tried to formalize this with something like "use the longest sequence of MSC data-packages within a transaction's output with ascending sequence numbers, starting from 01 and in the case that multiple multisig outputs are available, the same should apply, but starting from last-seq-num + 1", here an example:

Quote
Output 1:

Pos 0: junk
Pos 1: junk, seq num 01 (appearingly)
Pos 2: junk
Pos 3: Mastercoin data-package, seq num 01
Pos 4: Mastercoin data-package, seq num 02
Pos 5: junk

Longest sequence is pos 3 + pos 4, so take them.

Output 2:

Pos 6: junk
Pos 7: Mastercoin data-package, seq num 03
Pos 8: Mastercoin data-package, seq num 04
Pos 9: Mastercoin data-package, seq num 05

The longest sequence starting with a sequence number of 2 + 1 = 03 starts at pos 7 and ends with pos 9.

So the actual data-stream is within pos 3, 4, 7, 8, 9.

This gives some space to cover the transactions that are already out which don't fit exactly in the schema "sender-pubKey, data #1, data #2".

I don't suggest to change anything, but to be very specific about how packages are handled.
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
Didn't receive the mail you quoted, but including the pubKey shouldn't be required, at least on the spec level, and as you said, it's not validated at the moment anyway. Keep also in mind that the number of n-of-m multisig parts will rise and won't be limited to 3. Actually those are already "accepted", but the standard client refuses to send them.

dexx, are you suggesting something other than what is described in your github issue? :https://github.com/mastercoin-MSC/spec/issues/78

There you say:

Quote
I suggest to temporarily insert a line in the spec that Mastercoin data packages should be in order within an output:

Sender's pubKey
Mastercoin data-package 1
Mastercoin data-package 2

It appears that data-packages are only parsed correctly, if this order is given and allowing unordered data packages is probably not trivial. See the discussion here: https://bitcointalksearch.org/topic/m.5646781 (and a few posts earlier)

I think that is the current behavior, and the spec just needs a note about it.
legendary
Activity: 1106
Merit: 1026
Didn't receive the mail you quoted, but including the pubKey shouldn't be required, at least on the spec level, and as you said, it's not validated at the moment anyway. Keep also in mind that the number of n-of-m multisig parts will rise and won't be limited to 3. Actually those are already "accepted", but the standard client refuses to send them.
sr. member
Activity: 266
Merit: 250
Slighthly edited the post with an example which should cover all potential cases without rendering anything invalid, but with as much space for errors as possible.
Hey Dexx,

If it helps, being discussed on email as we speak, packet order is explicit in each multisig, so assuming the first multisig in the transaction was n=2:
Quote
Perfect.  Then we can translate what we do in reality to the spec to make this a little clearer.  So we're essentially saying (assuming n=2 is the first multisig vout)

n2 {senderkey, masterpacket1, masterpacket2}
n3 {senderkey, masterpacket3, masterpacket4}
n4 {senderkey, masterpacket5, masterpacket6}
n5 ... and so on

Thanks
Zathras

Sequence numbers can then be used as a sanity check to double check the packet order is as expected.

legendary
Activity: 1106
Merit: 1026
Slighthly edited the post with an example which should cover all potential cases without rendering anything invalid, but with as much space for errors as possible.
Pages:
Jump to: