Bitoy
|
|
November 04, 2013, 09:08:37 AM |
|
Here is my implementation of the Distributed Trade processing. http://mymastercoins.com/Orders.aspx?CurrencyID=2Some notes CFSID = Currency for Sale ID. Available = No of Test MSC left for sale. If BTCDesired = 0. Set all Available to 0 (for that Currency). Buying If AmounttoPurchase > Available AmountPurchased = Available Comments are very welcomed =) This is pretty nice. I notice that completed transactions all show as "Waiting for payment" The seller ID's with links are a cool touch - do the existing ID's reference anything specific? "waiting for payment" means it hasn't seen a payment made by the buyer to the seller for the purchase transaction. The way I understand it is the buyer has to send a btc payment direct to the sellers address and .00006 btc to the exodus address (one transaction 2 sends) before the test msc is transferred. Clicking sellers Id will redirect you to a link ex. http://mymastercoins.com/default.aspx?AID=998Click find Select test msc. You will see the buying and selling of that address. Will try to see if I can automate this
|
|
|
|
zathras
|
|
November 04, 2013, 09:48:07 AM |
|
Yeah, I think we should use the timestamp of the most recent bitcoin block, rather than the node's local clock.
I guess the full formula is actually (1-(0.5^y)) * 10% * total number of mastercoins bought at 1Exodus before the deadline
Could somebody confirm my vesting calculation is correct? Let's set the time to 2013-10-31 10:45:45 +0100 the output I get for the Exodus vesting is MSC 6103.51504811. Just a quick note on this one - I'm getting slightly different amounts, can you let me know what you're using for your fixed values? I'm using: * Seconds in a year: 31557600 * End of funding: 1377993600 * Total Reward Mastercoins: 56316.23576222 Using your example time (1383212745) I'm seeing 6099.57209817. Thanks for checking. This is what I'm using now. time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222
tx_date = 1383212745 Mastercoin::END_TIME = 1377993600 time_difference = 5219145 Giving me a total of 6060.791436028762 (I initially used a rounded down value for the total amount of MSC, doh.) Could I just get you to double check your numbers one more time mate? I've double checked mine and we're using the same formula but getting different results it seems. I've expanded out the numbers for clarity: Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222) 6099.57209816932
For my implementation of the distributed exchange it'll be a few more days before I open up the wallet for testing and push the new engine up to Masterchest as I still have some areas to fix up from the changes (had to change the way I handled transactions) but I'll start putting some of my tests in the blockchain soon and see how my stuff interops with the stuff you guys have already done "waiting for payment" means it hasn't seen a payment made by the buyer to the seller for the purchase transaction.
The way I understand it is the buyer has to send a btc payment direct to the sellers address and .00006 btc to the exodus address (one transaction 2 sends) before the test msc is transferred.
That's correct, a payment to Exodus is required when sending the BTC payment (though it doesn't necessarily have to be 0.00006, anything >dust is fine). There have been some trades already done (see for example 18xEZx3po1iJWP5H2aM3Do11dCGQyaebnT) that appear to be valid
|
|
|
|
Bitoy
|
|
November 04, 2013, 12:51:25 PM Last edit: November 04, 2013, 01:07:32 PM by Bitoy |
|
I've expanded out the numbers for clarity: Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222) 6099.57209816932
For my implementation of the distributed exchange it'll be a few more days before I open up the wallet for testing and push the new engine up to Masterchest as I still have some areas to fix up from the changes (had to change the way I handled transactions) but I'll start putting some of my tests in the blockchain soon and see how my stuff interops with the stuff you guys have already done "waiting for payment" means it hasn't seen a payment made by the buyer to the seller for the purchase transaction.
The way I understand it is the buyer has to send a btc payment direct to the sellers address and .00006 btc to the exodus address (one transaction 2 sends) before the test msc is transferred.
That's correct, a payment to Exodus is required when sending the BTC payment (though it doesn't necessarily have to be 0.00006, anything >dust is fine). There have been some trades already done (see for example 18xEZx3po1iJWP5H2aM3Do11dCGQyaebnT) that appear to be valid Your calculations for msc dev coins looks correct to me. 18xEZx3po1iJWP5H2aM3Do11dCGQyaebnT paid 0.003232 in 2bb54346f7d0ddfcb084451227089665bc1a7ebf8f0a9338d14d713592c268ed But there is a transfer fee of .001. My implementation is expecting payment of .004232. Transfer fee paid by the buyer?http://mymastercoins.com/Orders.aspx?CurrencyID=2Ok got it the fee is 0.001 will fix the bug. https://blockchain.info/tx/2bb54346f7d0ddfcb084451227089665bc1a7ebf8f0a9338d14d713592c268ed
|
|
|
|
Tachikoma
|
|
November 04, 2013, 01:46:30 PM |
|
Yeah, I think we should use the timestamp of the most recent bitcoin block, rather than the node's local clock.
I guess the full formula is actually (1-(0.5^y)) * 10% * total number of mastercoins bought at 1Exodus before the deadline
Could somebody confirm my vesting calculation is correct? Let's set the time to 2013-10-31 10:45:45 +0100 the output I get for the Exodus vesting is MSC 6103.51504811. Just a quick note on this one - I'm getting slightly different amounts, can you let me know what you're using for your fixed values? I'm using: * Seconds in a year: 31557600 * End of funding: 1377993600 * Total Reward Mastercoins: 56316.23576222 Using your example time (1383212745) I'm seeing 6099.57209817. Thanks for checking. This is what I'm using now. time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222
tx_date = 1383212745 Mastercoin::END_TIME = 1377993600 time_difference = 5219145 Giving me a total of 6060.791436028762 (I initially used a rounded down value for the total amount of MSC, doh.) Could I just get you to double check your numbers one more time mate? I've double checked mine and we're using the same formula but getting different results it seems. I've expanded out the numbers for clarity: Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222) 6099.57209816932
For my implementation of the distributed exchange it'll be a few more days before I open up the wallet for testing and push the new engine up to Masterchest as I still have some areas to fix up from the changes (had to change the way I handled transactions) but I'll start putting some of my tests in the blockchain soon and see how my stuff interops with the stuff you guys have already done "waiting for payment" means it hasn't seen a payment made by the buyer to the seller for the purchase transaction.
The way I understand it is the buyer has to send a btc payment direct to the sellers address and .00006 btc to the exodus address (one transaction 2 sends) before the test msc is transferred.
That's correct, a payment to Exodus is required when sending the BTC payment (though it doesn't necessarily have to be 0.00006, anything >dust is fine). There have been some trades already done (see for example 18xEZx3po1iJWP5H2aM3Do11dCGQyaebnT) that appear to be valid Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222 => 6099.570778312406
|
|
|
|
Bitoy
|
|
November 04, 2013, 02:29:21 PM |
|
It maybe a rounding off issue Zathras * 56316.23576222 Tachikoma *.01 * 563162.23576222 Zathras /31557600 Tachikoma / 60 / 60 / 24 / 365.25 Also What is "+0100" in the time 2013-10-31 10:45:45 +0100 Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222 => 6099.570778312406
|
|
|
|
Tachikoma
|
|
November 04, 2013, 02:37:16 PM |
|
It maybe a rounding off issue Zathras * 56316.23576222 Tachikoma *.01 * 563162.23576222 Zathras /31557600 Tachikoma / 60 / 60 / 24 / 365.25 Also What is "+0100" in the time 2013-10-31 10:45:45 +0100 Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222 => 6099.570778312406
It's the timezone. I'm guessing that could be the reason for the small difference. I'm betting that if I would recalculate it with an hour difference we get the same numbers. Will check that out as soon as I can.
|
|
|
|
Bitoy
|
|
November 04, 2013, 02:56:59 PM |
|
That's correct, a payment to Exodus is required when sending the BTC payment (though it doesn't necessarily have to be 0.00006, anything >dust is fine). There have been some trades already done (see for example 18xEZx3po1iJWP5H2aM3Do11dCGQyaebnT) that appear to be valid 3 Payment transaction confirmed =) http://mymastercoins.com/Orders.aspx?CurrencyID=2
|
|
|
|
|
Bitoy
|
|
November 04, 2013, 03:32:37 PM Last edit: November 04, 2013, 03:44:15 PM by Bitoy |
|
Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222) 6099.57209816932
Sorry should have addressed this to Zathras =) DateDiff(DateInterval.Second, #1/1/1970#, #9/1/2013#) = 1377993600 Correct. DateDiff(DateInterval.Second, #1/1/1970#, #10/01/2013 10:45:45#) = 1380624345 Not the same with your result. =1383212745 How did you get 1383212745 ?
|
|
|
|
vokain
Legendary
Offline
Activity: 1834
Merit: 1019
|
|
November 04, 2013, 03:38:45 PM Last edit: November 04, 2013, 04:00:01 PM by vokain |
|
I was wondering, would it be possible to build upon the same mechanism for BTC-MSC exchange and add support for LTC/other alt-chain exchanging? I don't use LTC or have any but I do know a decent segment would find it useful to be able to trade back and forth between alt currencies. It could be a good, quick, and easy proof-of-concept and validation for Mastercoin to be used to trade other cryptocurrencies around for each other if there was a way to parse/manipulate two blockchains at once.
|
|
|
|
|
Luckybit
|
|
November 04, 2013, 05:09:18 PM |
|
I was wondering, would it be possible to build upon the same mechanism for BTC-MSC exchange and add support for LTC/other alt-chain exchanging? I don't use LTC or have any but I do know a decent segment would find it useful to be able to trade back and forth between alt currencies. It could be a good, quick, and easy proof-of-concept and validation for Mastercoin to be used to trade other cryptocurrencies around for each other if there was a way to parse/manipulate two blockchains at once.
Actually thinking about it, it probably would be trivial. If you can do it with BTC I don't see why LTC would be difficult but I'm not an expert. I think once MSC to BTC is working then LTC and the other altcoins ought to be next.
|
|
|
|
dacoinminster (OP)
Legendary
Offline
Activity: 1260
Merit: 1031
Rational Exuberance
|
|
November 04, 2013, 06:45:34 PM |
|
I was wondering, would it be possible to build upon the same mechanism for BTC-MSC exchange and add support for LTC/other alt-chain exchanging? I don't use LTC or have any but I do know a decent segment would find it useful to be able to trade back and forth between alt currencies. It could be a good, quick, and easy proof-of-concept and validation for Mastercoin to be used to trade other cryptocurrencies around for each other if there was a way to parse/manipulate two blockchains at once.
Actually thinking about it, it probably would be trivial. If you can do it with BTC I don't see why LTC would be difficult but I'm not an expert. I think once MSC to BTC is working then LTC and the other altcoins ought to be next. LTC will have to wait until we've got LTC tokens stored in the bitcoin block chain. That will either be user-backed smart property, or escrow-backed tokens later. We can do BTC/MSC now because we are living in the BTC block chain.
|
|
|
|
zathras
|
|
November 04, 2013, 09:26:47 PM Last edit: November 04, 2013, 09:36:48 PM by zathras |
|
It maybe a rounding off issue Zathras * 56316.23576222 Tachikoma *.01 * 563162.23576222 Zathras /31557600 Tachikoma / 60 / 60 / 24 / 365.25 Also What is "+0100" in the time 2013-10-31 10:45:45 +0100 Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222 => 6099.570778312406
It's the timezone. I'm guessing that could be the reason for the small difference. I'm betting that if I would recalculate it with an hour difference we get the same numbers. Will check that out as soon as I can. It's not a timezone issue (we're both using the same value for time difference; 5219145). The discrepancy is in rounding. Mastercoins are divisible by 8 decimal places only, thus the reward/dev Mastercoin total is 56316.22357622 (not 56316.22357622 2). Your method of using 0.1 * total_purchased_MSC results in a reward/dev MSC total with too many decimal places (9), which thus then produces a slightly skewed vested figure. For example (again expanded numbers to keep simple) Console.WriteLine("Testing against a dev MSC total of 56316.23576222:" Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222)
Testing against a dev MSC total of 56316.23576222: 6099.57209816932
Console.WriteLine("Testing against a dev MSC total of 56316.235762222: (note 9 decimal places)" Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 0.1 * 563162.23576222)
Testing against a dev MSC total of 56316.235762222: (note 9 decimal places) 6099.57077831241
I know it's only 0.000000002 but as you can see the second example matches your numbers. I don't believe that 9th decimal place can be counted hence I believe the correct value (as at 1383212745) was 6099.57209817 MSC - hope this helps Console.WriteLine((1 - (0.5 ^ ((1383212745 - 1377993600) / 31557600))) * 56316.23576222) 6099.57209816932
Sorry should have addressed this to Zathras =) DateDiff(DateInterval.Second, #1/1/1970#, #9/1/2013#) = 1377993600 Correct. DateDiff(DateInterval.Second, #1/1/1970#, #10/01/2013 10:45:45#) = 1380624345 Not the same with your result. =1383212745 How did you get 1383212745 ? 1383212745 is unix time for Tachikoma's original example time (2013-10-31 10:45:45 +0100). Looks like you have the wrong date in there (10/01/2013). Thanks!
|
|
|
|
Tachikoma
|
|
November 04, 2013, 09:43:42 PM |
|
It maybe a rounding off issue Zathras * 56316.23576222 Tachikoma *.01 * 563162.23576222 Zathras /31557600 Tachikoma / 60 / 60 / 24 / 365.25 Also What is "+0100" in the time 2013-10-31 10:45:45 +0100 Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.2357622 => 6099.570778312406
It's the timezone. I'm guessing that could be the reason for the small difference. I'm betting that if I would recalculate it with an hour difference we get the same numbers. Will check that out as soon as I can. It's not a timezone issue (we're both using the same value for time difference; 5219145). The discrepancy is in rounding. Mastercoins are divisible by 8 decimal places only, thus the reward/dev Mastercoin total is 56316.22357622 (not 56316.22357622 2). It's late and I don't feel too well but I'm still not getting the right result. 2.0.0p247 :017 > time_difference = (tx_date.to_i - Mastercoin::END_TIME.to_i) / 60 / 60 / 24 / 365.25 => 0.16427104722792607 2.0.0p247 :018 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.35762218 => 6060.79274749
|
|
|
|
zathras
|
|
November 04, 2013, 09:57:54 PM |
|
It's late and I don't feel too well but I'm still not getting the right result. 2.0.0p247 :017 > time_difference = (tx_date.to_i - Mastercoin::END_TIME.to_i) / 60 / 60 / 24 / 365.25 => 0.16427104722792607 2.0.0p247 :018 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.35762218 => 6060.79274749
Sorry to hear you're not feeling well, please don't feel at all like you need to respond just take it easy for a bit Re above, if you took your original code: Not sure what changed but I ran the code again now and got a different answer somehow. It's still not a 100% match though. 1.9.3-p286 :002 > tx_date = Time.parse("2013-10-31 10:45:45 +0100") => 2013-10-31 10:45:45 +0100 1.9.3-p286 :003 > time_difference = (tx_date - Mastercoin::END_TIME) / 60 / 60 / 24 / 365.25 => 0.1653847250741501 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222 => 6099.570778312406
And simply change 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222
to 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 56316.22357622
You should be set Get well soon
|
|
|
|
Tachikoma
|
|
November 04, 2013, 10:00:11 PM |
|
Wow I must be having a stroke I was using the total amount of MSC not the reward MSC in my calculation... Thanks for pointing that out! I will get to bed now
|
|
|
|
zathras
|
|
November 04, 2013, 10:08:58 PM |
|
Wow I must be having a stroke I was using the total amount of MSC not the reward MSC in my calculation... Thanks for pointing that out! I will get to bed now Hehe you were still doing the right thing (taking 0.1*total_MSC) just getting caught out by that 9th decimal - I'm quite green on Ruby but I think you could correct your original code with .round, so: Original: 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 0.1 * 563_162.23576222
Suggested: 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * 56316.22357622
Alternate Suggested: 1.9.3-p286 :004 > exodus_vesting = (1-(0.5**time_difference)) * (0.1 * 563_162.23576222).round(8)
Rest easy
|
|
|
|
grazcoin
|
|
November 04, 2013, 10:36:16 PM |
|
I am adding now the parsing of sell/buy offers to mastercoin-tools, and I start with this tx: https://blockchain.info/tx/49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34The first data_hex of the tx, deobfuscated, is: 0001000000140000000200000000773594000000000000004e2006000000000000 and it is parsed to: [{"tx_hash": "49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34", "block": "267950", "tx_type_str": "Sell offer", "from_address": "13NRX88EZbS5q81x6XFrTECzrciPREo821", "index": "311", "currencyId": "00000002", "tx_time": "1383592863000", "invalid": false, "padding": "000000", "tx_method_str": "multisig", "amount": "0000000077359400", "currency_str": "Test Mastercoin", "formatted_amount": "20.00000000", "to_address": "unknown", "baseCoin": "00", "method": "multisig", "dataSequenceNum": "01", "transactionType": "00000014"}] This fits to http://mastercoin-explorer.com/transactions/49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34but I still need to decipher the following from the second data_hex: * Price per coin * Bitcoin amount desired * Fee required * Block time limit The second data_hex of the tx is: 022eadb2cab02d826df0af54e92a352945c9892df6cd77f1a7c390fc82c8b0edb4 And if I try to deobfuscate it (the same way like the first data_hex), I get: 000966b7aba530122804984859bab666d58150b9d5e5cb007953579259fd7c3000 I still didn't find the format definition anywhere. Can you please give me a link?
|
|
|
|
zathras
|
|
November 04, 2013, 10:59:07 PM |
|
I am adding now the parsing of sell/buy offers to mastercoin-tools, and I start with this tx: https://blockchain.info/tx/49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34The first data_hex of the tx, deobfuscated, is: 0001000000140000000200000000773594000000000000004e2006000000000000 and it is parsed to: [{"tx_hash": "49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34", "block": "267950", "tx_type_str": "Sell offer", "from_address": "13NRX88EZbS5q81x6XFrTECzrciPREo821", "index": "311", "currencyId": "00000002", "tx_time": "1383592863000", "invalid": false, "padding": "000000", "tx_method_str": "multisig", "amount": "0000000077359400", "currency_str": "Test Mastercoin", "formatted_amount": "20.00000000", "to_address": "unknown", "baseCoin": "00", "method": "multisig", "dataSequenceNum": "01", "transactionType": "00000014"}] This fits to http://mastercoin-explorer.com/transactions/49f3efe0eba50ea08220c27d3c8174c5fa8a7782615823ab256859562cbd4a34but I still need to decipher the following from the second data_hex: * Price per coin * Bitcoin amount desired * Fee required * Block time limit The second data_hex of the tx is: 022eadb2cab02d826df0af54e92a352945c9892df6cd77f1a7c390fc82c8b0edb4 And if I try to deobfuscate it (the same way like the first data_hex), I get: 000966b7aba530122804984859bab666d58150b9d5e5cb007953579259fd7c3000 I still didn't find the format definition anywhere. Can you please give me a link? Hey Grazcoin, You'll need to look at your multi-packet handling. From your de-obfuscated packet It looks like you're SHA hashing the second packet only once. You'll need to hash seqnum times (so in this case 2). In terms of a 'definition' for Class B I think the closest thing we have at the mo is my suggested amendment hereHope that helps
|
|
|
|
|