Giter Site home page Giter Site logo

Class A P&D clarification about spec HOT 9 CLOSED

omnilayer avatar omnilayer commented on June 30, 2024
Class A P&D clarification

from spec.

Comments (9)

 avatar commented on June 30, 2024

Related question: Is there a preferred method of parsing the blockchain to look for these sequence numbers? The naive implementation would probably be quite slow, so I was hoping someone had figured out a fast parser so I wouldn't lose sleep over it.

from spec.

maran avatar maran commented on June 30, 2024

I think that question does not belong here. The answer is too specific to each implementation anyway. I just retrieve the tx and the according outputs directly via a query to bitcoin-ruby.

from spec.

grazcoin avatar grazcoin commented on June 30, 2024

Thank you for the pull request. A clarification is indeed essential.

Level 1 should be according to the original set of rules
https://bitcointalk.org/index.php?topic=265488.msg3190175#msg3190175

"All protocol transactions should have the same output amount. If one output is different, that is the change address. If all outputs are the same, then look at sequence numbers: If there is a broken sequence (i.e. 3,4,8), then the odd-man-out is the change address (8 in this example)"

This means that first we check the sequence numbers, and only then we verify that the data address complies with the byte checks (and not the other way around).

Maybe in practice this makes no difference, but I rather stay with the original way and not reorder the steps for no reason (especially since this code is already running few months on my setup).

As for Level 2 - the original set of rules started with "All protocol transactions should have the same output amount", so I prefer considering the wrong amount typos only as last resort. My suggestion is trying P&D using outputs with equal values as Level 2.
Remark: in the near future tx will be done only using wallets, so no typos are expected. On the other hand, attacks on consensus are expected, so limiting the possibilities of non standard tx is desired.

If Level 2 doesn't work as well, we could try to rule out a typo in outputs amount (mainly for this single tx in question), and look there for valid sequence numbers. For the same reason of limiting the possibilities of non standard tx, I suggest a cleaner solution: Let's ask 15XJoDF4xCUrWX3ES9ftWq3wnGhuRsqrLk to send again 5 MSC to 1Mt1tCGyJnD6SHzBgxtg6GRJLUhqQrc4ff - this time without the typo, and invalidate the original typo tx.
I verified that such an act would not change the history, and it has no effect on other tx and balances.
From that moment, we don't allow such typos.

Another related issue which should be covered here is regarding the recipient discovery:
https://bitcointalk.org/index.php?topic=292628.msg4106402#msg4106402
which boils down to allowing a user to send coins to himself.

from spec.

maran avatar maran commented on June 30, 2024

I already employ this order and judging by the consensus rate it's doing ok.

The reason Zathras and I discussed this approach is to make everything simpler. Right now the spec for Class A is pretty hard to read and the whole idea of this patch would be to remove all the side-notes and have one clear way of parsing these transactions.

I realise that it changes a lot of the logic; but that's intended. I will see if I can setup a second database that does a full reparse since Exodus and run it next to my current database to make sure this form of parsing holds up. But I expect that all transactions should be the same; just easier to parse :)

from spec.

 avatar commented on June 30, 2024

I think some sort of example would be very helpful for newbs trying to implement the spec. Kind of how it is shown for Class B tx:

decoded data address (in bytes): 
[ 0, 234, 0, 0, 0, 0, 0, 0, 0,  1,  0, 0, 0, 0, 38, 162, 10, 246,  0, 0, 0, 77, 202, 30, 189 ]
  0   1   2  3  4  5  6  7  8   9  10  11 12 13  14  15  16  17  18  19  20  21  22  23  24
     seq  --------empty------ curr

To make things more obvious. I can make a PR with something like this if it seems helpful.

Also, a question (sorry if it comes off as newbish) but how can a Level 3 tx be valid if there is no found sequence #? Otherwise, I prefer Level 2 after Level 1, since it makes sense to group the decode methods that use the sequence number together.

from spec.

maran avatar maran commented on June 30, 2024

We are most likely going for an other direction on this ticket. Zathras has some suggested an other way of wording things that leaves the actual implementation to the implementor instead of drawing it all out.

Level 3 can still be considered valid because you can rule out all other options. Let's ignore the sequences on this transaction but just look at it. Now we know by P&D that the data address is 1KsWsi7jHXte1sNc2bMQCpV2xY42MBi7Rj. We know the recipient address is not the Exodus address (no serious payment would do that). That leaves 1L2RvHFHoviCzk2CVJWhyKKYh8kzo3sbnq. There is some risk invalid once you get to level 3; but if you wanted to be sure your transaction would have been proper you should have taken more care crafting it or used Class B instead! ;)

I would advise you to look at other implementations if you want to see how they are parsing it. I made my library very verbose while checking Class A; for instance:

bin/mastercoin_transaction lookup ead9319d7ef35894996e6a246f20922abe3d9c44ba08d55217f452e02a3b433a
D, [2014-01-13T10:28:37.149302 #60546] DEBUG -- : Found data for address 1KsWsi7jHXte1sNc2bMQCpV2xY42MBi7Rj
D, [2014-01-13T10:28:37.150101 #60546] DEBUG -- : Looking for data sequence 207 +1 == 208
D, [2014-01-13T10:28:37.170174 #60546] DEBUG -- : Sequence: 148 for 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
D, [2014-01-13T10:28:37.170546 #60546] DEBUG -- : Sequence: 208 for 1L2RvHFHoviCzk2CVJWhyKKYh8kzo3sbnq
D, [2014-01-13T10:28:37.170612 #60546] DEBUG -- : Target address found 1L2RvHFHoviCzk2CVJWhyKKYh8kzo3sbnq
D, [2014-01-13T10:28:37.170860 #60546] DEBUG -- : Sequence: 207 for 1KsWsi7jHXte1sNc2bMQCpV2xY42MBi7Rj
SimpleSend transaction from 1MaStErt4XsYHPwfrN9TpgdURLhHTdMenH for 15.00000000 Mastercoin to 1L2RvHFHoviCzk2CVJWhyKKYh8kzo3sbnq.

Hope this helps.

from spec.

 avatar commented on June 30, 2024

I'm still confused as to why the preference is to leave ambiguity in the spec rather than eliminate it. For Class
B transactions there is a clear diagram and example case showing what to expect for each step of the multisig transaction. Since it is intended others will implement the spec (maybe devs on MtGox for example) I think the best course of action is to eliminate ambigous wording.

When I was researching how to decode Class A tx, the only note provided how the sequence number is obtained is a footnote, but then it's more clearly explained in Class B. I think this is hindering backwards-compatibility and will cause a number of implementations to show incorrect values for Class A tx in the future.

It is 'ok' if you say 'we prefer it ambiguous, so that they might check implementations for exact details', so that I might understand how you guys are thinking about the spec's clarity.

from spec.

 avatar commented on June 30, 2024

Thanks for explaining the Level 3 decode. It makes more sense now. I think I'll look at the implementation for any further questions I might have. :)

from spec.

maran avatar maran commented on June 30, 2024

Closing this in favor of #36

from spec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.