Pages:
Author

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

sr. member
Activity: 449
Merit: 250
Thanks, that worked! Your feed is not valid JSON yet however. Strings and keys need to be surrounded in quotes, I think it should be valid after that.

You can always check your feed using: http://jsonlint.com/

Ok json is validated.
sr. member
Activity: 462
Merit: 250
Hi guys, quick question on the distributed exchange: as Mastercoin is becoming much more valuable now, is there a way to create buy and sell offers from a totally "offline" machine?

I was planning on moving to an offline armory-based setup (with cheapo laptop with no internet connection) for BTC, and wanted to use this same kind of setup with MSC as well...i.e. comprise the trade on the offline machine (that has wallet.dat), then sneakernet/email some trade code/key/trade token to the connected machine to actually input into the MSC network (that does not have wallet.dat). It seems that currently one can not do simple sends with an offline setup like this (from my own experimentation), but I wanted to check on the distributed exchange features.

If this is not possible, then any ideas when someone may get around to it? If MSC raises another 10-30x, you'll have several MSC millionaires in the bunch. If I was one of those guys, I'd be very concerned with doing any trades out of a wallet connected to the internet.

I am no expert on Armory but I believe it can sign raw transactions. If this is indeed the case you can use mastercoin-explorer.com to create the offers then sign the raw transactions with your own client and relay them through Eligius or Blockhain.info. I also have plans to implement seedless addresses into my wallet software but that's a long term plan. This can be used right now.

Thank you, I am getting an offline system in a few days and will try that out. I'll document whatever works and send it to Ron to make part of the FAQ.
hero member
Activity: 938
Merit: 1000
Thanks, that worked! Your feed is not valid JSON yet however. Strings and keys need to be surrounded in quotes, I think it should be valid after that.

You can always check your feed using: http://jsonlint.com/
sr. member
Activity: 449
Merit: 250
I wouldn't want to make an exception for just one message, it needs to be protocol wide if we want to even consider this.

FYI: I made a small change to the Verification Spec; I changed the url from mastercoin-verify to mastercoin_verify. I also tried checking out your urls but http://mymastercoins.com/jtransaction.aspx?Address=1QF9Hag3nyjAcXRd6mFrL5KyM3r71hVu2T doesn't seem to work.

My verification API is online.

http://mastercoin-explorer.com/mastercoin_verify/addresses
http://mastercoin-explorer.com/mastercoin_verify/transactions/17UDyggWFP6T3tUPTUEHMU8gxRtLZHG322

As soon as I have some tools available I will create a small comparison service.

I now got your idea. Your delay 1 block will work to fix this issue.


Try (missing  s)
http://mymastercoins.com/jtransactions.aspx?Address=1QF9Hag3nyjAcXRd6mFrL5KyM3r71hVu2T
hero member
Activity: 938
Merit: 1000
I wouldn't want to make an exception for just one message, it needs to be protocol wide if we want to even consider this.

FYI: I made a small change to the Verification Spec; I changed the url from mastercoin-verify to mastercoin_verify. I also tried checking out your urls but http://mymastercoins.com/jtransaction.aspx?Address=1QF9Hag3nyjAcXRd6mFrL5KyM3r71hVu2T doesn't seem to work.

My verification API is online.

http://mastercoin-explorer.com/mastercoin_verify/addresses
http://mastercoin-explorer.com/mastercoin_verify/transactions/17UDyggWFP6T3tUPTUEHMU8gxRtLZHG322

As soon as I have some tools available I will create a small comparison service.
sr. member
Activity: 449
Merit: 250
Something has been bothering me when coding up my Mastercoin implementation these last few weeks. There is one thing in the spec that makes coding up Mastercoin implementations a lot harder and, because of this, less reliable then it has to be.

The position of a certain transaction in a given block. You constantly have to do two separate checks, 'is there a transaction in this block that has a position lower then the current one that can influence this message?' if not 'query all previous blocks for the information' that you need. It also contributes to the 'random chance' effect I already spoke about. Depending on the position of your transaction in a given block it might be either invalid or valid.

I hate chance, and I would like to eliminate it as a factor for Mastercoin.

My proposal would make everything a lot cleaner and easier to work with but would introduce a 1 block lag.

Current situation
User A creates a 'Selling Offer' of 1 MSC for 0.1 BTC in block 25
User B creates a 'Purchase Offer' of this 1 MSC while User A modifies it's original order to now sell 1 MSC for 0.9 MSC. Both transactions end up in block 26 but the modified 'Selling offer' ends up above the 'Purchase Offer'.

If user B still wants to buy user a's offer he now needs to pay 0.9 while if luck was different he could have paid 0.1 BTC.

Artificial 1 Block lag
User A creates a 'Selling Offer' of 1 MSC for 0.1 BTC in block 25
User B creates a 'Purchase Offer' of this 1 MSC while User A modifies it's original order to now sell 1 MSC for 0.9 MSC. Both transactions end up in block 26.

However to get all information this time we skip checking the current block and only look at what happend before this block. The offer gets matched up to the original one regardless of which position the changed 'Selling Offer' ended up with.

I understand if this is a controversial topic but I want to bring it up anyway because I really believe this will make everything better. 


We can give priority to purchase offer over selling offer is they have the same block time.
That way user b will get the price at .1
hero member
Activity: 938
Merit: 1000
Something has been bothering me when coding up my Mastercoin implementation these last few weeks. There is one thing in the spec that makes coding up Mastercoin implementations a lot harder and, because of this, less reliable then it has to be.

The position of a certain transaction in a given block. You constantly have to do two separate checks, 'is there a transaction in this block that has a position lower then the current one that can influence this message?' if not 'query all previous blocks for the information' that you need. It also contributes to the 'random chance' effect I already spoke about. Depending on the position of your transaction in a given block it might be either invalid or valid.

I hate chance, and I would like to eliminate it as a factor for Mastercoin.

My proposal would make everything a lot cleaner and easier to work with but would introduce a 1 block lag.

Current situation
User A creates a 'Selling Offer' of 1 MSC for 0.1 BTC in block 25
User B creates a 'Purchase Offer' of this 1 MSC while User A modifies it's original order to now sell 1 MSC for 0.9 MSC. Both transactions end up in block 26 but the modified 'Selling offer' ends up above the 'Purchase Offer'.

If user B still wants to buy user a's offer he now needs to pay 0.9 while if luck was different he could have paid 0.1 BTC.

Artificial 1 Block lag
User A creates a 'Selling Offer' of 1 MSC for 0.1 BTC in block 25
User B creates a 'Purchase Offer' of this 1 MSC while User A modifies it's original order to now sell 1 MSC for 0.9 MSC. Both transactions end up in block 26.

However to get all information this time we skip checking the current block and only look at what happend before this block. The offer gets matched up to the original one regardless of which position the changed 'Selling Offer' ended up with.

I understand if this is a controversial topic but I want to bring it up anyway because I really believe this will make everything better.  

Opinions!?
hero member
Activity: 938
Merit: 1000
It seems you might have misunderstood what a distributed exchange means. In this case it's not a place you go to exchange. It's a feature of Mastercoin build into the protocol. In order to sell/buy coins you need to send a crafted Mastercoin message with information on what you want to buy/sell. These wallets you talk about offer to do this for you and thus implement the distributed exchange functionality. 
sr. member
Activity: 280
Merit: 257
bluemeanie
Time to buy some MSC:

Smiley

ok where exactly is it explained as to how you will construct this Distributed Exchange?

it seems the winners of this Distributed Exchange contest are making anything but a Distributed Exchange. (appears to be wallets and other tools analogous to past Color Coin efforts).

if you have a Distributed Exchange, I would be very interested to see what you have done.

Please provide some information.  Thanks.
sr. member
Activity: 449
Merit: 250
MyMastercoins.com

Here are the JSON files based on Tachikoma's API
http://mymastercoins.com/jaddress.aspx
http://mymastercoins.com/jtransactions.aspx?Address=$AddressHere


The default CurrencyID=1.   You can place &CurrencyID=2 for Test MSC.

PS.  I'm still working on the URL rewrite.
sr. member
Activity: 462
Merit: 250
I'm already writing an rspec test-suite for my Rails implementation. It won't have 100% coverage but it will give you a good explanation of what to test for and how to implement it.

My implementation is based on Bitcoin-ruby, Zathras uses Bitcoin and Grazcoin Obelisk, loads of different backends Smiley

Sounds great. Maybe it may make sense for your test suite cases to be standardized at some level eventually (and possibly maintained independently), so that other library implementations can use those same test cases. That would make debugging differences between implementations (and their bugs) more apples-to-apples, and give a good "baseline" point for new library/backend implementations.

hero member
Activity: 938
Merit: 1000
I'm already writing an rspec test-suite for my Rails implementation. It won't have 100% coverage but it will give you a good explanation of what to test for and how to implement it.

My implementation is based on Bitcoin-ruby, Zathras uses Bitcoin and Grazcoin Obelisk, loads of different backends Smiley
sr. member
Activity: 462
Merit: 250
I've just send a pull request on Github for the verification API. I've added one more thing and that's supplying the currency_id you want to see the data on. Easiest way to read the text is not via the PR but via this direct link. As always please discuss the specification in the pull request itself to keep the discussion centralised.

An idea: this API should be a great start for web-based MSC packages, but as at least I see the base MSC parsing libraries (such as mastercoin-tools maybe) being the base of the implementation, wouldn't it be good to add a unit test suite to them? Or are these various web tools currently using their own MSC parser implementations at this time?

I'm wondering what everyone's thought is to these multiple implementations of the MSC spec... eventually a good idea may be to code a reference implementation up in C/C++, which can then be brought up into higher level language libraries (in Ruby/Python/Java/C#, etc) using tools like swig/FFI/Cython, etc to prevent having to duplicate the "guts" of the protocol for each separate language. Maybe this was the idea behind mastercoin-tools and pymastercoin, etc eventually...??

Even the above would not be necessary if there was a standard "test suite" list of test scenarios published, which each MSC parser library implementation would build a scripted unit test suite against. Then, as various "gotchas" were caught that fell through the cracks of the test suite, it could be enhanced to cover those, as well as giving additional test scenarios for new features as they are built in and implemented across the various libraries. The pass rate on this standard list of test scenarios would denote the overall quality of the library, and keep functionality consistent across languages, sites, etc. "Certified status" could even be awarded by the Mastercoin foundation to implementations that consistently have a pass rate > X%.

I think this is in the spirit of what Tachikoma is trying to do, but not every MSC tool is web-based, with a web-based API.

Just a thought...
hero member
Activity: 938
Merit: 1000
I've just send a pull request on Github for the verification API. I've added one more thing and that's supplying the currency_id you want to see the data on. Easiest way to read the text is not via the PR but via this direct link. As always please discuss the specification in the pull request itself to keep the discussion centralised.
hero member
Activity: 938
Merit: 1000
Yes, I believe so. I haven't started building it myself so I can't be 100% sure but it looks valid enough! Smiley

Can you also use a mod-rewrite like solution to get a proper url?
sr. member
Activity: 449
Merit: 250
Mastercoin web-services verification API proposal.

GET /mastercoin-verify/addresses

Code:
[{address: 1KZmDQGzGJWYmPP9X3b7TA9dY91KBXgaG4, balance: 20.1}, {address: 1Q1sFqsi8S5DxV5hz6sWLamGBp9To93iG7, balance: 3.1}, etc..]


Hi Tachikoma,

Will this json work?
http://mymastercoins.com/MSCJSON.aspx
legendary
Activity: 1358
Merit: 1003
Ron Gross
I just wanted to drop a note here congratulating Ron Gross (ripper234) on volunteering to commit his full time efforts as the Executive Director for the Mastercoin Foundation (unanimously confirmed by the Board).

As many of you know and J.R. has stated here before, the Mastercoin Foundation has been searching for someone to take the Executive Director role for the last 70 days since the Exodus Address period finished.

This emerged organically as Ron began spending more and more of his time on the Mastercoin Project, after having participated in the Exodus Address and being very active in the community. I've witnessed first hand Ron passionately spread the word to many early adopters, host the very first Mastercoin meetup, actively recruit additional developers, advocate for improvements to the protocol including the Proof of Stake system / Contracts For A Difference, and get the Mastercoin protocol officially up on Github.

Thanks Ron for committing your time, energy and talents to this extremely important project for all of us in the Bitcoin / Mastercoin community.

David A. Johnston - Executive Director of BitAngels.co and Board Member of the Mastercoin Foundation

P.S. All the developers on this thread are awesome! I check in about once a day and I'm constantly blown away by the progress and how fast things are moving forward. Its not said often enough, so let me just state for the record, "You guys are rock stars".

Thanks a lot David!

My reply

http://pastebin.com/V1D8f2Hi
hero member
Activity: 938
Merit: 1000
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.

I would like to start out simple with just two API calls which return valid JSON files.

Terrific proposal Tachikoma!
I haven't delved into the technicals, but I love how we distribute and standardize even our QA processes.
This should be in the spec. Submit a pull request?

Actually taking a second glance at this I can just use a URL rewrite mod so shouldn't be a problem Smiley

Awesome. I will submit a pull request later today.
legendary
Activity: 1358
Merit: 1003
Ron Gross
Fantastic Smiley  Congrats & Thanks Ron.

I think I just noticed your profile photo for the first time.
WE ALL LOVE ZATHRAS!!!
sr. member
Activity: 266
Merit: 250
I just wanted to drop a note here congratulating Ron Gross (ripper234) on volunteering to commit his full time efforts as the Executive Director for the Mastercoin Foundation (unanimously confirmed by the Board).

As many of you know and J.R. has stated here before, the Mastercoin Foundation has been searching for someone to take the Executive Director role for the last 70 days since the Exodus Address period finished.

This emerged organically as Ron began spending more and more of his time on the Mastercoin Project, after having participated in the Exodus Address and being very active in the community. I've witnessed first hand Ron passionately spread the word to many early adopters, host the very first Mastercoin meetup, actively recruit additional developers, advocate for improvements to the protocol including the Proof of Stake system / Contracts For A Difference, and get the Mastercoin protocol officially up on Github.

Thanks Ron for committing your time, energy and talents to this extremely important project for all of us in the Bitcoin / Mastercoin community.

David A. Johnston - Executive Director of BitAngels.co and Board Member of the Mastercoin Foundation

P.S. All the developers on this thread are awesome! I check in about once a day and I'm constantly blown away by the progress and how fast things are moving forward. Its not said often enough, so let me just state for the record, "You guys are rock stars".

Fantastic Smiley  Congrats & Thanks Ron.

As to the specific approach I'd need to have a think about this (as currently for my implementations you would use GET ......./whatever.aspx?parameter=value rather than GET ...../parameter/value).

If creating custom urls is a problem for you we can just do the discovery method. I'm guessing creating a mastercoin.txt file in your root is possible? If so we can have a json file there that has two keys.

Code:
{addresses_index: {method: "get", url: "/mastercoin-verify/addresses"}, transaction_lookup: {method: "get", url: "/mastercoin-verify/transactions/", parameter: "id"}}

This would tell the API where and how to query the data. The transaction lookup would become /mastercoin-verify/transactions?id=addresssuppliedhere.

Would this work for everybody?

Actually taking a second glance at this I can just use a URL rewrite mod so shouldn't be a problem Smiley
Pages:
Jump to: