Giter Site home page Giter Site logo

Comments (11)

evoskuil avatar evoskuil commented on September 26, 2024

Try this:

$ cat msig.script | bx script-to-address

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

I need to get around to porting the multisig and stealth examples to the BX wiki.

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

Oh, I see your msig.script file is encoded. STDIN from that file should be a single base16 token. script-decode converts it to a set of tokens, which script-to-address accepts. This works as expected:

c:\>bx script-encode 2 [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] 3 checkmultisig > msig.script
5221024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f21024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f21024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f53ae

c:\>type msig.script | bx script-decode
2 [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] [ 024745a36740327223a4dd3b9f42da6f03a5418d6ef18f1371e097f7dedc49b25f ] 3 checkmultisig

c:\>type msig.script | bx script-decode | bx script-to-address
37xnxAAtVbceQXeudE7edjmToaLPuh2bz3

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

The example is actually quite a bit more straightforward in BX, since there is no reason whatsoever to encode the script as base16. BX preserves the option to encode and decode script for the case where the script is being extracted from a tx or some other encoded source. But when fabricating scripts base16 is just a nuisance.

Additionally, BX doesn't overload parameter types. SX, very inconsistently, would inspect the data in certain parameters to determine the type. This complicated implementation and documentation of the commands. BX strongly types each parameter so there are no ambiguities, and I haven't found that this hinders usability.

from libbitcoin-explorer.

periodic1236 avatar periodic1236 commented on September 26, 2024

I definitely prefer the design of BX and I'm glad you made the effort to standardize input/output processing.

As for your example on Windows, it actually illustrates the bug. Take another look at the two commands in my post. 37xnxAAtVbceQXeudE7edjmToaLPuh2bz3 is not the right address - it's the same thing that bx script-to-address 0 returns. Sorry for not making that clear.

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

OK, I see it. Now that I have a repro I'll take care of it.

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

The stdin=true attribute was missing from the metadata declaration for script-to-address (added below):

  <command symbol="script-to-address" formerly="scripthash" category="TRANSACTION" description="Create a BIP16 pay-to-script-hash address from an encoded script.">
    <argument name="TOKEN" stdin="true" limit="-1" type="string" description="The script. If not specified the script is read from STDIN."/>
  </command>

So the script was always empty if provided through STDIN.

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

Fixed by #217

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

@periodic1236 Thanks for writing this up!

from libbitcoin-explorer.

evoskuil avatar evoskuil commented on September 26, 2024

The unit test suite is comprehensive inside of each command, but the coverage is quite light on the command line handing. This is mitigated in part by the fact that much of that code is generated, but if the metadata is incorrect ... :<.

from libbitcoin-explorer.

periodic1236 avatar periodic1236 commented on September 26, 2024

Thanks! Nice to see it was a simple fix.

from libbitcoin-explorer.

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.