Pages:
Author

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

hero member
Activity: 938
Merit: 1000
I FINALLY took a shot at sending the 1500 dev MSC from 1Exodus:

375 MSC to Bitoy: https://blockchain.info/tx/2b5ef4f2152759242f9afaf6567ef936016850d8bb2ffae6f1b1bf87c1209a01
375 MSC to Zathras: https://blockchain.info/tx/6b282ab5a7fe7c4d7b5cbec79d3d94c584ce88dc358e771651bec32eb88c0847
375 MSC to Grazcoin: https://blockchain.info/tx/a36de127620c5bf35ea216e5040a1921a904fe7bc9f8b9846934bccbd1df4a00
375 MSC to Tachikoma: https://blockchain.info/tx/5fa342f704ca6a9ae84134de8f2d987c18980de70a744d1aa8472e847555fcbd

In each case, the output to 1Exodus is ALSO the change. Let me know if these parse correctly for you guys.

Yup worked for Mastercoin explorer as well. Thanks Smiley

Is anyone else seeing an inaccurate number of Test MSCs on addresses on Mastercoin Explorer?

Yes, this is correct. Somehow Selling Offers introduced a bug where they conflicted with Exodus transactions I'm trying to fix this as we speak.
member
Activity: 205
Merit: 10
Is anyone else seeing an inaccurate number of Test MSCs on addresses on Mastercoin Explorer?

sr. member
Activity: 266
Merit: 250
My implementation has 9.6028 (out of a total 10) sold. That's quite a big difference. How about you Zathras?

This is how it's currently parsed:

You made that sell offer in block 270137 and cancelled it in 270278 (with tx 9468118ef2fa89c66733ce64038706850c2a81807cfd611e907e66fcf1b1edad).

While the sell offer was open the following accept offers were sent:

Code:
4deebd27cb461289f833f64d1dce1e8a287bacd7bc70dcdffb49565d2fc8409a 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384701670 270147 0 1 9702 NULL NULL NULL NULL 989899999
f67cc2760446b1458c4012bbe7d5f6129badcf4ac6896f82a4de7ec238103216 13tKKPNwDZGKhBK8gAHns7bXe2wtqhvzDb 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384699499 270144 0 2 9677 NULL NULL NULL NULL 100000
339abf9b176253e60d1569120c2d6bca214edd4e6d8a69ef4fcdaf4f4a12cec6 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384708399 270160 0 1 9761 NULL NULL NULL NULL 989899999
87018464d016a067e5c8fedc07551c027bd011f43f6d3a02e9a1e252b551ba82 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384699499 270144 0 2 9678 NULL NULL NULL NULL 10000000
4259faeb7c9d017beed911e30adcc82a0b0e6ee95d189a5531c1194663f58e99 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384703123 270149 0 1 9735 NULL NULL NULL NULL 100000000
baba8972de24528bd56ec4ab3ce5fcead28eb45ac418eb87aace08d3da062a9b 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384704190 270151 0 1 9745 NULL NULL NULL NULL 10100000
ac7593ff4fb4a9bc6b053fc12af10e4fc04db73e0fb467d1dbc2466c86c5936b 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384708399 270160 0 1 9762 NULL NULL NULL NULL 50000000
077487c7e8eeab2fb6fefd193dc81ebb5b97c43f2242cee7a110b15c2f6a5f69 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384701670 270147 0 2 9699 NULL NULL NULL NULL 989899999
b87e18e9d8eb6a3e70eb347e06ae5788bc0695b602b3c374cd133a963ac36f0d 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384701670 270147 0 2 9700 NULL NULL NULL NULL 10000000
57e8880da36ca97456828900b66c4699617875c3826ce263ab9a2d7572fe0885 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384721530 270188 0 1 9893 NULL NULL NULL NULL 100000000
644dd238f7090afe9c7280edc0b839c800bccbd8342b5e24fd21d4817520c4db 13tKKPNwDZGKhBK8gAHns7bXe2wtqhvzDb 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384723170 270190 0 1 9896 NULL NULL NULL NULL 10000000
025d9ed3f1dd620c84f7e5418fdf5635b7d9ca08350fac51a22b39389228fe01 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384729954 270202 0 1 9926 NULL NULL NULL NULL 100000000
760722e7b9c3130e6bcfbbf439d4790d34e017020aeea438039c0bc20df77b2c 1CcJFxoEW5PUwesMVxGrq6kAPJ1TJsSVqq 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384733133 270205 0 2 9934 NULL NULL NULL NULL 50000000
7d4d70eac81d514e30ce8762434b91cd1d1650bf492779a3992bbd6f0c2043aa 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384741070 270219 0 1 9957 NULL NULL NULL NULL 300000000
bf56a1ec213fdfcff0f26c8a9ab7eb7588ed5c0ddb202a225e12b35a0617c06e 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384720301 270180 0 1 9876 NULL NULL NULL NULL 50000000
27937e5ba11231560c650a64dbe5b02c5406c04863e4074991e70762cccff806 16rAwebBXhJAM9ALf3fLFbaHKz24r2o3UN 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384734558 270208 0 1 9939 NULL NULL NULL NULL 50000000
fffbde998c925d159c13020bb4e9c6d71cf1553e75624aeb174488102b7b0c0c 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384738049 270215 0 1 9942 NULL NULL NULL NULL 1000000
be2005200503273686a26604076bb03a67fdaad6755d9599ae539ffde663491e 16rAwebBXhJAM9ALf3fLFbaHKz24r2o3UN 1EAuHj8Z6rTCHPxXfaGzzPsZevC2mg1XAj NULL acceptoffer 1384758541 270258 0 1 10021 NULL NULL NULL NULL 50000000

The following are identified as funds sent for purchases against that sell:

Code:
3cdcd1b8148a979f3930b1998b3282dfad2f623c9e85c9d924d4634621263294 1F73UPD5xBKgTSRd8q6QhuncVmDnJAHxYV 0.02
cf77f174b4cf4aaf8ba560070e2af97685e5f946f8cbd4eab6cb371fa50bfd0d 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 0.0202
66fc6ef07a48f703387eac59c78d8f3c8c1f465d72dd6f4452ebfff24cf3f745 1AMfFzbrhhizKDpqebYVYFGaTwdtSt5ux2 1.8798

My matching & locking code and resulting state processing is still not right though so as to which are valid; I'm working on some fixes Smiley
sr. member
Activity: 266
Merit: 250
Hey Bitoy,

The blockchain does need to be fully downloaded yep to use the encodetx function as it goes looping through the unspent outputs for the from address to find an input to use for fees and these won't be accurate if the blockchain isn't synced.  

With that said though it looks like you want to use blockchain.info to get unspent outputs so assume you're trying to modify the way encodetx works to use blockchain.info for vin selection rather than a local bitcoind?  Mind if I ask why you're going to a remote source if you already require having the blockchain local?  In any case yep fromtxid is the transaction we're using as the input, fromtxvout is the vout of the output number and fromtxamount is the amount of said vout (eg to work out change).

Using "listunspent", the resulting json is a blank (Probably because I have not downloaded the entire blockchain ).    When I changed it to "http://blockchain.info/unspent"  I was able to get one unspent transaction.

For the wallet I don't want to use blockchain.info anymore,  I prefer the bitcoind api.


Please post your rawtx (unsigned) and I'll have a look Smiley

Here is the raw transaction code from encodetx.   Thanks for taking a look at it =)

Code:
0100000001dfe3a4614e39d8ea6ea3a24c0519581cd2ea0d05ffaf016726f985d1d344fd6e0000000000ffffffff04d0dd0600000000001976a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac70170000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac70170000000000001976a9144708baf2f30fa7f93c531a7866b7ea9a32bdce3688ace02e0000000000004751210399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f2102915B577ABEFF7F707709DF6C5077FBB1172B02FDA32242D8BDBCE29880A22F8052ae00000000

Edit

Looks like I have a problem at "inputs"  script is blank.

Code:

{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"6efd44d3d185f9266701afff050dead21c5819054ca2a36eead8394e61a4e3df"
         },
         "script":""
      }
   ],
   "vout_sz":4,
   "hash":"c0041c10450f01c31e0acca267f84aaa8d5f45b9d49cbc376fd552bf9d62c236",
   "vin_sz":1,
   "out":[
      {
         "address":"1GtTPepFqS8MWZzFKsE62bNowY2LZos8Lq",
         "script_string":"OP_DUP OP_HASH160 ae45216a770fbb4a613c09e79b5c4006b908d3eb OP_EQUALVERIFY OP_CHECKSIG",
         "value":450000,
         "script":"76a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac"
      },
      {
         "address":"1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P",
         "script_string":"OP_DUP OP_HASH160 946cb2e08075bcbaf157e47bcb67eb2b2339d242 OP_EQUALVERIFY OP_CHECKSIG",
         "value":6000,
         "script":"76a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac"
      },
      {
         "address":"17UbSDAXDzmxRXCgn2w43EaaHzHK3Ncx87",
         "script_string":"OP_DUP OP_HASH160 4708baf2f30fa7f93c531a7866b7ea9a32bdce36 OP_EQUALVERIFY OP_CHECKSIG",
         "value":6000,
         "script":"76a9144708baf2f30fa7f93c531a7866b7ea9a32bdce3688ac"
      },
      {
         "script_string":"OP_1 0399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f 02915b577abeff7f707709df6c5077fbb1172b02fda32242d8bdbce29880a22f80 OP_2 OP_CHECKMULTISIG",
         "value":12000,
         "script":"51210399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f2102915b577abeff7f707709df6c5077fbb1172b02fda32242d8bdbce29880a22f8052ae"
      }
   ],
   "size":233,
   "version":1
}


Yeah you'll need a synchronized blockchain for listunspent.

Your transaction actually looks fine from a quick glance, assuming you're trying to send from 1GtTPepFqS8MWZzFKsE62bNowY2LZos8Lq using vout 0 from 6efd44d3d185f9266701afff050dead21c5819054ca2a36eead8394e61a4e3df.

Oh, and script is empty because you haven't signed it yet Tongue

Thanks! Smiley

sr. member
Activity: 449
Merit: 250
Hey Bitoy,

The blockchain does need to be fully downloaded yep to use the encodetx function as it goes looping through the unspent outputs for the from address to find an input to use for fees and these won't be accurate if the blockchain isn't synced.  

With that said though it looks like you want to use blockchain.info to get unspent outputs so assume you're trying to modify the way encodetx works to use blockchain.info for vin selection rather than a local bitcoind?  Mind if I ask why you're going to a remote source if you already require having the blockchain local?  In any case yep fromtxid is the transaction we're using as the input, fromtxvout is the vout of the output number and fromtxamount is the amount of said vout (eg to work out change).

Using "listunspent", the resulting json is a blank (Probably because I have not downloaded the entire blockchain ).    When I changed it to "http://blockchain.info/unspent"  I was able to get one unspent transaction.

For the wallet I don't want to use blockchain.info anymore,  I prefer the bitcoind api.


Please post your rawtx (unsigned) and I'll have a look Smiley

Here is the raw transaction code from encodetx.   Thanks for taking a look at it =)

Code:
0100000001dfe3a4614e39d8ea6ea3a24c0519581cd2ea0d05ffaf016726f985d1d344fd6e0000000000ffffffff04d0dd0600000000001976a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac70170000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac70170000000000001976a9144708baf2f30fa7f93c531a7866b7ea9a32bdce3688ace02e0000000000004751210399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f2102915B577ABEFF7F707709DF6C5077FBB1172B02FDA32242D8BDBCE29880A22F8052ae00000000

Edit

Looks like I have a problem at "inputs"  script is blank.

Code:

{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"6efd44d3d185f9266701afff050dead21c5819054ca2a36eead8394e61a4e3df"
         },
         "script":""
      }
   ],
   "vout_sz":4,
   "hash":"c0041c10450f01c31e0acca267f84aaa8d5f45b9d49cbc376fd552bf9d62c236",
   "vin_sz":1,
   "out":[
      {
         "address":"1GtTPepFqS8MWZzFKsE62bNowY2LZos8Lq",
         "script_string":"OP_DUP OP_HASH160 ae45216a770fbb4a613c09e79b5c4006b908d3eb OP_EQUALVERIFY OP_CHECKSIG",
         "value":450000,
         "script":"76a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac"
      },
      {
         "address":"1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P",
         "script_string":"OP_DUP OP_HASH160 946cb2e08075bcbaf157e47bcb67eb2b2339d242 OP_EQUALVERIFY OP_CHECKSIG",
         "value":6000,
         "script":"76a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac"
      },
      {
         "address":"17UbSDAXDzmxRXCgn2w43EaaHzHK3Ncx87",
         "script_string":"OP_DUP OP_HASH160 4708baf2f30fa7f93c531a7866b7ea9a32bdce36 OP_EQUALVERIFY OP_CHECKSIG",
         "value":6000,
         "script":"76a9144708baf2f30fa7f93c531a7866b7ea9a32bdce3688ac"
      },
      {
         "script_string":"OP_1 0399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f 02915b577abeff7f707709df6c5077fbb1172b02fda32242d8bdbce29880a22f80 OP_2 OP_CHECKMULTISIG",
         "value":12000,
         "script":"51210399078b8cda808b1e9bb9653869e94d6494576c9a26d37caac58c8388dd0ab43f2102915b577abeff7f707709df6c5077fbb1172b02fda32242d8bdbce29880a22f8052ae"
      }
   ],
   "size":233,
   "version":1
}

sr. member
Activity: 449
Merit: 250
I FINALLY took a shot at sending the 1500 dev MSC from 1Exodus:

375 MSC to Bitoy: https://blockchain.info/tx/2b5ef4f2152759242f9afaf6567ef936016850d8bb2ffae6f1b1bf87c1209a01
375 MSC to Zathras: https://blockchain.info/tx/6b282ab5a7fe7c4d7b5cbec79d3d94c584ce88dc358e771651bec32eb88c0847
375 MSC to Grazcoin: https://blockchain.info/tx/a36de127620c5bf35ea216e5040a1921a904fe7bc9f8b9846934bccbd1df4a00
375 MSC to Tachikoma: https://blockchain.info/tx/5fa342f704ca6a9ae84134de8f2d987c18980de70a744d1aa8472e847555fcbd

In each case, the output to 1Exodus is ALSO the change. Let me know if these parse correctly for you guys.

Looks good! Thanks!  https://masterchest.info/lookupadd.aspx?address=1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P

Also led me onto a bug (I'm no longer displaying generate transactions after switching to the new engine) - I didn't notice until now but I'm so used to seeing hundreds of generates when looking up Exodus this was an easy spot - thanks Smiley  EDIT: squashed


Transaction is ok also at
http://mymastercoins.com/Default.aspx?Addr=1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P

JR, Thank you again =)

sr. member
Activity: 266
Merit: 250
I FINALLY took a shot at sending the 1500 dev MSC from 1Exodus:

375 MSC to Bitoy: https://blockchain.info/tx/2b5ef4f2152759242f9afaf6567ef936016850d8bb2ffae6f1b1bf87c1209a01
375 MSC to Zathras: https://blockchain.info/tx/6b282ab5a7fe7c4d7b5cbec79d3d94c584ce88dc358e771651bec32eb88c0847
375 MSC to Grazcoin: https://blockchain.info/tx/a36de127620c5bf35ea216e5040a1921a904fe7bc9f8b9846934bccbd1df4a00
375 MSC to Tachikoma: https://blockchain.info/tx/5fa342f704ca6a9ae84134de8f2d987c18980de70a744d1aa8472e847555fcbd

In each case, the output to 1Exodus is ALSO the change. Let me know if these parse correctly for you guys.

Looks good! Thanks!  https://masterchest.info/lookupadd.aspx?address=1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P

Also led me onto a bug (I'm no longer displaying generate transactions after switching to the new engine) - I didn't notice until now but I'm so used to seeing hundreds of generates when looking up Exodus this was an easy spot - thanks Smiley  EDIT: squashed
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
sr. member
Activity: 266
Merit: 250
Hi Zathras,

I tried using your library to send a multisig transaction.  It was able to create the raw transaction but after signing it the result is complete=false.   Does it require the full bitcoin blockchain be downloaded? (it is 10 weeks behind.)  

btw I replaced your rpccall function with the code below (because webrequest didn't work in my computer).  

Code:
   Public Function rpccall(ByVal bitcoin_con As bitcoinrpcconnection, ByVal method As String, ByVal param0 As String, ByVal param1 As String, ByVal param2 As String, ByVal param3 As String) As String
        Dim Ans As String = ""
        Dim BitcoindExe As String = "C:\Program Files (x86)\Bitcoin\daemon\bitcoind.exe"
        If InStr(BitcoindExe, "bitcoind.exe") > 0 Then
            Try
                Dim process = New Process()
                process.StartInfo.FileName = BitcoindExe
                Dim params As String = ""
                If param1 <> "0" Then
                    params += param1 + " "
                End If
                If param2 <> "0" Then
                    params += param2 + " "
                End If
                If param3 <> "0" Then
                    params += param3
                End If

                Dim arg As String = "-rpcconnect=" + bitcoin_con.bitcoinrpcserver + " -rpcport=" + bitcoin_con.bitcoinrpcport.ToString + " -rpcuser=" + bitcoin_con.bitcoinrpcuser + " -rpcpassword=" + bitcoin_con.bitcoinrpcpassword + " " + method + " " + params
                process.StartInfo.Arguments = arg
                process.StartInfo.UseShellExecute = False
                process.StartInfo.CreateNoWindow = True
                process.StartInfo.RedirectStandardOutput = True
                process.Start()
                Ans = process.StandardOutput.ReadToEnd().ToString
                process.WaitForExit()
            Catch e As Exception
                'exception thrown
                MsgBox("Exception thrown: " & e.Message.ToString)
            End Try
        End If
        Return Ans
    End Function


Edit:

I also used the "http://blockchain.info/unspent?active="

In your encodetx function, is

fromtxvout   =   0   ("tx_output_n")
fromtxamount =  500000 ("value")


Code:

{

"unspent_outputs":[

{
"tx_hash":"dfe3a4614e39d8ea6ea3a24c0519581cd2ea0d05ffaf016726f985d1d344fd6e",
"tx_index":98418277,
"tx_output_n": 0,
"script":"76a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac",
"value": 500000,
"value_hex": "07a120",
"confirmations":247
}
 
]
}


Hey Bitoy,

The blockchain does need to be fully downloaded yep to use the encodetx function as it goes looping through the unspent outputs for the from address to find an input to use for fees and these won't be accurate if the blockchain isn't synced.  

With that said though it looks like you want to use blockchain.info to get unspent outputs so assume you're trying to modify the way encodetx works to use blockchain.info for vin selection rather than a local bitcoind?  Mind if I ask why you're going to a remote source if you already require having the blockchain local?  In any case yep fromtxid is the transaction we're using as the input, fromtxvout is the vout of the output number and fromtxamount is the amount of said vout (eg to work out change).

Please post your rawtx (unsigned) and I'll have a look Smiley

This is all open source so I'm happy for you to modify any way you like Smiley though could I try and steer you a little?  The rpccall is a fundamental part of the library as it handles all the comms between the library and bitcoind.  Your modifications to this function move the communication away from a JSON-RPC channel (which always returns a valid JSON response) to instead shell out to bitcoind with those same parameters and then read stdout.  Interesting, but I'm not sure it's 100% reliable as bitcoind on the command line doesn't always return valid JSON formatted output for all methods (eg no root element or object/value structure for single value responses).  You'll probably avoid unpredictable behaviour down the track if you stick to doing it over a JSON-RPC channel as designed - that's not to say you have too, just my advice Smiley  I can try and help you with whatever problem you're having with your system.net functions (what errors do you get with webrequest & what framework are you targeting?)

Hey Tachikoma,

Looking at that sell on sneakpeek (ref) it looks like I don't have a clean state on it in the db so there is definitely something wrong in the series of transactions masterchest has matched to that sell.  I'll take a more detailed look after work.

Thanks!
hero member
Activity: 938
Merit: 1000
My implementation has 9.6028 (out of a total 10) sold. That's quite a big difference. How about you Zathras?
sr. member
Activity: 449
Merit: 250
Zathras & Bitboy

Could you tell me how many coins were sold according to your implementations on the Selling Order I put online last week? Transaction 35822ef50d1c5639c80ded37b6580396ecc163bdbad34b3865b9e67b7f0787b3. I think the time is almost there to start comparing clients. I have one or two more bugs to fix but I think that should be it.


According to my implementation only  0.101 MSC for .0202 BTC was sold by 1AMfFz to 1EAuHj.

http://mymastercoins.com/Orders.aspx?CurrencyID=1
click "payment confirmed"

11/17/2013 4:03:10 PM .101 .101 .2 .0202 .001 baba89  188 1AMfFz  1EAuHj  270161 Payment Confirmed  .0202 0.00 


btw i'm trying to add multisig to my wallet so that we can do more testing.
hero member
Activity: 938
Merit: 1000
Zathras & Bitboy

Could you tell me how many coins were sold according to your implementations on the Selling Order I put online last week? Transaction 35822ef50d1c5639c80ded37b6580396ecc163bdbad34b3865b9e67b7f0787b3. I think the time is almost there to start comparing clients. I have one or two more bugs to fix but I think that should be it.
sr. member
Activity: 449
Merit: 250
Hi Zathras,

I tried using your library to send a multisig transaction.  It was able to create the raw transaction but after signing it the result is complete=false.   Does it require the full bitcoin blockchain be downloaded? (it is 10 weeks behind.)  

btw I replaced your rpccall function with the code below (because webrequest didn't work in my computer).  

Code:
    Public Function rpccall(ByVal bitcoin_con As bitcoinrpcconnection, ByVal method As String, ByVal param0 As String, ByVal param1 As String, ByVal param2 As String, ByVal param3 As String) As String
        Dim Ans As String = ""
        Dim BitcoindExe As String = "C:\Program Files (x86)\Bitcoin\daemon\bitcoind.exe"
        If InStr(BitcoindExe, "bitcoind.exe") > 0 Then
            Try
                Dim process = New Process()
                process.StartInfo.FileName = BitcoindExe
                Dim params As String = ""
                If param1 <> "0" Then
                    params += param1 + " "
                End If
                If param2 <> "0" Then
                    params += param2 + " "
                End If
                If param3 <> "0" Then
                    params += param3
                End If

                Dim arg As String = "-rpcconnect=" + bitcoin_con.bitcoinrpcserver + " -rpcport=" + bitcoin_con.bitcoinrpcport.ToString + " -rpcuser=" + bitcoin_con.bitcoinrpcuser + " -rpcpassword=" + bitcoin_con.bitcoinrpcpassword + " " + method + " " + params
                process.StartInfo.Arguments = arg
                process.StartInfo.UseShellExecute = False
                process.StartInfo.CreateNoWindow = True
                process.StartInfo.RedirectStandardOutput = True
                process.Start()
                Ans = process.StandardOutput.ReadToEnd().ToString
                process.WaitForExit()
            Catch e As Exception
                'exception thrown
                MsgBox("Exception thrown: " & e.Message.ToString)
            End Try
        End If
        Return Ans
    End Function


Edit:

I also used the "http://blockchain.info/unspent?active="

In your encodetx function, is

fromtxvout   =   0   ("tx_output_n")
fromtxamount =  500000 ("value")


Code:

{

"unspent_outputs":[

{
"tx_hash":"dfe3a4614e39d8ea6ea3a24c0519581cd2ea0d05ffaf016726f985d1d344fd6e",
"tx_index":98418277,
"tx_output_n": 0,
"script":"76a914ae45216a770fbb4a613c09e79b5c4006b908d3eb88ac",
"value": 500000,
"value_hex": "07a120",
"confirmations":247
}
 
]
}


hero member
Activity: 938
Merit: 1000
We already have #mastercoin on freenode Smiley
legendary
Activity: 1666
Merit: 1010
he who has the gold makes the rules
would it be helpful for you all to have a dev chat server?  IRC or any preferences

sr. member
Activity: 266
Merit: 250
Hey guys,

I've posted the new version of the library up to git here.  You can just pull the DLLs as binaries for ease of use (note the Masterchest DLL references the other two also so pull all three DLLs).

Please don't hesitate to ask any questions, I'll try and put some more detailed documentation together, but at the moment I'm trying to stay focused on the DEx implementation in my wallet and on masterchest.info.

Thanks! Smiley

Masterchest Library, a 2 minute overview:

Requirements: .NET 4, bitcoind/qt RPC server with transaction indexing enabled (disabled by default in 0.8+, add txindex=1 in bitcoin.conf and then start with -reindex to readd transaction index).

With thanks to BouncyCastle & Newtonsoft.

Quick function reference:

  • decryptmastercoinpacket
  • encryptmastercoinpacket
  • encodetx
  • encodeselltx
  • encodeaccepttx
  • getaddresses
  • getblock
  • getblockhash
  • getblockcount
  • getblocktemplate
  • gettransaction
  • getmastercointransaction
  • getrandombyte
  • ismastercointx
  • validateecdsa
  • rpccall
  • sha256hash

As you leverage these functions in Visual Studio you'll be prompted for the correct parameters and their types so they should be quite self explanatory to use, but feel free to ask any questions Smiley  There are a number of other functions in the library that the above functions use (eg byte conversions etc) - if you need them look over the source, but they shouldn't be required externally to the library.

Example transactions broadcast today via the library:

Simple Send: ba63aa51cbf233a63db56b2dfb731c4f609b728125d1154fbc5453ec841c07cc
Sell Offer: 21055eae2c3b4d900755378f099fe06d7f28666a4156c8449a46493ecd86a8d4
Accept Offer: 1c974ad343431897a919635c7d2ec55c537d3efddf38f6e1ffdb9b1eaa0edeb2

I also funded the accept offer but this wasn't done via the library as it's just a bitcoin transaction with no Mastercoin data - so far I've had no need to build a library function for it)

Purchase:  ba1f6a49255a05f9e4f694f8bef542ccba27f8b1a3372cf7651401e21b77337a

Additionally a few updates on my previous post on example usage of the library:

Firstly we need to init - so let's reference the Masterchest DLL and import masterchest.mlib.  

Then we'll start off by creating a bitcoin connection and mlib instance:

Code:
'Create a new mlib instance
Dim mlib As New Masterchest.mlib

'Create a bitcoind/qt connection:
Dim bitcoin_con As New bitcoinrpcconnection
bitcoin_con.bitcoinrpcserver = "127.0.0.1"
bitcoin_con.bitcoinrpcport = 8332
bitcoin_con.bitcoinrpcuser = "bitcoin"
bitcoin_con.bitcoinrpcpassword = "password"

Let's say we want to get the transactions in a block and look for Mastercoin transactions.

We start off by getting the blockhash for the block we want to parse, let's say 270788:

Code:
Dim blockhash As Blockhash = mlib.getblockhash(bitcoin_con, 270788)
           
Then we retrieve the actual block:

Code:
Dim block As Block = mlib.getblock(bitcoin_con, blockhash.result)
           
Make a string array of all the transaction IDs in the block:

Code:
Dim txarray() As String = block.result.tx.ToArray

So now we have a simple string array of all the transaction IDs in the block.  We could now loop through them and check for Mastercoin transactions.  Let's say txarray(1) is a25bdaa0e372704878666df3e54ab647d523de6911f3405e3ddfb9029170855c (that tx is in our example block of 270788).  Let's see if that's a Mastercoin transaction:

*Note we're skipping txarray(0) here as that's coinbase (ie the bitcoins generated for that block).

Code:
Dim txtype As String = mlib.ismastercointx(bitcoin_con, txarray(1))

OK, so txtype came back as "simple".  We now know this transaction is a Mastercoin transaction, a simple send.  We can now proceed to decode it (ismastercointx

will return "none" if it's not a Mastercoin transaction and you can safely skip that transaction).

We decode with getmastercointransaction, passing the type parameter we've just obtained to tell the library what type of object we're decoding to:

Code:
Dim tx As mastercointx = mlib.getmastercointransaction(bitcoin_con, txarray(1), "simple")
                         
That's it.  You can then enumerate the object properties, for example tx.fromadd for the from address.

Supported values for the type parameter for getmastercointransaction are currently:
* generate (object type: mastercointx)
* simple (object type: mastercointx)
* selloffer (object type: mastercointx_selloffer)
* acceptoffer (object type: mastercointx_acceptoffer)

So that's a very brief introduction to parsing transactions with the library - allowing easy parsing of simple sends and exchange transactions.  All the de-obfuscation and packet re-construction etc is done in the library so we don't have to worry about that.

How about getting all the addresses in the wallet and their bitcoin balances (for fees etc):

Code:
Dim addresses As List(Of btcaddressbal) = mlib.getaddresses(bitcoin_con)

Now let's say you wanted to encode transactions as Class B multisig:

Simple send:
Code:
Dim rawtx As String = mlib.encodetx(bitcoin_con, "FROMADDRESS", "TOADDRESS", curtype_int, amount_long)

Sell offer:
Code:
Dim rawtx As String = mlib.encodeselltx(bitcoin_con, "FROMADDRESS", curtype_int, saleamount_long, offeramount_long, minfee_long, timelimit_int)

Accept offer:
Code:
Dim rawtx As String = mlib.encodeaccepttx(bitcoin_con, "FROMADDRESS", "TOADDRESS", curtype_int, purchaseamount_long)
       
Simple as that, just one-liners.  Vin selection and obfuscation etc is all handled within the library.  You then take rawtx (which is now a valid bitcoin transaction hex with the Mastercoin transaction within) and throw it to the signrawtransaction and sendrawtransaction commands (the library also has a built in RPC caller for any RPC calls that aren't specifically handled in the library - mlib.rpccall).

A note about payments for exchange transactions, I return "unknown" via the 'ismastercointx' function because in a purchase whilst there is an output to the Exodus address, there are no Mastercoin data packets (hence no transaction type bytes) so we don't know what it is - could be a purchase, could be a bad  transaction, a bitcoin transaction sending BTC into the Exodus address etc.   But as it has an output to Exodus we might need it, so we return "unknown" instead of "none".
hero member
Activity: 938
Merit: 1000
sr. member
Activity: 297
Merit: 250
Mastercoin web-services verification API proposal.

The Mastercoin validation rules are getting harder the more transaction types are being added. We need a way to easily determine when one of the implementations differs from the others. In order to faciliate this I would recommend every webbased Mastercoin service implements an API that repsonds to a few API calls in a specific format. This data can be used by a third-party application/webapplication to compare implementations and give notifications when there is no consensus.


Are we not beginning to stretch the meaning of trustless transactions here?
sr. member
Activity: 266
Merit: 250
Happy to help Smiley

According to the documentation listreceivedbyaddress{0,true} will provide a list of all the addresses in the wallet.  In testing I discovered this wasn't accurate however as change addresses were not included even if they held a balance.  So I do that first, and then run a second pass with listunspent to grab any missing addresses.

FYI if the user has to have bitcoind installed that's all that's required to use my library if you wanted to go that route.  The library already has a mlib.getaddresses function to enumerate all addresses in the connected wallet with the above method (just returns a string array of addresses).  I'm not sure if that's in the old version but I'll be pushing my new v2 library up to git this weekend anyway Smiley


Excellent.  Getaddresses is what i'm looking for (i'm now integrating it with my wallet, hope to be ready for testing next week =).    

I still have some final touches before I push up to git, but here's a very brief description for you I quickly put together while we're on the topic.

Have to head off now but I'll be back tomorrow Smiley

Masterchest Library, a 2 minute overview:

EDIT: Please see a couple of posts down.
legendary
Activity: 1666
Merit: 1010
he who has the gold makes the rules
Pages:
Jump to: