Pages:
Author

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

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

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

sr. member
Activity: 449
Merit: 250

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

     
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
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
legendary
Activity: 1666
Merit: 1010
he who has the gold makes the rules
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!!

member
Activity: 114
Merit: 10
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://bitcointalksearch.org/topic/proposal-for-standardizing-the-distribution-rate-of-dev-msc-via-the-msc-protocol-342431

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

 
sr. member
Activity: 449
Merit: 250
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
legendary
Activity: 1106
Merit: 1026
while updating my parsing for less standard tx, I see BIP11->BIP11 tx like:
https://blockchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
We never really said anything about more complicated addresses holding MSC (e.g. BIP11 or BIP16).
Until we say otherwise, I suggest that invalidate these tx:
http://masterchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf.json

That's how you parse it:
https://masterchest.info/lookuptx.aspx?txid=6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
http://mastercoin-explorer.com/transactions/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf

Respecting these addresses is not too difficult, so it is mainly a decision issue.

Hi,

I made those tx as a test, because I was looking into ways to reduce transportation cost for the faucet, but switched over to regular multisig tx, because they were marked as invalid on mastercoin-explorer, if I recall correctly.

But I noticed that all outgoing transactions of 14hm8rTdknVCDpqXGY5nFqVWruU9UBeuHd are rendered as invalid on mastercoin-explorer.com since some hours:

http://mastercoin-explorer.com/addresses/14hm8rTdknVCDpqXGY5nFqVWruU9UBeuHd

mastercoin.info and masterchest.info still declare them as valid.

Is this in anyway connected? The above quoted tx are derived from this address.
sr. member
Activity: 266
Merit: 250

You are of course welcome to use any of my code (though I'll need to push up the latest version of the library, it's out of date on git).  With that said though, I don't think it's going to help you in this case.  My library depends on a bitcoind/qt instance to loop through the unspent outputs for a given address and select inputs to use as vins for the send transaction.  It's not really suited to a thin client.

I had intended to modify my wallet to support thin client functionality way, way down the track - it's not high on my priority list though (since Tachikoma has taken point on thin client to date) - my primary focus is on a local implementation with no centralized source of truth for now.  Once we all have compatible APIs (and thus multiple sources of truth) thin client functionality will likely get pushed up my priority list more.

Thanks! Smiley

Thank you for the heads up. My only problem now is how to send a multisig (rpc).   

Agreed, once we have compatible api we can easily check double check transactions. 

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
sr. member
Activity: 449
Merit: 250
For a brief moment yesterday - the bounty on this coding contest exceeded $270,000 in value.  That is far more than JR originally anticipated (around Aug 10) would be spend on the entire project - start-to-finish.  Glad you guys are working hard on this.  You sure are going to earn one hell of a lot of money.  

Yes, crazy bitcoin price the last few days.  Now coding contest is around 150k. That is still a lot of money Smiley
sr. member
Activity: 449
Merit: 250

You are of course welcome to use any of my code (though I'll need to push up the latest version of the library, it's out of date on git).  With that said though, I don't think it's going to help you in this case.  My library depends on a bitcoind/qt instance to loop through the unspent outputs for a given address and select inputs to use as vins for the send transaction.  It's not really suited to a thin client.

I had intended to modify my wallet to support thin client functionality way, way down the track - it's not high on my priority list though (since Tachikoma has taken point on thin client to date) - my primary focus is on a local implementation with no centralized source of truth for now.  Once we all have compatible APIs (and thus multiple sources of truth) thin client functionality will likely get pushed up my priority list more.

Thanks! Smiley

Thank you for the heads up. My only problem now is how to send a multisig (rpc).   

Agreed, once we have compatible api we can easily check double check transactions. 
hero member
Activity: 874
Merit: 1000
For a brief moment yesterday - the bounty on this coding contest exceeded $270,000 in value.  That is far more than JR originally anticipated (around Aug 10) would be spend on the entire project - start-to-finish.  Glad you guys are working hard on this.  You sure are going to earn one hell of a lot of money.  
sr. member
Activity: 266
Merit: 250
while updating my parsing for less standard tx, I see BIP11->BIP11 tx like:
https://blockchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
We never really said anything about more complicated addresses holding MSC (e.g. BIP11 or BIP16).
Until we say otherwise, I suggest that invalidate these tx:
http://masterchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf.json

That's how you parse it:
https://masterchest.info/lookuptx.aspx?txid=6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
http://mastercoin-explorer.com/transactions/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf

Respecting these addresses is not too difficult, so it is mainly a decision issue.


I agree we should invalidate for now.  I'll add some code to invalidate these.

Since we allow only one sell offer for an address, we could consider only one purchase offer for an address to simplify the protocol.
I don't see a real reason to complicate the logic here too much, so if we do keep multiple purchase offer option, let it follow the basic rules, ignoring the fact that these are purchase orders from the same address.

I completely agree with Grazcoin on this one. There is enough difficult logic already involved even without making things harder to parse. We should keep it as simple as possible and add more interesting options when we mature enough.

My view sits with Grazcoin and Tachikoma, we're complex enough already.  Future revisions can add features to the base implementation, but we need to walk before we run.

Hi Zathras,

Can you post again how to send a multisig using your library (You posted this before but I can't find it =).

Thanks.

(I'm trying to build a thin client windows wallet rpc blockchain.info but blockchain.info doesn't support "listunspent".  )  

You are of course welcome to use any of my code (though I'll need to push up the latest version of the library, it's out of date on git).  With that said though, I don't think it's going to help you in this case.  My library depends on a bitcoind/qt instance to loop through the unspent outputs for a given address and select inputs to use as vins for the send transaction.  It's not really suited to a thin client.

I had intended to modify my wallet to support thin client functionality way, way down the track - it's not high on my priority list though (since Tachikoma has taken point on thin client to date) - my primary focus is on a local implementation with no centralized source of truth for now.  Once we all have compatible APIs (and thus multiple sources of truth) thin client functionality will likely get pushed up my priority list more.

Thanks! Smiley
sr. member
Activity: 449
Merit: 250
Hi Zathras,

Can you post again how to send a multisig using your library (You posted this before but I can't find it =).

Thanks.


(I'm trying to build a thin client windows wallet rpc blockchain.info but blockchain.info doesn't support "listunspent".  )   
sr. member
Activity: 449
Merit: 250
-1
This is not according to the contract that the seller offered.
If the buyer already sees that he might be late - he better not send the tx (and lose only the fee).
No need to complicate further the already complicated distributed exchange rules.


Since we allow only one sell offer for an address, we could consider only one purchase offer for an address to simplify the protocol.
I don't see a real reason to complicate the logic here too much, so if we do keep multiple purchase offer option, let it follow the basic rules, ignoring the fact that these are purchase orders from the same address.


I agree with you on simplifying the system.  Allowing only one purchase offer for an address per currency.

hero member
Activity: 938
Merit: 1000
I propose the following for specifying how an unexpected purchase offer should function:

Late payment:

  • User A broadcasts a sell offer, 1 MSC @ 0.2 MSC/BTC, time of 10 blocks
  • User B broadcasts a purchase offer for 1 MSC at @0.2 MSC/BTC
  • User B stars at the BTCChina charts for a couple hours, finally remembers his purchase offer, and broadcasts his payment which gets confirmed in block 12.

The transaction is valid because even though the payment was late, no other purchase offers had been confirmed in the time between blocks 10 and 12. Had a purchase offer been confirmed in block 12 as well, the transaction still would have been valid because a payment transaction moves value, not information. The circumstances under which a late payment wouldn't be valid are if 1.) a different valid purchase offer was confirmed in block 11 (because it's greater than 10, less than 12), 2.) the sell offer has been completely filled.


-1
This is not according to the contract that the seller offered.
If the buyer already sees that he might be late - he better not send the tx (and lose only the fee).
No need to complicate further the already complicated distributed exchange rules.


Multiple payments and of incorrect size

  • User A broadcasts a sell offer, 1 MSC @ 0.2 MSC/BTC, time of 10 blocks
  • User B broadcasts a purchase offer for 0.6 MSC at @0.2 MSC/BTC
  • User B broadcasts a purchase offer for 0.25 MSC at @0.2 MSC/BTC
  • Both of user B's purchase offers are confirmed in block 3, and are valid.
  • User B broadcasts a payment transaction of 0.1 BTC which is confirmed and valid in block 5 - receives 0.5 MSC
  • User B broadcasts a payment transaction of 0.07 BTC which is confirmed and valid in block 6 - receives 0.25 MSC

The first payment transaction of 0.1 BTC was valid despite not completely filling the purchase offer for 0.6 MSC. This is because payments must be able to accumulate up to the value specified in the purchase offer. The second payment was valid, however user B lost some BTC because a payment exceeding the value remaining on a purchase offer will not "roll over" to any other open purchase offers. The 0.25 MSC purchase offer was filled with the payment of 0.07 BTC. The purchase offer that has the larger value remaining to be purchased should be filled in these circumstances, to as to minimize lost BTC.

Just as payment transactions are cumulative, so are purchase offers. Two (or more) purchase offers from the same person may be "active" at the same time. There's no guarantee that one will be confirmed before the other - once broadcast it's out of your hands. If "latest one counts" then this requires an association of data across multiple purchase offers, in different blocks, and is drastically more complicated than treating them as just separate purchase offers. Also, it brings up questions like: If 2 purchase offers from the same address are confirmed in different blocks, but within the time range does this extend the reservation out?


Since we allow only one sell offer for an address, we could consider only one purchase offer for an address to simplify the protocol.
I don't see a real reason to complicate the logic here too much, so if we do keep multiple purchase offer option, let it follow the basic rules, ignoring the fact that these are purchase orders from the same address.


I completely agree with Grazcoin on this one. There is enough difficult logic already involved even without making things harder to parse. We should keep it as simple as possible and add more interesting options when we mature enough.

while updating my parsing for less standard tx, I see BIP11->BIP11 tx like:
https://blockchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
We never really said anything about more complicated addresses holding MSC (e.g. BIP11 or BIP16).
Until we say otherwise, I suggest that invalidate these tx:
http://masterchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf.json

That's how you parse it:
https://masterchest.info/lookuptx.aspx?txid=6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
http://mastercoin-explorer.com/transactions/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf

Respecting these addresses is not too difficult, so it is mainly a decision issue.

I agree with you on this mainly because I don't want to spend anytime going back to the beginning to support this one edge-case. We can add support for those addresses in later.
sr. member
Activity: 284
Merit: 250
I propose the following for specifying how an unexpected purchase offer should function:

Late payment:

  • User A broadcasts a sell offer, 1 MSC @ 0.2 MSC/BTC, time of 10 blocks
  • User B broadcasts a purchase offer for 1 MSC at @0.2 MSC/BTC
  • User B stars at the BTCChina charts for a couple hours, finally remembers his purchase offer, and broadcasts his payment which gets confirmed in block 12.

The transaction is valid because even though the payment was late, no other purchase offers had been confirmed in the time between blocks 10 and 12. Had a purchase offer been confirmed in block 12 as well, the transaction still would have been valid because a payment transaction moves value, not information. The circumstances under which a late payment wouldn't be valid are if 1.) a different valid purchase offer was confirmed in block 11 (because it's greater than 10, less than 12), 2.) the sell offer has been completely filled.


-1
This is not according to the contract that the seller offered.
If the buyer already sees that he might be late - he better not send the tx (and lose only the fee).
No need to complicate further the already complicated distributed exchange rules.


Multiple payments and of incorrect size

  • User A broadcasts a sell offer, 1 MSC @ 0.2 MSC/BTC, time of 10 blocks
  • User B broadcasts a purchase offer for 0.6 MSC at @0.2 MSC/BTC
  • User B broadcasts a purchase offer for 0.25 MSC at @0.2 MSC/BTC
  • Both of user B's purchase offers are confirmed in block 3, and are valid.
  • User B broadcasts a payment transaction of 0.1 BTC which is confirmed and valid in block 5 - receives 0.5 MSC
  • User B broadcasts a payment transaction of 0.07 BTC which is confirmed and valid in block 6 - receives 0.25 MSC

The first payment transaction of 0.1 BTC was valid despite not completely filling the purchase offer for 0.6 MSC. This is because payments must be able to accumulate up to the value specified in the purchase offer. The second payment was valid, however user B lost some BTC because a payment exceeding the value remaining on a purchase offer will not "roll over" to any other open purchase offers. The 0.25 MSC purchase offer was filled with the payment of 0.07 BTC. The purchase offer that has the larger value remaining to be purchased should be filled in these circumstances, to as to minimize lost BTC.

Just as payment transactions are cumulative, so are purchase offers. Two (or more) purchase offers from the same person may be "active" at the same time. There's no guarantee that one will be confirmed before the other - once broadcast it's out of your hands. If "latest one counts" then this requires an association of data across multiple purchase offers, in different blocks, and is drastically more complicated than treating them as just separate purchase offers. Also, it brings up questions like: If 2 purchase offers from the same address are confirmed in different blocks, but within the time range does this extend the reservation out?


Since we allow only one sell offer for an address, we could consider only one purchase offer for an address to simplify the protocol.
I don't see a real reason to complicate the logic here too much, so if we do keep multiple purchase offer option, let it follow the basic rules, ignoring the fact that these are purchase orders from the same address.
sr. member
Activity: 284
Merit: 250
while updating my parsing for less standard tx, I see BIP11->BIP11 tx like:
https://blockchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
We never really said anything about more complicated addresses holding MSC (e.g. BIP11 or BIP16).
Until we say otherwise, I suggest that invalidate these tx:
http://masterchain.info/tx/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf.json

That's how you parse it:
https://masterchest.info/lookuptx.aspx?txid=6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf
http://mastercoin-explorer.com/transactions/6d68b101c8b92b38c02595a084aa5c8b0308c4f2f5714070d7656251075dbbcf

Respecting these addresses is not too difficult, so it is mainly a decision issue.

Pages:
Jump to: