Bitcoin Forum
May 11, 2024, 07:28:22 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 [52] 53 54 55 56 57 58 59 60 61 62 63 64 65 »
  Print  
Author Topic: 300 BTC Coding Contest: Distributed Exchange (MasterCoin Developer Thread)  (Read 129136 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
grazcoin
Sr. Member
****
Offline Offline

Activity: 284
Merit: 250



View Profile
February 19, 2014, 06:27:48 AM
 #1021

Thanks Grazcoin,

You are correct.
I didn't  add a version number in the transaction.   And the parser ignored the version number.  Will update this.

If version is 0, we should treat it as version 0, ignoring the action byte.   The transaction should still be valid.  

Btw if we allow version 0, won't that defeat the purpose of having an action byte?


+1 on invalidating all version 0 offer to sell.


Great!
So now we have to get the agreement from everyone else.
The disadvantage is that we will not have ready testing data, as there will be no valid DEx transactions.


1715412502
Hero Member
*
Offline Offline

Posts: 1715412502

View Profile Personal Message (Offline)

Ignore
1715412502
Reply with quote  #2

1715412502
Report to moderator
1715412502
Hero Member
*
Offline Offline

Posts: 1715412502

View Profile Personal Message (Offline)

Ignore
1715412502
Reply with quote  #2

1715412502
Report to moderator
1715412502
Hero Member
*
Offline Offline

Posts: 1715412502

View Profile Personal Message (Offline)

Ignore
1715412502
Reply with quote  #2

1715412502
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715412502
Hero Member
*
Offline Offline

Posts: 1715412502

View Profile Personal Message (Offline)

Ignore
1715412502
Reply with quote  #2

1715412502
Report to moderator
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
February 19, 2014, 07:38:10 AM
 #1022

That could also be an advantage since it will be easier to sync the test msc Smiley


Great!
So now we have to get the agreement from everyone else.
The disadvantage is that we will not have ready testing data, as there will be no valid DEx transactions.


Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
February 19, 2014, 10:23:53 AM
 #1023

Grazcoin,

Below is the msc spec on transaction version.  It looks like we will have to parse depending on the version number.   Previous transactions can't be invalidated.   

What if a user has an older version of a wallet.   It may lead to a fork if the old wallet uses a different version.

Quote

Transaction Definitions
The Master Protocol Distributed Exchange transactions are listed below. Transactions 0, 20, 21, 22 and 50 are to be implemented in the first deployment, per this spec. They are listed first. The other transactions will be fully defined and implemented in future releases.

Each transaction definition has its own version number to enable support for changes to each transaction definition. Up thru version 0.3.5 of this spec, the transaction type field was a 4 byte integer. Since there were only 17 transactions identified, the upper 3 bytes of the field had a value of 0. For all spec versions starting with 0.4, the first field in each transaction message is the 2 byte version number, with an initial value of 0 and the transaction type field is a 2 byte integer. So, each client must examine the first two bytes of the transaction message to determine how to parse the remainder of the message. If the value is 0, then the message is in the format specified in version 0.3.5 of this spec. If the value is at least 1, then the message is in the format associated with that version number.

Note: Master Protocol transactions are not reversible except as explicitly indicated by this spec.


grazcoin
Sr. Member
****
Offline Offline

Activity: 284
Merit: 250



View Profile
February 19, 2014, 11:38:35 AM
 #1024

Grazcoin,

Below is the msc spec on transaction version.  It looks like we will have to parse depending on the version number.   Previous transactions can't be invalidated.  

What if a user has an older version of a wallet.   It may lead to a fork if the old wallet uses a different version.

Quote

Transaction Definitions
The Master Protocol Distributed Exchange transactions are listed below. Transactions 0, 20, 21, 22 and 50 are to be implemented in the first deployment, per this spec. They are listed first. The other transactions will be fully defined and implemented in future releases.

Each transaction definition has its own version number to enable support for changes to each transaction definition. Up thru version 0.3.5 of this spec, the transaction type field was a 4 byte integer. Since there were only 17 transactions identified, the upper 3 bytes of the field had a value of 0. For all spec versions starting with 0.4, the first field in each transaction message is the 2 byte version number, with an initial value of 0 and the transaction type field is a 2 byte integer. So, each client must examine the first two bytes of the transaction message to determine how to parse the remainder of the message. If the value is 0, then the message is in the format specified in version 0.3.5 of this spec. If the value is at least 1, then the message is in the format associated with that version number.

Note: Master Protocol transactions are not reversible except as explicitly indicated by this spec.




My suggestion is just to invalidate sell offers of version 0, and keep any other transaction without change (all other version 0 of simple send and accept sell offer are valid).

Since the whole DEx is still not activated for MSC, there will be no damage. The balance of test mastercoins may be different if someone uses old software (which is not recommended anyway), but MSC balance will be the same.

The state machine that we have to keep already due to the new/modify/cancel is complicated enough within sell offer version 1 - we have to follow how much was sold on each generation of the sell offer modifications (there could be a long chain of modifications). If we do keep both version 0 and version 1 of sell offers, we *also* have to take care about interoperability between the sell offers of the different versions, e.g.:

  • sell offer version 0 modification on top of new sell offer version 1 - e..g cancel using modify amount to zero valid? then how to parse further modification using version 0 and version 1?
  • sell offer version 1 modification on top of new sell offer version 0 - is another modification using version 0 also valid?
  • we keep the race condition within version 0
  • we extend the race condition by using version 0 on top of previous version 1


grazcoin
Sr. Member
****
Offline Offline

Activity: 284
Merit: 250



View Profile
February 19, 2014, 12:38:38 PM
 #1025

Grazcoin,

Below is the msc spec on transaction version.  It looks like we will have to parse depending on the version number.   Previous transactions can't be invalidated.  

What if a user has an older version of a wallet.   It may lead to a fork if the old wallet uses a different version.

Quote

Transaction Definitions
The Master Protocol Distributed Exchange transactions are listed below. Transactions 0, 20, 21, 22 and 50 are to be implemented in the first deployment, per this spec. They are listed first. The other transactions will be fully defined and implemented in future releases.

Each transaction definition has its own version number to enable support for changes to each transaction definition. Up thru version 0.3.5 of this spec, the transaction type field was a 4 byte integer. Since there were only 17 transactions identified, the upper 3 bytes of the field had a value of 0. For all spec versions starting with 0.4, the first field in each transaction message is the 2 byte version number, with an initial value of 0 and the transaction type field is a 2 byte integer. So, each client must examine the first two bytes of the transaction message to determine how to parse the remainder of the message. If the value is 0, then the message is in the format specified in version 0.3.5 of this spec. If the value is at least 1, then the message is in the format associated with that version number.

Note: Master Protocol transactions are not reversible except as explicitly indicated by this spec.




My suggestion is just to invalidate sell offers of version 0, and keep any other transaction without change (all other version 0 of simple send and accept sell offer are valid).

Since the whole DEx is still not activated for MSC, there will be no damage. The balance of test mastercoins may be different if someone uses old software (which is not recommended anyway), but MSC balance will be the same.

The state machine that we have to keep already due to the new/modify/cancel is complicated enough within sell offer version 1 - we have to follow how much was sold on each generation of the sell offer modifications (there could be a long chain of modifications). If we do keep both version 0 and version 1 of sell offers, we *also* have to take care about interoperability between the sell offers of the different versions, e.g.:

  • sell offer version 0 modification on top of new sell offer version 1 - e..g cancel using modify amount to zero valid? then how to parse further modification using version 0 and version 1?
  • sell offer version 1 modification on top of new sell offer version 0 - is another modification using version 0 also valid?
  • we keep the race condition within version 0
  • we extend the race condition by using version 0 on top of previous version 1



An alternative suggestion which is more backwards compatible but still doesn't complicate the parsing state machine - and therefore it is less bugs prone:
Treat each sell offer version 0 exactly as a sell offer version 1 with action 1 (new).
Then we will still have enough data to check our DEx implementations with, and the only differences from 0.3.5 spec version would be with modified sell offers (there are anyway only VERY few such).
There would be no problem to keep accepting version 0 sell offers also later in production.


dacoinminster (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1031


Rational Exuberance


View Profile WWW
February 19, 2014, 06:38:11 PM
 #1026


An alternative suggestion which is more backwards compatible but still doesn't complicate the parsing state machine - and therefore it is less bugs prone:
Treat each sell offer version 0 exactly as a sell offer version 1 with action 1 (new).
Then we will still have enough data to check our DEx implementations with, and the only differences from 0.3.5 spec version would be with modified sell offers (there are anyway only VERY few such).
There would be no problem to keep accepting version 0 sell offers also later in production.


I think that sounds perfect.

marvschneider
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 19, 2014, 07:00:03 PM
 #1027

Quote
Treat each sell offer version 0 exactly as a sell offer version 1 with action 1 (new).

There are two edge cases here -
  • version 0 with Amount for sale = 0 (to cancel a sell offer) will produce a version 1 with Amount for sale = 0, which is not valid.
  • version 0 with new values (to update a sell offer) will fail because it will look like an attempt to create a new sell offer while that address has one that's active
dacoinminster (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1031


Rational Exuberance


View Profile WWW
February 19, 2014, 07:51:43 PM
 #1028

Quote
Treat each sell offer version 0 exactly as a sell offer version 1 with action 1 (new).

There are two edge cases here -
  • version 0 with Amount for sale = 0 (to cancel a sell offer) will produce a version 1 with Amount for sale = 0, which is not valid.
  • version 0 with new values (to update a sell offer) will fail because it will look like an attempt to create a new sell offer while that address has one that's active

Note that this conversation is also taking place on our dev mailing list, and not everything is posted here.

Currently the consensus seems to be the above plus allowing version=0 with amount=0 to represent the cancel action on those old transactions.

Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
February 20, 2014, 02:31:10 PM
 #1029

Here is a new trans I posted from the wallet

2 byte trans version
1 byte action

fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58

Please check if it is correct.
dexX7
Legendary
*
Offline Offline

Activity: 1106
Merit: 1024



View Profile WWW
February 21, 2014, 06:11:58 PM
 #1030

Thanks zathras and Bitoy!

To pick this up again, those are the API endpoints I found:

Code:
https://masterchest.info/mastercoin_verify/addresses.aspx
https://masterchest.info/mastercoin_verify/transactions.aspx?address=[ADDRESS]&currencyid=[CURRENCYID]

http://www.mymastercoins.com/jaddress.aspx?address=[ADDRESS]&currency_id=[CURRENCYID]
http://www.mymastercoins.com/jtransactions.aspx?address=[ADDRESS]&currency_id=[CURRENCYID]

https://masterchain.info/mastercoin_verify/addresses/[CURRENCYID - 1]
https://masterchain.info/mastercoin_verify/transactions/[ADDRESS]

jakecnn
Newbie
*
Offline Offline

Activity: 34
Merit: 0


View Profile
February 21, 2014, 06:19:06 PM
 #1031

Any guidance on what needs to be tested currently?
dexX7
Legendary
*
Offline Offline

Activity: 1106
Merit: 1024



View Profile WWW
February 21, 2014, 08:38:33 PM
Last edit: February 22, 2014, 12:46:12 AM by dexX7
 #1032

With the faucet one significant expense is the transportation cost. To collect all those multi-sig outputs that are spendable I did this:

1. List and store all transactions for address X
2. Iterate over all outputs and store those which are from type "mutlisig" and require one signature and include address X
3. Create a raw transaction that spents such output from (2) for each potential output
4. If signrawtransaction for (3) returns "complete", this output is indeed spendable
5. Store all those and create a transaction that uses all spendable outputs as inputs and send the coins back to address X

This is how the result looks like:

https://blockchain.info/tx/21db95ecd700438bf46e0a435410c27ab0f235218a80afacd81db4fec5bf8260 (ignore the "script translation" from blockchain.info.. of course no OP_FALSE was used)


If you like to test this yourself, feel free to use this as basis:

https://gist.github.com/dexX7/9146763


For some odd reason my local bitcoind client started to return a success for outputs that are already spent and thus the whole approach fails now, because the success or failure of signing the tx determined, if an output shall to be considered as spendable. edit: there was one case where an output was added to the list two times.

I haven't looked at alternative implementations like sx or libbitcoin. I like to know, if one of those is worth to look at and if anyone of you guys here already worked on a solution for spending multisig outputs. Smiley


grazcoin
Sr. Member
****
Offline Offline

Activity: 284
Merit: 250



View Profile
February 22, 2014, 09:26:23 AM
 #1033

Here is a new trans I posted from the wallet

2 byte trans version
1 byte action

fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58

Please check if it is correct.

On my parsing it is still invalid:
https://masterchain.info/selloffer.html?tx=fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58&currency=MSC
and the invalid reason (hover red Invalid) is "invalid last data script in BIP 11".
or the json:
https://masterchain.info/tx/fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58.json

You data script is:
0002004e2002000000000000000000000000000000000000000000000000000000
and my internal parsing says:

parse_multisig: {'action': '0', 'should_be_zeros': '2000000000000000000000000000000000000000000', 'fee_required': '004e20'}

The relevant parsing code is the function parse_2nd_data_script:
https://github.com/grazcoin/mastercoin-tools/blob/master/msc_utils_parsing.py#L60



Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
February 22, 2014, 11:11:47 AM
 #1034



On my parsing it is still invalid:
https://masterchain.info/selloffer.html?tx=fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58&currency=MSC
and the invalid reason (hover red Invalid) is "invalid last data script in BIP 11".
or the json:
https://masterchain.info/tx/fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58.json

You data script is:
0002004e2002000000000000000000000000000000000000000000000000000000
and my internal parsing says:

parse_multisig: {'action': '0', 'should_be_zeros': '2000000000000000000000000000000000000000000', 'fee_required': '004e20'}

The relevant parsing code is the function parse_2nd_data_script:
https://github.com/grazcoin/mastercoin-tools/blob/master/msc_utils_parsing.py#L60




The action is 1 byte 8 bit unsigned integer.  
https://github.com/mastercoin-MSC/spec#field-sell-offer-sub-action

So instead of "2" (for update) I changed it to  "02"
BasedForLife
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
February 22, 2014, 12:36:45 PM
 #1035

Are you seriously paying out 300?
Westphalian
Newbie
*
Offline Offline

Activity: 47
Merit: 0



View Profile
February 23, 2014, 10:19:03 AM
 #1036

Are you seriously paying out 300?

Yes.  More info on bounties here --> http://mastercointalk.org/index.php?topic=121.0
StarenseN
Legendary
*
Offline Offline

Activity: 2478
Merit: 1362



View Profile
February 23, 2014, 03:13:34 PM
 #1037

Are you seriously paying out 300?

Half (150 btc) have been already paid.
ripper234
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 23, 2014, 08:24:01 PM
 #1038

Going forward we are paying out $100,000 each month, plus an additional amount of Dev MSC.

http://mastercointalk.org/index.php?topic=121.0

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
grazcoin
Sr. Member
****
Offline Offline

Activity: 284
Merit: 250



View Profile
February 23, 2014, 11:18:47 PM
 #1039



On my parsing it is still invalid:
https://masterchain.info/selloffer.html?tx=fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58&currency=MSC
and the invalid reason (hover red Invalid) is "invalid last data script in BIP 11".
or the json:
https://masterchain.info/tx/fdebcfcaf4d7bceddd206dc1f334d7c5ccb7a6890c0cfe9d7926be6d7d5e2f58.json

You data script is:
0002004e2002000000000000000000000000000000000000000000000000000000
and my internal parsing says:

parse_multisig: {'action': '0', 'should_be_zeros': '2000000000000000000000000000000000000000000', 'fee_required': '004e20'}

The relevant parsing code is the function parse_2nd_data_script:
https://github.com/grazcoin/mastercoin-tools/blob/master/msc_utils_parsing.py#L60




The action is 1 byte 8 bit unsigned integer.  
https://github.com/mastercoin-MSC/spec#field-sell-offer-sub-action

So instead of "2" (for update) I changed it to  "02"



OK. I updated also to "02".

Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
February 24, 2014, 01:35:44 PM
 #1040


Mymastercoins Wallet v 2 released.

http://mymastercoins.com/MyMSCWallet.aspx
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 [52] 53 54 55 56 57 58 59 60 61 62 63 64 65 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!