Comments (11)
Try this:
$ cat msig.script | bx script-to-address
from libbitcoin-explorer.
I need to get around to porting the multisig and stealth examples to the BX wiki.
from libbitcoin-explorer.
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.
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.
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.
OK, I see it. Now that I have a repro I'll take care of it.
from libbitcoin-explorer.
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.
Fixed by #217
from libbitcoin-explorer.
@periodic1236 Thanks for writing this up!
from libbitcoin-explorer.
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.
Thanks! Nice to see it was a simple fix.
from libbitcoin-explorer.
Related Issues (20)
- newbee issue with installation - tips welcome HOT 3
- New release? HOT 1
- Can't build bx on ubuntu server following instructions. HOT 2
- 'fetch-block' is not a bx command HOT 5
- Fail to do install.sh on reproducible Docker build HOT 3
- Installation Debian/Ubuntu fails , missing library libprotokit.a HOT 13
- building error on OS X HOT 6
- Add bitcoin as a topic to this repository
- Connecting the Bitcoin node to the libbitcoin explorer HOT 1
- 🔥 💀 [ Critical ] bx seed generates insecure seed phrases for bx 3.x HOT 6
- Wiki Improvement (Strengthen warnings about `bx seed`) HOT 4
- `bx seed` warning can be ignored HOT 20
- libbitcoin-explorer 3.7.0 build issue HOT 10
- Single executable file HOT 5
- Question: Which library to install to connect to a node? HOT 3
- Cant build clear Ubuntu 22.04 both install and install-cmake fail for different reasons HOT 22
- 404 error on portable executable for Linux, OSX or Windows HOT 2
- angelisab1:revert-745-version3
- windows, mac & linux exe builds are 404 when clicked. HOT 2
- Since Boost 1.82, C++14 is minimum requirement for Boost.Math HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbitcoin-explorer.