Pages:
Author

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

sr. member
Activity: 449
Merit: 250
Code:
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 ?
hero member
Activity: 938
Merit: 1000
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 Smiley


3 Payment transaction confirmed =)

http://mymastercoins.com/Orders.aspx?CurrencyID=2

Hmm I show some more: http://mastercoin-explorer.com/order_books
sr. member
Activity: 449
Merit: 250
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 Smiley


3 Payment transaction confirmed =)

http://mymastercoins.com/Orders.aspx?CurrencyID=2
hero member
Activity: 938
Merit: 1000
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.

Code:
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.
sr. member
Activity: 449
Merit: 250
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.

Code:
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
hero member
Activity: 938
Merit: 1000



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.

Code:
      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:
Code:
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 Smiley

"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 Smiley


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.

Code:
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
sr. member
Activity: 449
Merit: 250


I've expanded out the numbers for clarity:
Code:
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 Smiley

"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 Smiley


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=2

Ok got it the fee is 0.001 will fix the bug.
https://blockchain.info/tx/2bb54346f7d0ddfcb084451227089665bc1a7ebf8f0a9338d14d713592c268ed
sr. member
Activity: 266
Merit: 250



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.

Code:
      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:
Code:
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 Smiley

"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 Smiley
sr. member
Activity: 449
Merit: 250
Here is my implementation of the Distributed Trade processing.

http://mymastercoins.com/Orders.aspx?CurrencyID=2


Some 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=998
Click find
Select test msc.
You will see the buying and selling of that address.

Will try to see if I can automate this Smiley
full member
Activity: 201
Merit: 100
Here is my implementation of the Distributed Trade processing.

http://mymastercoins.com/Orders.aspx?CurrencyID=2


Some 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?
sr. member
Activity: 449
Merit: 250

For the transaction above, is the btc payment( for the test btc) in the multi sig ?

sr. member
Activity: 449
Merit: 250
Here is my implementation of the Distributed Trade processing.

http://mymastercoins.com/Orders.aspx?CurrencyID=2


Some 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 =)
sr. member
Activity: 449
Merit: 250
Thanks TKeenan.

Btw I haven't turned on the transaction processing (data as of nov 4 only) because of  debugging on distributed exchange.

http://www.mymastercoins.com/Orders.aspx?CurrencyID=2



MyMastercoins.com

http://mymastercoins.com/Default.aspx

show MSC and test MSC balance per address
transactions per address  (checked with mastercoin-explorer,masterchest,masterchain)
calculates and validates MSC dev coins
vb.net
sql server
Awesome!!!  Way to go.  Very cool work.
hero member
Activity: 874
Merit: 1000
MyMastercoins.com

http://mymastercoins.com/Default.aspx

show MSC and test MSC balance per address
transactions per address  (checked with mastercoin-explorer,masterchest,masterchain)
calculates and validates MSC dev coins
vb.net
sql server
Awesome!!!  Way to go.  Very cool work.
sr. member
Activity: 449
Merit: 250
MyMastercoins.com

http://mymastercoins.com/Default.aspx

show MSC and test MSC balance per address
transactions per address  (checked with mastercoin-explorer,masterchest,masterchain)
calculates and validates MSC dev coins
vb.net
sql server




hero member
Activity: 938
Merit: 1000
x-post from General thread.



Quote
What if I dont have the mastercoins on my bitcoin-qt wallet but on the blockchain's wallet ? will I still manaage to broadcast the transaction ?

https://www.facebook.com/groups/213147185526904/214802042028085/?comment_id=214808968694059¬if_t=group_comment


========EDIT=======

Nevermind I found the answer to this

https://blockchain.info/pushtx

I saw that also but could not figure out how to sign the raw transaction.  Would be nice if blockchain.info could also be used in addition to the console but I couldn't find a way to do it.

I need to go and do a bunch of updates to the tutorial, and set up a blockchain wallet  but I think you may be able to use this

https://blockchain.info/pushtx
That's only for sending a transaction. Not signing it.

Sorry I had misread that.
 
Could they use this to sign the tx in bitcoin-qt? the 3rd option is for a base58 private key, which can be exported from blockchain.info wallet advanced settings

signrawtransaction [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [,...] [sighash="ALL"]

That could work, never done it myself though.
legendary
Activity: 1666
Merit: 1010
he who has the gold makes the rules


Quote
What if I dont have the mastercoins on my bitcoin-qt wallet but on the blockchain's wallet ? will I still manaage to broadcast the transaction ?

https://www.facebook.com/groups/213147185526904/214802042028085/?comment_id=214808968694059¬if_t=group_comment


========EDIT=======

Nevermind I found the answer to this

https://blockchain.info/pushtx

I saw that also but could not figure out how to sign the raw transaction.  Would be nice if blockchain.info could also be used in addition to the console but I couldn't find a way to do it.

I need to go and do a bunch of updates to the tutorial, and set up a blockchain wallet  but I think you may be able to use this

https://blockchain.info/pushtx
That's only for sending a transaction. Not signing it.

Sorry I had misread that.
 
Could they use this to sign the tx in bitcoin-qt? the 3rd option is for a base58 private key, which can be exported from blockchain.info wallet advanced settings

signrawtransaction [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [,...] [sighash="ALL"]
hero member
Activity: 938
Merit: 1000


Quote
What if I dont have the mastercoins on my bitcoin-qt wallet but on the blockchain's wallet ? will I still manaage to broadcast the transaction ?

https://www.facebook.com/groups/213147185526904/214802042028085/?comment_id=214808968694059¬if_t=group_comment


========EDIT=======

Nevermind I found the answer to this

https://blockchain.info/pushtx

I saw that also but could not figure out how to sign the raw transaction.  Would be nice if blockchain.info could also be used in addition to the console but I couldn't find a way to do it.

I need to go and do a bunch of updates to the tutorial, and set up a blockchain wallet  but I think you may be able to use this

https://blockchain.info/pushtx
That's only for sending a transaction. Not signing it.
sr. member
Activity: 449
Merit: 250

The transaction "48d09647a8b233dbd2eecf16873bdcd99afa73ecbcd3c8b5ca39d79f0abfa1d5" is valid but there is no payment confirmation to the seller (13NRX88EZbS5q81x6XFrTECzrciPREo821).

I was expecting a send to many transaction ie.
1. 13NRX88EZbS5q81x6XFrTECzrciPREo821  0.000101 Btc  (Payment for 1 Test MSC coin)
2. Exodus Address   .00006 btc


Code:

Seller
13NRX88EZbS5q81x6XFrTECzrciPREo821

Currency for Sale  
#. Time, Amount
1. 11/2/2013 2:54:18 PM, 20  
2. 11/2/2013 1:53:12 PM, 20   note: zero amount not valid
3. 10/28/2013 7:46:57 PM, 10
4. 10/28/2013 11:48:56 AM, 10  
5. 10/25/2013 2:25:07 PM, 1  


Accepted
Time,Amount
11/2/2013 8:17:50 PM, 20  (Accepted 4@#3 16@#2 )
11/2/2013 2:16:37 PM, 1   (Accepted 1@#3 )
10/28/2013 9:50:50 PM, 10 (Accepted 7@#4 and 3@#3 )
10/28/2013 4:15:23 PM, 2  (Accepted 2@#4)    
10/28/2013 3:58:55 PM, 2  (Accepted 1@#5 and 1@#4)


legendary
Activity: 1666
Merit: 1010
he who has the gold makes the rules
Seems the fee was not set properly. I'm investigating.

Edit: I'm guessing you kept the fee set to 0.00001 ? This is lower then the required network fee. I've updated the code to force the fee to 0.0001 when it's set lower so other users don't make this mistake.

That is correct I did not change anything else other then the amount of test MSC to buy.

So is this TX just going to hang out on the network with 0 confirms until the fees are lowered or something?? 
Pages:
Jump to: