Bitcoin Forum
November 05, 2024, 04:35:29 AM *
News: Latest Bitcoin Core release: 28.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 129199 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.
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 20, 2013, 09:15:59 AM
 #561

Updated MyMastercoins.com 

Added explanation why a transaction is invalid
http://mymastercoins.com/Transactions.aspx

Allow partial payment of Purchase Offer.

Generate MSC Dev coins for the Exodus Address.
7,966.90477835 Generated Coins MSC Dev Funds as of 11/20/2013 9:00:07 AM
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 20, 2013, 09:23:06 AM
 #562

If you're using blockchain.info have a look at http://blockchain.info/unspent?active=$address - I could (fairly) easily give you a new function in the library that only returns the transaction hex for the vouts (ie the juicy multisig bits - which can be done offline, no need for bitcoind/qt).

You could construct the first part of the transaction hex (vins) using the info from blockchain.info's unspent API and then put the two together prior to signing.

Without looking at what you're trying to do further I don't know if this will help, but just a thought Smiley

Thanks Zathras.  I did that a while ago and it worked.   But now blockchain doesn't support "signrawtransaction".  So i'm stuck again.


I'll try to download the entire bitcoin blockchain (with  my slow internet speed it will take days) then test rpc calls on it.

 
zathras
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
November 20, 2013, 10:48:51 AM
 #563

If you're using blockchain.info have a look at http://blockchain.info/unspent?active=$address - I could (fairly) easily give you a new function in the library that only returns the transaction hex for the vouts (ie the juicy multisig bits - which can be done offline, no need for bitcoind/qt).

You could construct the first part of the transaction hex (vins) using the info from blockchain.info's unspent API and then put the two together prior to signing.

Without looking at what you're trying to do further I don't know if this will help, but just a thought Smiley
Thanks Zathras.  I did that a while ago and it worked.   But now blockchain doesn't support "signrawtransaction".  So i'm stuck again.

I'll try to download the entire bitcoin blockchain (with  my slow internet speed it will take days) then test rpc calls on it.

If you're sitting on a slow connection you could spin up a free instance over on AWS (Amazon), run bitcoind there and make your RPC calls to it through an SSH tunnel.  That way you don't need to download anything over your own connection.  Just remember to only keep a small amount of test funds there Smiley

Smart Property & Distributed Exchange: Master Protocol for Bitcoin
djohnston
Member
**
Offline Offline

Activity: 114
Merit: 10


View Profile WWW
November 21, 2013, 08:48:03 PM
 #564

I've just posted a separate thread detailing my proposal to "Standardize the Distribution Rate of Dev MSC via the MSC Protocol"

I hope anyone that wants to discuss this topic will come over to this thread and offer me their feedback.

https://bitcointalk.org/index.php?topic=342431.0

Partial Sneak Peak of my post:

I propose we formalize the distribution of "Dev MSC", to mirror the amount of Dev MSC generated each month. Further more that these Dev MSC be distributed in proportion to the amount of BTC won by participants in Mastercoin bounties that month. With the intension being, that this distribution process will be fully controlled by the Mastercoin community via the existing Bounty system and up coming Proof of Stake voting.

Lets talk some simple math here.

Simple Dev MSC Distribution Equation:  A / B = C * D = E
(A) Amount of awards an individual earns in BTC during a 30 day period, divided by,
(B) the total amount of BTC awarded during that 30 day period, equals
(C) his or her individual award percentage, times
(D) the total Dev MSC generated during that 30 day period, equals
(E) the amount of Dev MSC awarded to the individual in addition to his BTC awards during the 30 day period.

Example #1 (using round numbers):
A (100 BTC) / B (1,000 BTC) = C (10%) * D (1,000 MSC) = E (100 MSC)

There are 56,316 Dev MSC that will ever be generated.
28,158 Dev MSC will be generated this year or 2,346 MSC each month.
So if a developer won 10% of the bounties this month he or she would earn 234.6 Dev MSC (worth 35.19 BTC / $24,633 USD at current MSC / BTC / USD prices).

“The state is that great fiction by which everyone tries to live at the expense of everyone else.” ― Frédéric Bastiat
prophetx
Legendary
*
Offline Offline

Activity: 1666
Merit: 1010


he who has the gold makes the rules


View Profile WWW
November 21, 2013, 09:14:12 PM
 #565

For all GITHUB Repo owners:

Please make sure that you have "mastercoin" somewhere in the "description" field.  We need this so that when someone does a search for mastercoin that your repo will come up. 

Some of the repo's do not have that right now and therefore might not be getting exposed to potential developers or users.

Particularily if your repo is called masterchest or masterchain, it might not be hitting this search:

https://github.com/search?q=mastercoin

thanks!!

dacoinminster (OP)
Legendary
*
Offline Offline

Activity: 1260
Merit: 1031


Rational Exuberance


View Profile WWW
November 21, 2013, 11:15:19 PM
 #566

As David said, please go comment on that thread. Also, I'll post this here for convenience:

The board isn't in complete agreement about this, which is why we're bringing this before the community. My own opinion is that we should use the plan described above, but keep 50% of the dev MSC in reserve for unexpected expenses, eventually turning the bulk of this money over to a distributed bounty system which will run on the MSC protocol using proof-of-stake voting without a central administrator.

I think we should also do these distributions every time we pay a major bounty, rather than once per month, since some major milestones last for more than a month and it may not be clear who should get what halfway through a major initiative.

Part of what we are trying to accomplish here is to get a couple devs to quit their day-jobs by overwheming them with money Smiley I'd love to hear from some of you what that would require.

I need an email address from zathras and grazcoin still, per my PMs to the devs. We want to be able to reach you guys by email and copy you on other emails that may interest you. Also, we want to figure out what it would take to get some of you to quit your day jobs. Smiley

Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 22, 2013, 09:51:29 AM
 #567


If you're sitting on a slow connection you could spin up a free instance over on AWS (Amazon), run bitcoind there and make your RPC calls to it through an SSH tunnel.  That way you don't need to download anything over your own connection.  Just remember to only keep a small amount of test funds there Smiley


Thank you Zathras,
I'm able to run bitcoind.exe on the amazon aws.   

Is there a method in bitcoind.exe to list all address in a wallet?  I'm think of getting all the bitcoin address of a wallet then getting the MSC transactions from mymastercoins.com.   This will make it a "semi-thin" client  (because the user still has to have bitcoind installed).   

     
zathras
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
November 22, 2013, 10:05:30 AM
 #568


If you're sitting on a slow connection you could spin up a free instance over on AWS (Amazon), run bitcoind there and make your RPC calls to it through an SSH tunnel.  That way you don't need to download anything over your own connection.  Just remember to only keep a small amount of test funds there Smiley


Thank you Zathras,
I'm able to run bitcoind.exe on the amazon aws.  

Is there a method in bitcoind.exe to list all address in a wallet?  I'm think of getting all the bitcoin address of a wallet then getting the MSC transactions from mymastercoins.com.   This will make it a "semi-thin" client  (because the user still has to have bitcoind installed).  

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


Smart Property & Distributed Exchange: Master Protocol for Bitcoin
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 22, 2013, 10:34:59 AM
 #569

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 =).     
prophetx
Legendary
*
Offline Offline

Activity: 1666
Merit: 1010


he who has the gold makes the rules


View Profile WWW
November 22, 2013, 10:51:40 AM
 #570

CALLING ALL WRITERS: MASTERCOIN DOCUMENTATION CONTEST – $5000 BOUNTY

https://bitcointalk.org/index.php?topic=336454.msg3610871#msg3610871

http://blog.mastercoin.org/2013/11/22/calling-all-writers-mastercoin-documentation-contest-bounty/
zathras
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
November 22, 2013, 11:16:42 AM
Last edit: November 24, 2013, 11:20:33 AM by zathras
 #571

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.

Smart Property & Distributed Exchange: Master Protocol for Bitcoin
marcelus
Sr. Member
****
Offline Offline

Activity: 297
Merit: 250


View Profile
November 22, 2013, 05:56:26 PM
 #572

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?
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
November 23, 2013, 08:45:31 AM
 #573

Explain?

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
zathras
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
November 24, 2013, 11:19:15 AM
 #574

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

Smart Property & Distributed Exchange: Master Protocol for Bitcoin
prophetx
Legendary
*
Offline Offline

Activity: 1666
Merit: 1010


he who has the gold makes the rules


View Profile WWW
November 24, 2013, 12:53:28 PM
 #575

would it be helpful for you all to have a dev chat server?  IRC or any preferences

Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
November 24, 2013, 01:00:39 PM
 #576

We already have #mastercoin on freenode Smiley

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 24, 2013, 04:37:25 PM
Last edit: November 24, 2013, 05:00:10 PM by Bitoy
 #577

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
}
 
]
}


Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
November 24, 2013, 04:44:17 PM
 #578

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.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
Bitoy
Sr. Member
****
Offline Offline

Activity: 449
Merit: 250


View Profile
November 24, 2013, 05:16:42 PM
 #579

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.
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
November 24, 2013, 05:40:55 PM
 #580

My implementation has 9.6028 (out of a total 10) sold. That's quite a big difference. How about you Zathras?

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
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!