Coder Social home page Coder Social logo

bitcoin-core / btcdeb Goto Github PK

View Code? Open in Web Editor NEW
499.0 43.0 120.0 4.93 MB

Bitcoin Script Debugger

License: MIT License

Makefile 0.18% C++ 24.99% C 72.15% Shell 0.53% M4 1.12% Assembly 0.41% Sage 0.60% Dockerfile 0.02%
bitcoin-script script-debugger transaction bitcoin debugger taproot tapscript

btcdeb's Introduction

btcdeb

Bitcoin Script debugging utilities.

This is a set of tools used to debug or construct scripts for use in Bitcoin.

Build Status

Preparation

Mac users need the macOS command line tools:

xcode-select --install

And Homebrew.

Dependencies

btcdeb depends on the following:

  • libtool
  • libssl
  • automake/autoconf
  • pkg-config

Ubuntu/debian users can do: apt-get install libtool libssl-dev autoconf pkg-config (with sudo prepended if necessary)

Mac users can do: brew install libtool automake pkg-config

Installation

On linux or mac, grab the source code and do:

$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Or use docker:

docker build -t btcdeb .
docker run -d -t --name btc-vm btcdeb btcdeb
# and for run it in the shell
docker exec -it btc-vm /bin/sh

If any of those give an error, please file an issue and I'll take a look. It could be a dependency that I forgot about.

Emscripten

You can compile btcdeb tools into JavaScript using emscripten.

After installing the SDK, compile btcdeb tools with the following commands:

$ make clean
$ emconfigure ./configure
$ emmake make
$ for i in btcdeb btcc tap; do mv $i $i.bc && emcc -O2 $i.bc libbitcoin.a -o $i.js; done

and then instead of doing ./btcdeb you do node btcdeb.js (or mastify.js, etc).

The last part is done because emscripten's emcc expects the input bytecode file to have the .bc extension, whereas the makefile generates files with no extension.

Note: most things work, but the console in btcdeb does not. You can work around this by doing echo -n -e "step\n\n\n" (with sufficient \ns).

Script debugger

The btcdeb command can step through a Bitcoin Script and show stack content and operations on a per op level. See doc/btcdeb.md for details on usage.

Script compiler

The btcc command can interpret a script in its human readable form and will return a corresponding Bitcoin Script.

$ btcc OP_DUP OP_HASH160 897c81ac37ae36f7bc5b91356cfb0138bfacb3c1 OP_EQUALVERIFY OP_CHECKSIG
76a914897c81ac37ae36f7bc5b91356cfb0138bfacb3c188ac

The above is the script pub key for a transaction in Bitcoin in human readable format turned into its hexadecimal representation.

btcdeb's People

Contributors

bowtieddeployer avatar cirosantilli avatar cithodler avatar isghe avatar jbaczuk avatar jonasnick avatar jonatack avatar kalle2 avatar kallewoof avatar mechanikalk avatar mplsgrant avatar smizzlov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btcdeb's Issues

Unable to build on Windows

Ciao.
I've just come across this project and tried to build it on Windows 10 x64 but got some compilation errors.

In file included from ../functions.h:9,
from ../functions.cpp:4:
../kerl/kerl.h:16:10: fatal error: sys/errno.h: No such file or directory
16 | #include <sys/errno.h>
| ^~~~~~~~~~~~~
compilation terminated.

Thanks in advance.

Mock signatures

It would be helpful if mock keys and signatures could be provided. This would let the user step through a bitcoin script template without having to create keys, signatures or transactions.

The input could be something like a dictionary of public keys and which signatures should be assumed to correspond to which public keys.

./configure errors out on Ubuntu 20.04.2 LTS/5.4.0-51-generic

./autogen.sh
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
libtoolize: copying file 'build-aux/m4/ltsugar.m4'
libtoolize: copying file 'build-aux/m4/ltversion.m4'
libtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
configure.ac:15: installing 'build-aux/compile'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
libtoolize: copying file 'build-aux/m4/ltsugar.m4'
libtoolize: copying file 'build-aux/m4/ltversion.m4'
libtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
libtoolize: Consider adding '-I build-aux/m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:74: installing 'build-aux/compile'
configure.ac:36: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
snj@ubuntu-aqua-vm-enforcer:~/bitcoin-core/btcdeb$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) no
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make supports the include directive... no
checking dependency style of g++... none
checking whether g++ supports C++17 features with -std=c++17... yes
checking whether we are using the GNU Objective C++ compiler... no
checking whether g++ -std=c++17 accepts -g... no
checking dependency style of g++ -std=c++17... none
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=c++17 -E
checking for ld used by g++ -std=c++17... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ -std=c++17 option to produce PIC... -fPIC -DPIC
checking if g++ -std=c++17 PIC flag -fPIC -DPIC works... yes
checking if g++ -std=c++17 static flag -static works... yes
checking if g++ -std=c++17 supports -c -o file.o... yes
checking if g++ -std=c++17 supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking for ccache... no
checking for readelf... /usr/bin/readelf
checking for c++filt... /usr/bin/c++filt
checking whether C++ compiler accepts -Werror... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether byte ordering is bigendian... no
checking for a readline compatible library... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking whether the linker accepts -Wl,--large-address-aware... no
checking for __attribute__((visibility))... yes
checking for __attribute__((dllexport))... no
checking for __attribute__((dllimport))... no
checking whether C++ compiler accepts -fPIC... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking whether strnlen is declared... yes
checking whether daemon is declared... yes
checking whether le16toh is declared... yes
checking whether le32toh is declared... yes
checking whether le64toh is declared... yes
checking whether htole16 is declared... yes
checking whether htole32 is declared... yes
checking whether htole64 is declared... yes
checking whether be16toh is declared... yes
checking whether be32toh is declared... yes
checking whether be64toh is declared... yes
checking whether htobe16 is declared... yes
checking whether htobe32 is declared... yes
checking whether htobe64 is declared... yes
checking whether bswap_16 is declared... yes
checking whether bswap_32 is declared... yes
checking whether bswap_64 is declared... yes
checking whether __builtin_clz is declared... yes
checking whether __builtin_clzl is declared... yes
checking whether __builtin_clzll is declared... yes
checking for visibility attribute... yes
checking for Linux getrandom syscall... yes
checking for getentropy... yes
checking for getentropy via random.h... yes
checking for sysctl KERN_ARND... no
checking if dangerous features should be enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/bitcoin-config.h
config.status: config/bitcoin-config.h is unchanged
config.status: executing depfiles commands
config.status: error: in `/home/snj/bitcoin-core/btcdeb':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details

config.log

Getting error: Signature must be zero for failed CHECK(MULTI)SIG operation

I ran the example from the README file.

btcdeb '[OP_DUP OP_HASH160 897c81ac37ae36f7bc5b91356cfb0138bfacb3c1 OP_EQUALVERIFY OP_CHECKSIG]' 3045022100c7d8e302908fdc601b125c2734de63ed3bf54353e13a835313c2a2aa5e8f21810220131fad73787989d7fbbdbbd8420674f56bdf61fed5dc2653c826a4789c68501101 03b05bdbdf395e495a61add92442071e32703518b8fca3fc34149db4b56c93be42

I am getting the error: Signature must be zero for failed CHECK(MULTI)SIG operation

Is this the expected behavior?

Boost dependency

On Mac OS X, make failed with the following output:

  CXX      btcdeb-btcdeb.o
  CXX      libbitcoin_a-base58.o
base58.cpp:13:10: fatal error: 'boost/variant/apply_visitor.hpp' file not found
#include <boost/variant/apply_visitor.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [libbitcoin_a-base58.o] Error 1
make: *** [all-recursive] Error 1

Fixed after running brew install boost.

Building Issue for Mac

Hi, I am failing to build when running: sudo make install with the following output:

/usr/local/bin/gmkdir -p '/usr/local/bin'
/bin/sh ./libtool --mode=install /usr/local/bin/ginstall -c btcdeb btcc test-btcdeb '/usr/local/bin'
libtool: install: /usr/local/bin/ginstall -c btcdeb /usr/local/bin/btcdeb
libtool: install: /usr/local/bin/ginstall -c btcc /usr/local/bin/btcc
libtool: install: /usr/local/bin/ginstall -c test-btcdeb /usr/local/bin/test-btcdeb
make[2]: Nothing to be done for `install-data-am'.

Running MacOS Sierra

Argument type warnings on ubuntu 18.04

  CXX      test/test_btcdeb-utils.o
  CXX      test/test_btcdeb-value.o
  CXXLD    test-btcdeb
  CXX      tap-instance.o
  CXX      tap-functions.o
  CXX      tap-tap.o
tap.cpp: In function ‘int main(int, char* const*)’:
tap.cpp:25:47: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 #define abort(msg...) do { fprintf(stderr, msg); fputc('\n', stderr); exit(1); } while(0)
                                               ^
tap.cpp:371:111:
             abort("pubkey mismatch: input transaction's vout[%lld].scriptPubKey = %s, but our pubkey = %s\n", instance.txin_vout_index, HEXC(spk), HE
XC(serialized_pk));
                                                                                                               ~~~~~~~~~~
tap.cpp:371:13: note: in expansion of macro ‘abort’
             abort("pubkey mismatch: input transaction's vout[%lld].scriptPubKey = %s, but our pubkey = %s\n", instance.txin_vout_index, HEXC(spk), HE
XC(serialized_pk));
             ^~~~~
tap.cpp:25:47: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 #define abort(msg...) do { fprintf(stderr, msg); fputc('\n', stderr); exit(1); } while(0)
                                               ^
tap.cpp:375:125:
             abort("pubkey mismatch: input transaction's vout[%lld].scriptPubKey %s does not end (%s) with our pubkey %s\n", instance.txin_vout_index,
 HEXC(spk), HEXC(cmp), HEXC(serialized_pk));
                                                                                                                             ~~~~~~~~~~
tap.cpp:375:13: note: in expansion of macro ‘abort’
             abort("pubkey mismatch: input transaction's vout[%lld].scriptPubKey %s does not end (%s) with our pubkey %s\n", instance.txin_vout_index$
 HEXC(spk), HEXC(cmp), HEXC(serialized_pk));
             ^~~~~
  CXXLD    tap

Stack: c:pk_h(030500...)

I'm trying to create a raw transaction. There is something wrong with the transaction I created, but I'm not able to figure out what.

I run btcdeb with this options:

btcdeb --tx=010000000116402fe74ebc194f15f19ca11c5d49266608b024363c0b077a17c02bee4d1d82000000008b483045022100d15f16b3d27295a78cd3b51d0076e2267f4c13137ddae2bda21ad125e7f2f07a02207fb126e311e06da096e1ee281dd2cbf34a1d76f5b0b204bd7c26d4f3bbba7bd40141045ca49382a5836bc13732efb3e66c5fd4ed159679517b7fdc48796e5b411af09f08d3a7b663610006f972162bd0f8f77a140782401f87b2f34f330777e59fb992ffffffff02404b4c00000000001976a91459fe1a9f9f0a5af33396c59990f064be1ca5127488acf0e1ad02000000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888ac00000000 --txin=0200000001602e636f316b16fc4bc0a966d71b0958b1f6104d93477672b7a836db4a357d95000000006a47304402201ff42f44fcd505e037c01605448641750bc99a3567a1c27ec330517491e25bb0022031faef6084ea2e7c9539e213e5c63caa41926492e3e5271064201b8d3f54ed2a012102b6c09f33d3cf812b01924877415f05135a20f0cdaaf35c75cf2e37e7c17480aafeffffff0280f0fa02000000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888ac28f00a2701000000160014596b304f8ae291f6f588bc6759d8218d4cb478e87000000

and this is the initial state when btcdeb starts:

btcdeb 0.2.19 -- type `btcdeb -h` for start up options
got transaction e1dff72b80938b65dd4d97268971d3c33ce98ac3d1604818038795d5e64ff84f:
CTransaction(hash=e1dff72b80, ver=1, vin.size=1, vout.size=2, nLockTime=0)
    CTxIn(COutPoint(821d4dee2b, 0), scriptSig=483045022100d15f16b3d272)
    CScriptWitness()
    CTxOut(nValue=0.05000000, scriptPubKey=76a91459fe1a9f9f0a5af33396c599)
    CTxOut(nValue=0.44950000, scriptPubKey=76a914814a2c0bb0d155667341be55)

got input tx #0 821d4dee2bc0177a070b3c3624b0086626495d1ca19cf1154f19bc4ee72f4016:
CTransaction(hash=821d4dee2b, ver=2, vin.size=1, vout.size=2, nLockTime=112)
    CTxIn(COutPoint(957d354adb, 0), scriptSig=47304402201ff42f44fcd505, nSequence=4294967294)
    CScriptWitness()
    CTxOut(nValue=0.50000000, scriptPubKey=76a914814a2c0bb0d155667341be55)
    CTxOut(nValue=49.49995560, scriptPubKey=0014596b304f8ae291f6f588bc6759)

input tx index = 0; tx input vout = 0; value = 50000000
unknown key ID 814a2c0bb0d155667341be55633e7351a7d5c578: returning fake key
8 op script loaded. type `help` for usage information
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
3045022100d15f16b3d27295a78cd3b51d0076e2267f4c13137ddae2bda21ad... | c:pk_h(03050000000000000000000000000000000000000000000000000000...
045ca49382a5836bc13732efb3e66c5fd4ed159679517b7fdc48796e5b411af... | 
<<< scriptPubKey >>>                                               | 
OP_DUP                                                             | 
OP_HASH160                                                         | 
814a2c0bb0d155667341be55633e7351a7d5c578                           | 
OP_EQUALVERIFY                                                     | 
OP_CHECKSIG                                                        | 
#0000 3045022100d15f16b3d27295a78cd3b51d0076e2267f4c13137ddae2bda21ad125e7f2f07a02207fb126e311e06da096e1ee281dd2cbf34a1d76f5b0b204bd7c26d4f3bbba7bd401

Why is there c:pk_h(03050000000000000000000000000000000000000000000000000000... on the stack and what does it it mean?

What is wrong with my transaction?

P2PK Transactions

I am not able to get P2PK transactions to work with btcdeb. I would like to be able to verify any arbitrary message or older bitcoin transactions. For example, the very first Bitcoin transaction between Satoshi and Hal Finney https://www.blockchain.com/btc/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 .

I use the following script which I built from blockchain.info, but the signature checks fail.

btcdeb --tx=50.00000000:01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0134ffffffff0100f2052a0100000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000 '[0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3 OP_CHECKSIG]' 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901
btcdeb -- type `btcdeb -h` for start up options
got transaction 0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9:
CTransaction(hash=0437cd7f85, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff001d0134)
    CScriptWitness()
    CTxOut(nValue=50.00000000, scriptPubKey=410411db93e1dcdb8a016b49840f8c)

valid script
2 op script loaded. type `help` for usage information
script                                                             |                                                             stack
-------------------------------------------------------------------+-------------------------------------------------------------------
0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909... | 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548a...
OP_CHECKSIG                                                        |
#0000 0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3
btcdeb> step
		<> PUSH stack 0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3
script                                                             |                                                             stack
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_CHECKSIG                                                        | 0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909...
                                                                   | 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548a...
#0001 OP_CHECKSIG
btcdeb> step
error: Signature must be zero for failed CHECK(MULTI)SIG operation (is this a historical transaction from before NULLFAIL enforcement? Try with --modify-flags=-NULLFAIL)

when this is entered as just raw hex with --tx and --txin the OP_CHECKSIG results in true, but the stack is identical in both cases. It would seem to me that some sort of option or flag is needed that is being found from the raw tx hash that is not being found from jus the script.

btcdeb --txin=01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0134ffffffff0100f2052a0100000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000 --tx=0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000

script                                                             |                                                             stack
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_CHECKSIG                                                        | 0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909...
                                                                   | 304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548a...
#0003 OP_CHECKSIG
btcdeb> step
		<> POP  stack
		<> POP  stack
		<> PUSH stack 01
script                                                             |                                                             stack
-------------------------------------------------------------------+-------------------------------------------------------------------
                                                                   |                                                                 01

Examples in btcdeb/doc/btcdeb.md cause an assert abort now?

Hi,

This happens since the miniscript support was added in February.
Looks like the p2pkh sequence is recognised and a fake key is created for it by the new code.
Then msenv.cpp re-parses the script (with a new fake address)
And then bombs out at the assert (line 286) when the new hex string of the script doesn't match the old script sans fake key.
The assert is protected by a check for if (COMPILER_CTX.fake_sigs.size() == 0) but this is still true.

The examples all work fine for me if I comment out the assert at line 286 of msenv.cpp.
Including the signature checking example.

I've pasted in what I see on the command line below.

Thanks,
Alan

$ btcdeb '[OP_DUP OP_HASH160 897c81ac37ae36f7bc5b91356cfb0138bfacb3c1 OP_EQUALVERIFY OP_CHECKSIG]' 3045022100c7d8e302908fdc601b125c2734de63ed3bf54353e13a835313c2a2aa5e8f21810220131fad73787989d7fbbdbbd8420674f56bdf61fed5dc2653c826a4789c68501101 03b05bdbdf395e495a61add92442071e32703518b8fca3fc34149db4b56c93be42
btcdeb 0.2.19 -- type btcdeb -h for start up options
unknown key ID 897c81ac37ae36f7bc5b91356cfb0138bfacb3c1: returning fake key
assertion hit: strings different after MSEnv reparsed:
76a914897c81ac37ae36f7bc5b91356cfb0138bfacb3c188ac
76a9141ff85df01e3c8c56fff01c28072dc7bb9d48bfc288ac
btcdeb: msenv.cpp:286: MSEnv::MSEnv(const CScript&, bool): Assertion `HexStr(script) == HexStr(m_script)' failed.
Aborted

Mac installation additionally requires brew install automake

Setup instructions as is leads to an error message on ./autogen.sh

autoreconf: failed to run aclocal

According to this issue: buffer/pylibemu#24, it's due to missing aclocal, which can be added to my path with brew install automake.

Suggestion to modify the README as follows

brew install libtool autoconf pkg-config -> brew install libtool autoconf pkg-config automake

Emscripten

I’d be interested in integrating btcdeb into the tools in Ivy. For it to work in the Ivy Playground it would need to be compiled to run in a browser, probably using emscripten. Have you tried doing so?

btcdeb not work for P2SH puzzle transaction, show unexpected stack info.

hi @kallewoof
I create a puzzle P2SH output and make a transaction to redeem it.
the redeemScript is just 93016387, and scriptPubKey is [OP_HASH160 hash160(93016387) OP_EQUAL]=(a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed87)
and spend it also just send back to itself.


#redeemScript
  93     01     63      87
  OP_ADD 1Byte  int:99  OP_EQUAL

#scriptSig
  51  01 62    04   93  01  63  87
  

because this is not normal transaction, and can not create by signrawtransaction bitcoin core cli,
I create by python https://github.com/passionofvc/raw-tx-tool/blob/master/P2SH/redeem_P2SH.py
and broatcast to testnet
https://live.blockcypher.com/btc-testnet/tx/e8a9df4f3b5f5ff454ab96083fca8f8375359df26051ef2831bbc07e93788b27/

./btcdeb --tx=0100000001e2d4fe69fbfa62beac61da2a07ae84d96e3e1c14cdee348cf3c84efd20eda37d00000000085101620493016387ffffffff0160ceab070000000017a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed8700000000 --txin=02000000019729eadf29e14ea589a2ebc7a2341b7d8abcdfe321c253d3234316e76369bc8c000000006a4730440220562f08fb8da9449d69a20ea9009a5f3372c2c01f57072593bceced7dfb10e88902204cf3d2ceff3b4537dad9e06fde49f58d2e02ad10c6786dd867ca65d94fd5f40d01210396a4b78bd85494a32e7189cd597fc4d3f6ad4e8cfc76356eec7339bdd0a9efdbffffffff010055ad070000000017a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed8700000000

btcdeb -- type `./btcdeb -h` for start up options
got transaction:
CTransaction(hash=e8a9df4f3b, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(7da3ed20fd, 0), scriptSig=5101620493016387)
    CScriptWitness()
    CTxOut(nValue=1.28700000, scriptPubKey=a9143f58b4f7b14847a9083694b9b3)

got input tx #0:
CTransaction(hash=7da3ed20fd, ver=2, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(8cbc6963e7, 0), scriptSig=4730440220562f08fb8da944)
    CScriptWitness()
    CTxOut(nValue=1.28800000, scriptPubKey=a9143f58b4f7b14847a9083694b9b3)

input tx index = 0; tx input vout = 0; value = 128800000
warning: ambiguous input 51 is interpreted as a numeric value; use 0x51 to force into hexadecimal interpretation
warning: ambiguous input 62 is interpreted as a numeric value; use 0x62 to force into hexadecimal interpretation
warning: ambiguous input 93016387 is interpreted as a numeric value; use 0x93016387 to force into hexadecimal interpretation
3 op script loaded. type `help` for usage information
script                                   |   stack 
-----------------------------------------+---------
OP_HASH160                               | 43518b05
3f58b4f7b14847a9083694b9b3b52a4cea2569ed |       3e
OP_EQUAL                                 |       33
#0001 OP_HASH160

Newly enabled opcodes execute after invalid OP_IF statement

Newly enabled opcodes like CAT, SUBSTR etc are executing after false OP_IF statements.

exec aabbcc ddeeff OP_1 OP_2 OP_GREATERTHAN OP_IF OP_CAT OP_ENDIF

In the example above, although OP_GREATERTHAN statement is false, OP_CAT executes after OP_IF and leaves stack with aabbccddeeff.

Doesn't work with some scripts

Hi,

I'm really interested in the MASTify stuff, as I have been implementing some of these routines for a while now!

It looks like it fails on this script from BIP114: https://github.com/bitcoin/bips/blob/master/bip-0114.mediawiki#hashed-time-lock-contract - returning "ELSE without IF".

I got to look at it briefly, and it ran into the error after processing the second OP_ENDIF. I should find some time again soon to look at it, wanted to post it in case the script helps you also.

OP_HASH160 OP_DUP 0x36e11d89e9138321fe57037752f0f5b33543735c OP_EQUAL 
OP_IF 
    0x00a41f OP_CHECKSEQUENCEVERIFY OP_2DROP 
    0x02d39621fe21a7074c7b10c6791c88a8c0a5c1253033e68d703f4f298e335fd649 
OP_ELSE 
    0x442328b49e3071bddbafc0f8b7b6aad0b7dbcc63 OP_EQUAL 
    OP_NOTIF
        0x36e0ed5a OP_CHECKLOCKTIMEVERIFY OP_DROP 
    OP_ENDIF 
    0x031d3363f3df80affe482fcb52a620052909d874aecd469f28995ff2468bbd48e8 
OP_ENDIF 
OP_CHECKSIG

Testnet Transaction signature fails

I am trying to use btcdeb to verify testnet transactions but I am running into issues with the signature check. However, I know the signature is correct because it was accepted by the network. The following is giving me an error. I am able to process mainnet transactions like this but I am not getting testnet transactions to pass signature checks.

btcdeb --tx=0.08760812:0200000000010108937990081f74b10ce7ae79065f1ecd2dbbf9710941cc44e450f7a17951311b01000000171600148c20a264b1c162f388fe0e9992e2e87d1830adefffffffff01ecad8500000000001976a914ca073a588b2ea809fcfe4aae9f89fa73acf4117788ac024830450221009f9fb0c5b826b0a869e51c0318bc459e40e748a917fc2e13e07cea3a1dcc75b502200dcd4a1c4bc6173c2ec8127246586bb5456c0cf2196f2012d907d744d74f0015012103661b91afaa5ddcdecc10f4be5e282427f6f00672cb06293e802eeccd9364219400000000 '[OP_DUP OP_HASH160 ca073a588b2ea809fcfe4aae9f89fa73acf41177 OP_EQUALVERIFY OP_CHECKSIG]' 3045022100ac7169d5d1359082ca820903d21c969d27d6e9cc8e5adee8a64ecfe90aa7d19f0220131c46e31b36297f94b1163693c55352d0fe457a3b9740b496fd23829a827cbb 038e21b7eb62fa4412c195c6c5db3ce37943e5b4f77d2ef0a07b32bddcb7fe7ab0

This results in:

script                                   |                                                             stack
-----------------------------------------+-------------------------------------------------------------------
OP_CHECKSIG                              | 038e21b7eb62fa4412c195c6c5db3ce37943e5b4f77d2ef0a07b32bddcb7fe7ab0
                                         | 3045022100ac7169d5d1359082ca820903d21c969d27d6e9cc8e5adee8a64ec...
#0004 OP_CHECKSIG
btcdeb> step
error: Non-canonical DER signature (is this transaction pre-BIP66? Try with --modify-flags=-DERSIG and/or -LOW_S and/or -STRICTENC)

However if you check https://live.blockcypher.com/btc-testnet/tx/afba5550cf1f9957d38bd3704947e745a47861e7fa375cea76638b38537ff545/ you can see transaction and signature is valid.

Unable to compile on Fedora 35, possible glibc issue?

I have glibc v2.34-11, running on Fedora 35. I've seen similar reports elsewhere but don't understand how to fix it.

I've followed the following steps but running make gives me the following error:

make[1]: Entering directory '/home/Documents/projects/bitcoin/btcdeb'
make[2]: Entering directory '/home/Documents/projects/bitcoin/btcdeb/secp256k1'
make[2]: Leaving directory '/home/Documents/projects/bitcoin/btcdeb/secp256k1'
  CXX      test/btcdeb-catch.o

In file included from /usr/include/signal.h:328,
                 from test/catch.hpp:7854,
                 from test/catch.cpp:15:
test/catch.cpp:3754:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
 3754 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from test/catch.hpp:7854,
                 from test/catch.cpp:15:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
test/catch.cpp:3810:45: error: size of array ‘altStackMem’ is not an integral constant-expression
 3810 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
make[1]: *** [Makefile:1540: test/btcdeb-catch.o] Error 1

Can we get the "pseudo-opcodes" back?

It appears that btcc used to support some "pseudo-opcodes" that Bitcoin Core uses (used?) internally as placeholders, but are not valid in real Script. They were removed here:

kallewoof@3a6e3ef#diff-642cf6d9959058688f4b8d7c848e0605L169

It looks like we (Blockstream) have an internal tool that depends on btcc understanding "OP_PUBKEY" to mean "0xfe", which are are using for our own script templating purposes. The tool can be changed, so I don't really need that specific mapping to exist, but I need some way to insert "0xfe" directly into the raw script as a placeholder byte, even though it is not a valid opcode.

If you're willing to restore support for OP_PUBKEY, or add another way to insert unquoted bytes, I would very much appreciate it!

(Also, you may want to emit some kind of warning if you parse a "string" that begins with "OP_", which suggests that it was meant to be parsed as an opcode, but with a typo or something. Right now it will just get inserted into the script silently as a data push of the string bytes.)

Error while 'make' due to c99 mode

Output of make below:

user1@mybtc:~/btcdeb$ make
make[1]: Entering directory '/home/user1/btcdeb'
make[2]: Entering directory '/home/user1/btcdeb/secp256k1'
make[2]: Leaving directory '/home/user1/btcdeb/secp256k1'
  CC       kerl/libkerl_a-kerl.o
kerl/kerl.c: In function 'kerl_completion':
kerl/kerl.c:394:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (register int i = 0; spaces < 2 && i < rl_point; i++) spaces += rl_line_buffer[i] == ' ';
     ^
kerl/kerl.c:394:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
Makefile:849: recipe for target 'kerl/libkerl_a-kerl.o' failed
make[1]: *** [kerl/libkerl_a-kerl.o] Error 1
make[1]: Leaving directory '/home/user1/btcdeb'
Makefile:1196: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

I think we should revert this...

I think we should revert this...

bg had different strings: (%n GB е нужен) vs (%n GB са нужни)

ca: Un GB d'espai lliure disponible vs %1 GB d'espai lliure disponibles; and (Un GB necessari) vs (de %n GB necessàris)

eo: %n gigabajto de libera loko disponeble vs %n gigabajtoj de libera loko disponebla.

es_CL: (de %n GB requerido) vs (de %n GB requeridos)

fr: %n Go d’espace libre disponible vs %n Go d’espace libre disponibles; and (%n Go nécessaire pour la chaîne complète) vs (%n Go nécessaires pour la chaîne complète)

he: ג״ב של מקום פנוי זמין vs %n ג״ב של מקום פנוי זמינים

hr: (od potrebnog prostora od %n GB) vs (od potrebnog %n GB); and (potreban je %n GB za cijeli lanac) vs (potrebna su %n GB-a za cijeli lanac) vs (potrebno je %n GB-a za cijeli lanac)

pl: (%n GB potrzebny na pełny łańcuch) vs (%n GB potrzebne na pełny łańcuch) vs (%n GB potrzebnych na pełny łańcuch)

ro: (din %n GB necesar) vs (din %n GB necesari)

sk: (z %n GB potrebného) vs (z %n GB potrebných); and (%n GB potrebný pre plný reťazec) vs (%n GB potrebné pre plný reťazec) vs (%n GB potrebných pre plný reťazec)

sl: (%n GB potreben za celotno verigo blokov) vs (%n GB potrebna za celotno verigo blokov) vs (%n GB potrebni za celotno verigo blokov) vs (%n GB potrebnih za celotno verigo blokov)

sv: %n GB fritt utrymme kvar vs %n GB ledigt utrymme kvar; and (av %n GB behövs) vs (av de %n GB som behövs)

szl: (z %n GB przidajnego) vs (z %n GB przidajnych)

Originally posted by @luke-jr in bitcoin-core/gui#296 (comment)

Error during installation in Fedora 33

During the installation in Fedora 33 (uname -r -> 5.12.8-200.fc33.x86_64 ), in particular during make command I get the following error:

[luca@localhost btcdeb]$ make
make[1]: ingresso nella directory «/home/luca/Documenti/software/btcdeb»
CXX util/libbitcoin_a-strencodings.o
In file included from util/strencodings.cpp:6:
./util/strencodings.h: In function ‘bool ValidAsCString(const string&)’:
./util/strencodings.h:31:26: error: ‘strlen’ was not declared in this scope
31 | return str.size() == strlen(str.c_str());
| ^~~~~~
./util/strencodings.h:17:1: note: ‘strlen’ is defined in header ‘’; did you forget to ‘#include ’?
16 | #include
+++ |+#include
17 | #include
make[1]: *** [Makefile:1343: util/libbitcoin_a-strencodings.o] Errore 1
make[1]: uscita dalla directory «/home/luca/Documenti/software/btcdeb»
make: *** [Makefile:1624: all-recursive] Errore 1

Can you solve this issue?
Tnkyou

Segmentation fault in Ubuntu

I have installed btcdeb on an Ubuntu VM but am having trouble working with the program. Here is what I type/get:
$ btcdeb 0x515293
btcdeb -- type btcdeb -h for start up options
valid script
3 op script loaded. type help for usage information
script | stack
--------+--------
1 |
2 |
OP_ADD |
#1 1
btcdeb> step
Segmentation fault (core dumped)

Could I possibly be doing something wrong?

op_false

$ ./btcdeb '[OP_FALSE]'
btcdeb -- type `./btcdeb -h` for start up options
valid script
1 op script loaded. type `help` for usage information
script           |  stack
-----------------+--------
4f505f46414c5345 |
#0001 4f505f46414c5345

make error

❯ ./autogen.sh

glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
glibtoolize: copying file 'build-aux/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
glibtoolize: copying file 'build-aux/m4/libtool.m4'
glibtoolize: copying file 'build-aux/m4/ltoptions.m4'
glibtoolize: copying file 'build-aux/m4/ltsugar.m4'
glibtoolize: copying file 'build-aux/m4/ltversion.m4'
glibtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
configure.ac:29: warning: The macro `AC_PROG_CC_C89' is obsolete.
configure.ac:29: You should run autoupdate.
./lib/autoconf/c.m4:1652: AC_PROG_CC_C89 is expanded from...
configure.ac:29: the top level
configure.ac:15: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/config.guess'
configure.ac:5: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
glibtoolize: copying file 'build-aux/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
glibtoolize: copying file 'build-aux/m4/libtool.m4'
glibtoolize: copying file 'build-aux/m4/ltoptions.m4'
glibtoolize: copying file 'build-aux/m4/ltsugar.m4'
glibtoolize: copying file 'build-aux/m4/ltversion.m4'
glibtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
glibtoolize: Consider adding '-I build-aux/m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:74: installing 'build-aux/compile'
configure.ac:26: installing 'build-aux/config.guess'
configure.ac:26: installing 'build-aux/config.sub'
configure.ac:36: installing 'build-aux/install-sh'
configure.ac:36: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'

❯ ./configure

checking build system type... aarch64-apple-darwin20.5.0
checking host system type... aarch64-apple-darwin20.5.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking whether g++ supports C++17 features with -std=c++17... yes
checking whether the compiler supports GNU Objective C++... yes
checking whether g++ -std=c++17 accepts -g... yes
checking dependency style of g++ -std=c++17... gcc3
checking how to print strings... printf
checking for gcc... gcc
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin20.5.0 file names to aarch64-apple-darwin20.5.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin20.5.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin20.5.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=c++17 -E
checking for ld used by g++ -std=c++17... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ -std=c++17 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ -std=c++17 option to produce PIC... -fno-common -DPIC
checking if g++ -std=c++17 PIC flag -fno-common -DPIC works... yes
checking if g++ -std=c++17 static flag -static works... no
checking if g++ -std=c++17 supports -c -o file.o... yes
checking if g++ -std=c++17 supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++17 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin20.5.0 dyld
checking how to hardcode library paths into programs... immediate
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking for ccache... no
checking for readelf... no
checking for c++filt... /usr/bin/c++filt
checking whether C++ compiler accepts -Werror... yes
checking for port... no
checking for brew... brew
checking whether the linker accepts -Wl,-headerpad_max_install_names... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether byte ordering is bigendian... no
checking for a readline compatible library... -lreadline
checking for readline.h... no
checking for readline/readline.h... yes
checking whether readline supports history... yes
checking for history.h... no
checking for readline/history.h... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for g++ -std=c++17 options needed to detect all undeclared functions... none needed
checking whether strerror_r is declared... yes
checking whether strerror_r returns char *... no
checking whether the linker accepts -Wl,--large-address-aware... no
checking for __attribute__((visibility))... no
checking for __attribute__((dllexport))... no
checking for __attribute__((dllimport))... no
checking whether C++ compiler accepts -fPIC... yes
checking whether the linker accepts -Wl,-dead_strip... yes
checking for endian.h... no
checking for sys/endian.h... no
checking for byteswap.h... no
checking for stdio.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for sys/select.h... yes
checking for sys/prctl.h... no
checking whether strnlen is declared... yes
checking whether daemon is declared... yes
checking whether le16toh is declared... no
checking whether le32toh is declared... no
checking whether le64toh is declared... no
checking whether htole16 is declared... no
checking whether htole32 is declared... no
checking whether htole64 is declared... no
checking whether be16toh is declared... no
checking whether be32toh is declared... no
checking whether be64toh is declared... no
checking whether htobe16 is declared... no
checking whether htobe32 is declared... no
checking whether htobe64 is declared... no
checking whether bswap_16 is declared... no
checking whether bswap_32 is declared... no
checking whether bswap_64 is declared... no
checking whether __builtin_clz is declared... no
checking whether __builtin_clzl is declared... no
checking whether __builtin_clzll is declared... no
checking for visibility attribute... yes
checking for Linux getrandom syscall... no
checking for getentropy... no
checking for getentropy via random.h... yes
checking for sysctl KERN_ARND... no
checking if dangerous features should be enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/bitcoin-config.h
config.status: executing depfiles commands
config.status: executing libtool commands
=== configuring in secp256k1 (/Users/aguidis/Projects/btcdeb/secp256k1)
configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local'  '--disable-shared' '--with-pic' '--enable-benchmark=no' '--with-bignum=no' '--enable-module-recovery' '--enable-module-schnorrsig' '--enable-experimental' --cache-file=/dev/null --srcdir=.
checking build system type... aarch64-apple-darwin20.5.0
checking host system type... aarch64-apple-darwin20.5.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... rm: conftest.dSYM: is a directory
yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... rm: conftest.dSYM: is a directory
BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin20.5.0 file names to aarch64-apple-darwin20.5.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin20.5.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... rm: conftest.dSYM: is a directory
no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... rm: conftest.dSYM: is a directory
ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin20.5.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking how to run the C preprocessor... gcc -E
checking for gcc... gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking dependency style of gcc... gcc3
checking for brew... /opt/homebrew/bin/brew
checking if gcc supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
checking if gcc supports -fvisibility=hidden... yes
checking for valgrind/memcheck.h... no
checking if native gcc supports -Wall -Wextra -Wno-unused-function... yes
checking for working native compiler: gcc... yes
checking for x86_64 assembly availability... no
checking for libcrypto... yes
checking for main in -lcrypto... yes
checking for EC functions in libcrypto... yes
configure: ******
configure: WARNING: experimental build
configure: Experimental features do not have stable APIs or properties, and may not be safe for production use.
configure: Building ECDH module: no
configure: Building extrakeys module: yes
configure: Building schnorrsig module: yes
configure: ******
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsecp256k1.pc
config.status: creating src/libsecp256k1-config.h
config.status: executing depfiles commands
config.status: executing libtool commands

Build Options:
  with endomorphism       = no
  with ecmult precomp     = yes
  with external callbacks = no
  with benchmarks         = no
  with coverage           = no
  module ecdh             = no
  module recovery         = yes
  module extrakeys        = yes
  module schnorrsig       = yes

  asm                     = no
  bignum                  = no
  ecmult window size      = 15
  ecmult gen prec. bits   = 4

  valgrind                = no
  CC                      = gcc
  CFLAGS                  = -O2 -fvisibility=hidden -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -g
  CPPFLAGS                =
  LDFLAGS                 =


Options used to compile and link:
  dangerous     = no
  target os     = darwin
  build os      = darwin

  CC            = gcc
  CFLAGS        = -g -O2
  CPPFLAGS      =  -DMAC_OSX
  CXX           = g++ -std=c++17
  CXXFLAGS      = -g -O2
  LDFLAGS       =  -Wl,-headerpad_max_install_names -Wl,-dead_strip
  ARFLAGS       = cr

❯ make

  CXX      btcdeb-instance.o
  CXX      btcdeb-functions.o
  CXX      btcdeb-btcdeb.o
  CXX      debugger/libbitcoin_deb_a-hash.o
  CXX      debugger/libbitcoin_deb_a-interpreter.o
  CXX      debugger/libbitcoin_deb_a-script.o
  AR       libbitcoin_deb.a
  CXX      libbitcoin_a-arith_uint256.o
  CXX      libbitcoin_a-base58.o
  CXX      libbitcoin_a-bech32.o
  CXX      crypto/libbitcoin_a-hmac_sha512.o
  CXX      crypto/libbitcoin_a-ripemd160.o
  CXX      crypto/libbitcoin_a-sha1.o
  CXX      crypto/libbitcoin_a-sha256.o
  CXX      crypto/libbitcoin_a-sha512.o
  CXX      libbitcoin_a-hash.o
  CXX      libbitcoin_a-merkle.o
  CXX      primitives/libbitcoin_a-transaction.o
  CXX      libbitcoin_a-pubkey.o
  CXX      script/libbitcoin_a-interpreter.o
  CXX      script/libbitcoin_a-script.o
  CXX      script/libbitcoin_a-script_error.o
  CXX      support/libbitcoin_a-cleanse.o
  CXX      support/libbitcoin_a-lockedpool.o
  CXX      libbitcoin_a-uint256.o
  CXX      util/libbitcoin_a-spanparsing.o
  CXX      util/libbitcoin_a-strencodings.o
  CXX      libbitcoin_a-value.o
gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -O2 -c src/gen_context.c -o gen_context.o
gcc -Wall -Wextra -Wno-unused-function -g -O2  gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
  CCLD     libsecp256k1.la
  AR       libbitcoin.a
  CC       kerl/libkerl_a-kerl.o
  AR       libkerl.a
  CXXLD    btcdeb
  CXX      btcc-btcc.o
  CXXLD    btcc
  CXX      test_btcdeb-instance.o
  CXX      test_btcdeb-functions.o
  CXX      test/btcdeb-signing.o
  CXX      test/btcdeb-test-btcdeb.o
In file included from test/test-btcdeb.cpp:3:
test/catch.hpp:6334:13: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
            CATCH_BREAK_INTO_DEBUGGER();
            ^
test/catch.hpp:6052:79: note: expanded from macro 'CATCH_BREAK_INTO_DEBUGGER'
    #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()
                                                                              ^
test/catch.hpp:6031:34: note: expanded from macro 'CATCH_TRAP'
    #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
                                 ^
<inline asm>:1:2: note: instantiated into assembly here
        int $3
        ^
1 error generated.
make[1]: *** [test/btcdeb-test-btcdeb.o] Error 1
make: *** [all-recursive] Error 1

libtool dependency

On ubuntu ./autoconfigure.sh fails without libtool.

Makefile.am:3: error: Libtool library used but 'LIBTOOL' is undefined Makefile.am:3: The usual way to define 'LIBTOOL' is to add 'LT_INIT' Makefile.am:3: to 'configure.ac' and run 'aclocal' and 'autoconf' again. Makefile.am:3: If 'LT_INIT' is in 'configure.ac', make sure Makefile.am:3: its definition is in aclocal's search path. Makefile.am: installing 'build-aux/depcomp' parallel-tests: installing 'build-aux/test-driver' autoreconf: automake failed with exit status: 1

Fixed with apt-get install libtool

script pub key declared version not supported when debug P2SH-P2WPKH transaction.

btcdeb can not debug P2SH-P2WPKH transaction,
need support P2SH-P2WPKH or P2SH-P2WSH embbed script.

[btcdeb]$ ./btcdeb --tx=01000000000101edff78210438890748b3b60560dde8b6f06823cd12f7bdd72b6fca7e02a9318200000000171600149a19a31c2fda7d0c30215ec954a20a542aa84ad3ffffffff016003b807000000001976a914bbef244bcad13cffb68b5cef3017c7423675552288ac0247304402207ecbb796a2bc706d90e2ed7efb58f59822bdc4c253b91f6eecd26ca5df1a6bb60220700b737f3c49b2f21bb228fadeab786e2ac78fd87890ede3f5d299e81880d9630121026ccfb8061f235cc110697c0bfb3afb99d82c886672f6b9b5393b25a434c0cbf300000000 --txin=01000000019de0d53310c1ea02469a35c59e580e3f78c52522fa9225516982b3af7a1e3ee9000000006a47304402204e6ea75356f8c3243708722b37018365a8e3be8cc5755fa6c6d2e7605897c331022077c4d972ef450a3c5636e841ae6fa838f4cdcbc2d5cf4090c7d106cd9adb7b060121029d9286a9c0e8b9e8182d5cc18f3848834c906ed6c6c0b49c86b822f0ed67c9baffffffff014097bc070000000017a914dcdc2f89b96c420751e3750da7d5073a81b169468700000000
btcdeb -- type `./btcdeb -h` for start up options
got transaction:
CTransaction(hash=e85f4cbe53, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(8231a9027e, 0), scriptSig=1600149a19a31c2fda7d0c30)
    CScriptWitness(304402207ecbb796a2bc706d90e2ed7efb58f59822bdc4c253b91f6eecd26ca5df1a6bb60220700b737f3c49b2f21bb228fadeab786e2ac78fd87890ede3f5d299e81880d96301, 026ccfb8061f235cc110697c0bfb3afb99d82c886672f6b9b5393b25a434c0cbf3)
    CTxOut(nValue=1.29500000, scriptPubKey=76a914bbef244bcad13cffb68b5cef)

got input tx #0:
CTransaction(hash=8231a9027e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(e93e1e7aaf, 0), scriptSig=47304402204e6ea75356f8c3)
    CScriptWitness()
    CTxOut(nValue=1.29800000, scriptPubKey=a914dcdc2f89b96c420751e3750da7)

input tx index = 0; tx input vout = 0; value = 129800000
script pub key declared version not supported: scriptPubKey=a914dcdc2f89b96c420751e3750da7d5073a81b1694687

had to install automake for mac catalina

otherwise getting:

Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory

i.e. brew automake

LIBTOL is undefined in Ubuntu 16.04

When I try to follow the installation instructions it crashes and returns this

Makefile.am:3: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:3: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:3: to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:3: If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:3: its definition is in aclocal's search path.
autoreconf: automake failed with exit status: 1

Mockvalues produce an error: invalid pubkey pub1

The example found in the Inline operators section of mock-values.md produces the following error:

$ ./btcdeb '[OP_2 OP_DROP sig1 pub1 OP_DUP OP_HASH160 hash160(pub1) OP_EQUALVERIFY OP_CHECKSIG]' --pretend-valid=sig1:pub1
btcdeb 0.3.20 -- type `./btcdeb -h` for start up options
notice: btcdeb has gotten quieter; use --verbose if necessary (this message is temporary)
invalid pubkey pub1

Build Issue for Mac

What I have done:

$ xcode-select --install
$ brew install libtool autoconf
$ GCC --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ ./autogen.sh

Issue:

$ ./configure 
checking build system type... x86_64-apple-darwin18.2.0
checking host system type... x86_64-apple-darwin18.2.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/Users/xxx/btcdeb':
configure: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
$ cat config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Bitcoin Debugger configure 0.16.99, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = xuxinyudeMBP.lan1
uname -m = x86_64
uname -r = 18.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
	 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 368 tasks, 1437 threads, 4 processors
Load average: 1.31, Mach factor: 2.68
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Library/Frameworks/Python.framework/Versions/3.6/bin
PATH: /Users/xuxinyu/anaconda3/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.6/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /Users/xuxinyu/anaconda3/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Library/TeX/texbin
PATH: /usr/local/MacGPG2/bin
PATH: /usr/local/share/dotnet
PATH: ~/.dotnet/tools
PATH: /Library/Frameworks/Mono.framework/Versions/Current/Commands


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2687: checking build system type
configure:2701: result: x86_64-apple-darwin18.2.0
configure:2721: checking host system type
configure:2734: result: x86_64-apple-darwin18.2.0
configure:2777: checking for a BSD-compatible install
configure:2845: result: /usr/bin/install -c
configure:2856: checking whether build environment is sane
configure:2911: result: yes
configure:3062: checking for a thread-safe mkdir -p
configure:3101: result: build-aux/install-sh -c -d
configure:3108: checking for gawk
configure:3138: result: no
configure:3108: checking for mawk
configure:3138: result: no
configure:3108: checking for nawk
configure:3138: result: no
configure:3108: checking for awk
configure:3124: found /usr/bin/awk
configure:3135: result: awk
configure:3146: checking whether make sets $(MAKE)
configure:3168: result: yes
configure:3197: checking whether make supports nested variables
configure:3214: result: yes
configure:3333: checking whether to enable maintainer-specific portions of Makefiles
configure:3342: result: yes
configure:3367: checking whether make supports nested variables
configure:3384: result: yes
configure:3513: checking for C++ compiler version
configure:3522: x86_64-apple-darwin13.4.0-clang++ --version >&5
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
InstalledDir: /Users/xuxinyu/anaconda3/bin
configure:3533: $? = 0
configure:3522: x86_64-apple-darwin13.4.0-clang++ -v >&5
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
InstalledDir: /Users/xuxinyu/anaconda3/bin
configure:3533: $? = 0
configure:3522: x86_64-apple-darwin13.4.0-clang++ -V >&5
clang-4.0: error: argument to '-V' is missing (expected 1 value)
clang-4.0: error: no input files
configure:3533: $? = 1
configure:3522: x86_64-apple-darwin13.4.0-clang++ -qversion >&5
clang-4.0: error: unknown argument: '-qversion'
clang-4.0: error: no input files
configure:3533: $? = 1
configure:3553: checking whether the C++ compiler works
configure:3575: x86_64-apple-darwin13.4.0-clang++ -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs conftest.cpp  >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
configure:3579: $? = 0
configure:3627: result: yes
configure:3630: checking for C++ compiler default output file name
configure:3632: result: a.out
configure:3638: checking for suffix of executables
configure:3645: x86_64-apple-darwin13.4.0-clang++ -o conftest -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs conftest.cpp  >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
configure:3649: $? = 0
configure:3671: result: 
configure:3693: checking whether we are cross compiling
configure:3701: x86_64-apple-darwin13.4.0-clang++ -o conftest -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs conftest.cpp  >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture x86_64:
  "_fclose", referenced from:
      _main in conftest-0ac0d1.o
  "_ferror", referenced from:
      _main in conftest-0ac0d1.o
  "_fopen", referenced from:
      _main in conftest-0ac0d1.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3705: $? = 1
configure:3712: ./conftest
./configure: line 3714: ./conftest: No such file or directory
configure:3716: $? = 127
configure:3723: error: in `/Users/xuxinyu/btcdeb':
configure:3725: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-apple-darwin18.2.0
ac_cv_env_ARFLAGS_set=
ac_cv_env_ARFLAGS_value=
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-apple-darwin13.4.0-clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0'
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=x86_64-apple-darwin13.4.0-clang++
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_OBJCXXFLAGS_set=
ac_cv_env_OBJCXXFLAGS_value=
ac_cv_env_OBJCXX_set=
ac_cv_env_OBJCXX_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_PYTHONPATH_set=set
ac_cv_env_PYTHONPATH_value=/Library/Frameworks/Python.framework/Versions/3.6:
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin18.2.0
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /Users/xuxinyu/btcdeb/build-aux/missing aclocal-1.16'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='0'
AM_V='$(V)'
AR='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-ar'
ARFLAGS='cr'
AUTOCONF='${SHELL} /Users/xuxinyu/btcdeb/build-aux/missing autoconf'
AUTOHEADER='${SHELL} /Users/xuxinyu/btcdeb/build-aux/missing autoheader'
AUTOMAKE='${SHELL} /Users/xuxinyu/btcdeb/build-aux/missing automake-1.16'
AWK='awk'
BITCOIN_CLI_NAME=''
BITCOIN_DAEMON_NAME=''
BITCOIN_GUI_NAME=''
BITCOIN_TX_NAME=''
BREW=''
BUILD_DARWIN_FALSE=''
BUILD_DARWIN_TRUE=''
CC='x86_64-apple-darwin13.4.0-clang'
CCACHE=''
CCDEPMODE=''
CFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe'
CLIENT_VERSION_BUILD=''
CLIENT_VERSION_IS_RELEASE=''
CLIENT_VERSION_MAJOR=''
CLIENT_VERSION_MINOR=''
CLIENT_VERSION_REVISION=''
COPYRIGHT_HOLDERS=''
COPYRIGHT_HOLDERS_FINAL=''
COPYRIGHT_HOLDERS_SUBSTITUTION=''
COPYRIGHT_YEAR=''
CPP=''
CPPFILT=''
CPPFLAGS='-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9'
CXX='x86_64-apple-darwin13.4.0-clang++'
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0'
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_DANGEROUS_FALSE=''
ENABLE_DANGEROUS_TRUE=''
ENABLE_WALLET_FALSE=''
ENABLE_WALLET_TRUE=''
EXEEXT=''
FGREP=''
GCOV=''
GENHTML=''
GENISOIMAGE=''
GIT=''
GLIBC_BACK_COMPAT_FALSE=''
GLIBC_BACK_COMPAT_TRUE=''
GREP=''
HAVE_CXX11=''
HEXDUMP=''
IMAGEMAGICK_CONVERT=''
INSTALLNAMETOOL=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LCOV=''
LD='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-ld'
LDFLAGS='-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs'
LIBOBJS=''
LIBS=''
LIBTOOL='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-libtool'
LIBTOOL_APP_LDFLAGS=''
LIPO='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-lipo'
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAINT=''
MAINTAINER_MODE_FALSE='#'
MAINTAINER_MODE_TRUE=''
MAKEINFO='${SHELL} /Users/xuxinyu/btcdeb/build-aux/missing makeinfo'
MAKENSIS=''
MANIFEST_TOOL=''
MKDIR_P='build-aux/install-sh -c -d'
NM='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-nm'
NMEDIT='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-nmedit'
OBJCOPY=''
OBJCXX=''
OBJCXXDEPMODE=''
OBJCXXFLAGS=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-otool'
PACKAGE='btcdeb'
PACKAGE_BUGREPORT='https://github.com/kallewoof/btcdeb/issues'
PACKAGE_NAME='Bitcoin Debugger'
PACKAGE_STRING='Bitcoin Debugger 0.16.99'
PACKAGE_TARNAME='btcdeb'
PACKAGE_URL='https://twitter.com/kallewoof'
PACKAGE_VERSION='0.16.99'
PATH_SEPARATOR=':'
PIC_FLAGS=''
PIE_FLAGS=''
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
PORT=''
PTHREAD_CC=''
PTHREAD_CFLAGS=''
PTHREAD_LIBS=''
PYTHON=''
PYTHONPATH='/Library/Frameworks/Python.framework/Versions/3.6:'
RANLIB='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-ranlib'
READELF=''
RELDFLAGS=''
RSVG_CONVERT=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
SSE42_CXXFLAGS=''
STRIP='/Users/xuxinyu/anaconda3/bin/x86_64-apple-darwin13.4.0-strip'
TARGET_DARWIN_FALSE=''
TARGET_DARWIN_TRUE=''
TARGET_WINDOWS_FALSE=''
TARGET_WINDOWS_TRUE=''
TIFFCP=''
VERSION='0.16.99'
WINDOWS_BITS=''
WINDRES=''
XGETTEXT=''
ac_ct_AR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_DUMPBIN=''
ac_ct_OBJCXX=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__fastdepOBJCXX_FALSE=''
am__fastdepOBJCXX_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
ax_pthread_config=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin18.2.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin18.2.0'
build_vendor='apple'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-apple-darwin18.2.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin18.2.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /Users/xuxinyu/btcdeb/build-aux/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "Bitcoin Debugger"
#define PACKAGE_TARNAME "btcdeb"
#define PACKAGE_VERSION "0.16.99"
#define PACKAGE_STRING "Bitcoin Debugger 0.16.99"
#define PACKAGE_BUGREPORT "https://github.com/kallewoof/btcdeb/issues"
#define PACKAGE_URL "https://twitter.com/kallewoof"

configure: exit 1

Thanks!

Unable to build on Mac

Make command seems to begin failing at ld: warning: ignoring file libbitcoin.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Exits with
clang: error: linker command failed with exit code 1...
make[1]: *** [btcdeb] Error 1 make: *** [all-recursive] Error 1

Also notable is this warning in autogen.sh:

configure.ac:36: warning: The macro 'AC_PROG_CC_C89' is obsolete.

Full output attached.
output.txt

No rule to make target `libsecp256k1.la'. Stop.

I've cloned and compiled the project before & it worked.

After a recent pull and running:

./autogen.sh
./configure
make

With the last command, I'm getting:

  CXX      btcdeb-btcdeb.o
  CXX      libbitcoin_a-base58.o
  CXX      libbitcoin_a-bech32.o
  CXX      crypto/libbitcoin_a-hmac_sha512.o
  CXX      crypto/libbitcoin_a-ripemd160.o
  CXX      crypto/libbitcoin_a-sha1.o
  CXX      crypto/libbitcoin_a-sha256.o
  CXX      crypto/libbitcoin_a-sha512.o
  CXX      libbitcoin_a-hash.o
  CXX      libbitcoin_a-interpreter.o
  CXX      primitives/libbitcoin_a-transaction.o
  CXX      libbitcoin_a-pubkey.o
  CXX      libbitcoin_a-script.o
  CXX      libbitcoin_a-script_error.o
  CXX      support/libbitcoin_a-cleanse.o
  CXX      libbitcoin_a-uint256.o
  CXX      libbitcoin_a-utilstrencodings.o
make[2]: *** No rule to make target `libsecp256k1.la'.  Stop.
make[1]: *** [secp256k1/libsecp256k1.la] Error 2
make: *** [all-recursive] Error 1

I lack experience with C++. Any way to fix it?

Not seeing debug info

For example running https://github.com/bitcoin-core/btcdeb/blob/master/doc/example-multisig-invalid-order.txt

I don't see any additional information, I think. Tested on both Mac and Ubuntu.

example output:

DEBUG_SIGNING=1 DEBUG_SIGHASH=1 ./btcdeb --txin 0100000001ea6dc5155af6b22cd957873892379acf9fe86c31d6574adb9c30e71c0b0000006a47304402200385fd7fefbdf067a914b5025c63e2611d3152f832737aa0691236be28309691022049bacd2d1bae5110898f437bad5e0369f6bb3353fba4a8baf04d6783e7fd8d6a012102c51cefa2021229777bc0a2aa9e0a4e0940a7676776629795f46b973ec57ddd01ffffffff02323d9700000000001976a91414d68781cbcde58fd25d3de831058b60125daf7588aca08601000000000017a9144b86dfac7f503de1127366815d1d4524132824668700000000 --tx 010000000183dfe2acd820d0214a18260f423be96f3c387098a311f78c877ac5947c68697e01000000fd5d01004730440220338862b4a13d67415fdaac35d408bd2a6d86e4c3be03b7abc92ee769b254dbe1022043ba94f304aff774fdb957af078c9b302425976370cc66f42ae05382c84ea5ea01483045022100acb79a21e7e6cea47a598254e02639f87b5fa9a08c0ec8455503da0a479c19560220724014c241ac64ffc108d4457302644d5d057fbc4f2edbf33a86f24cf0b10447014cc9524104a97b658c114d77dc5f71736ab78fbe408ce632ed1478d7eaa106eef67c55d58a91c6449de4858faf11721e85fe09ec850c6578432eb4be9a69c76232ac593c3b4104019ef04a316792f0ecbe5ab1718c833c3964dee3626cfabe19d97745dbcaa5198919081b456e8eeea5898afa0e36d5c17ab693a80d728721128ed8c5f38cdba04104a04f29f308160e6f945b33d943304b1b471ed8f9eaceeb5412c04e60a0fab0376871d9d1108948b67cafbc703e565a18f8351fb8558fd7c7482d7027eecd687c53aeffffffff01905f0100000000001976a9145fa5be58f939d6ae79636c2143fa9e7924102c1588ac00000000
btcdeb 0.2.20 -- type `./btcdeb -h` for start up options
got transaction 56ae0d780759b8126a3eb9be605b1a6e48acb326af527547205d6749afab1a61:
CTransaction(hash=56ae0d7807, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(7e69687c94, 1), scriptSig=004730440220338862b4a13d)
    CScriptWitness()
    CTxOut(nValue=0.00090000, scriptPubKey=76a9145fa5be58f939d6ae79636c21)

got input tx #0 7e69687c94c57a878cf711a39870383c6fe93b420f26184a21d020d8ace2df83:
CTransaction(hash=7e69687c94, ver=1, vin.size=1, vout.size=2, nLockTime=0)
    CTxIn(COutPoint(1ce7309cdb, 11), scriptSig=47304402200385fd7fefbdf0)
    CScriptWitness()
    CTxOut(nValue=0.09911602, scriptPubKey=76a91414d68781cbcde58fd25d3de8)
    CTxOut(nValue=0.00100000, scriptPubKey=a9144b86dfac7f503de1127366815d)

input tx index = 0; tx input vout = 1; value = 100000
15 op script loaded. type `help` for usage information
script                                                             |  stack 
-------------------------------------------------------------------+--------
0                                                                  | 
30440220338862b4a13d67415fdaac35d408bd2a6d86e4c3be03b7abc92ee76... | 
3045022100acb79a21e7e6cea47a598254e02639f87b5fa9a08c0ec8455503d... | 
524104a97b658c114d77dc5f71736ab78fbe408ce632ed1478d7eaa106eef67... | 
<<< scriptPubKey >>>                                               | 
OP_HASH160                                                         | 
4b86dfac7f503de1127366815d1d452413282466                           | 
OP_EQUAL                                                           | 
<<< P2SH script >>>                                                | 
2                                                                  | 
04a97b658c114d77dc5f71736ab78fbe408ce632ed1478d7eaa106eef67c55d... | 
04019ef04a316792f0ecbe5ab1718c833c3964dee3626cfabe19d97745dbcaa... | 
04a04f29f308160e6f945b33d943304b1b471ed8f9eaceeb5412c04e60a0fab... | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0000 0
btcdeb>

btcc - different results depending on input format

I was playing with btcc and noticed something strange.
In both cases the input script is the same, but in the second case the push opcode is missing.

$ btcc '[OP_ADD 99 OP_EQUAL]'
warning: ambiguous input 99 is interpreted as a numeric value; use 0x99 to force into hexadecimal interpretation
93016387
$ btcc OP_ADD 99 OP_EQUAL
warning: ambiguous input 99 is interpreted as a numeric value; use 0x99 to force into hexadecimal interpretation
936387

Is this the intended behaviour?

Wrong TapLeaf for scripts 253 bytes and longer

"tf tagged-hash TapLeaf" results in wrong outputs for 253 bytes and longer scripts. This is apparently due to the wrong var int compact_size(script size).

For example;
For a 252-byte long script, compact_size(script size) should set to = 0xfc
For a 253-byte long script, compact_size(script size) should set to = 0xfdfd00

segmentation fault tap on macOS 11.2.3

Hello - I'm getting a segmentation fault while running tap

OS Details:

ProductName: macOS
ProductVersion: 11.2.3
BuildVersion: 20D91

Darwin snj-mac.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Error:

tap $pubkey 2 $script_alice $script_bob
tap 0.4.21 -- type `tap -h` for help
WARNING: This is experimental software. Do not use this with real bitcoin, or you will most likely lose them all. You have been w a r n e d.
LOG: sign segwit taproot
Internal pubkey: f30544d6009c8d8d94f5d030b2e844b1a3ca036255161c479db1cca5b374dd1c
2 scripts:
- #0: 029000b275209997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803beac
- #1: a8206c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd533388204edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10ac
Script #0 leaf hash = TapLeaf<<0xc0 || 029000b275209997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803beac>>
 → c81451874bd9ebd4b6fd4bba1f84cdfb533c532365d22a0a702205ff658b17c9
Script #1 leaf hash = TapLeaf<<0xc0 || a8206c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd533388204edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10ac>>
 → 632c8632b4f29c6291416e23135cf78ecb82e525788ea5ed6483e3c6ce943b42
Branch (#0, #1)
 → 41646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b
Tweak value = TapTweak(f30544d6009c8d8d94f5d030b2e844b1a3ca036255161c479db1cca5b374dd1c || 41646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b) = 620fc4000ba539753ffa0e5893b4243cb1cf0a258cf8a09a9038f5f1352607a9
[1]    37883 segmentation fault  tap $pubkey 2 $script_alice $script_bob

Issue running transaction verification example in README

I checked transaction verification example today, but it doesn't work anymore. Seems when the docs were added (1d6c065) it worked well, but it doesn't currently convert the ws to a sequence of ops.

Will dig into this a bit more later, just posting here for now :)

Last working commit (before the rebase) 4578842

Same Transaction, different result

Hi,
I'm playing with btcdeb and I want to analyze my transaction to understand malleability.

The signature is ok because it is confirmed on blockchain

Now I want to debug the transaction.
If I use tx and txid the result is 01.
btcdeb --tx=02000000016d0bafbe058c16f8a66ed330d7218aa566fb39efa18d870faa99d365907e543a000000006c52754730440220192b64bb3952c144ead43fdb5286007388785d81fd90ecedfba8bf7a5ea0a1ad02205891ceb16a793adad74497ee5f4a3eb42f6a6e4e1602b540f434e711a7d3521b012102ab74ff5864c29ab400030afc05a7c141c4970707fef9dbb0ac24115867c987a5ffffffff01a0bb0d00000000001976a914aec36b59e621343037fd7a4f97f46995cf0533cc88ac00000000 --txin=010000000001014c972deb5303774560bbb47689ffc9591421b293abcac73e6524764fb8f0e8dd0100000000f0ffffff0340420f00000000001976a914ccbdfc0f1e5fc51e01d50c9ebc37ca7c323c05b588ac0a302b00000000001600149ff604fed7c5c4b7929bc4ec67d4ce3a10f562b10000000000000000196a1768747470733a2f2f746274632e6269746170732e636f6d024730440220695be41f6396687fbfe8395a5e562e483c30fa272ca8198df6a5c444f930edff02206f251a96e926cd8a22d21f784be855e1ae38ff345223fd2e3202c4d86fcab2c0012102099ad04f4be7b2883e0a32d50250b48282db2bf918a464b4bbe39ebf3b86d94d00000000

If I use
btcdeb '[OP_2 OP_DROP 30440220192b64bb3952c144ead43fdb5286007388785d81fd90ecedfba8bf7a5ea0a1ad02205891ceb16a793adad74497ee5f4a3eb42f6a6e4e1602b540f434e711a7d3521b01 02ab74ff5864c29ab400030afc05a7c141c4970707fef9dbb0ac24115867c987a5 OP_DUP OP_HASH160 ccbdfc0f1e5fc51e01d50c9ebc37ca7c323c05b5 OP_EQUALVERIFY OP_CHECKSIG]'

I get this alert

Signature must be zero for failed CHECK(MULTI)SIG operation (is this a historical transaction from before NULLFAIL enforcement? Try with --modify-flags=-NULLFAIL)

I tried with that flag and the final result is 0x

Script verification fails for valid transaction

Debugger is giving a bad sig error for a valid signature. I know it's valid because the transaction was accepted by the network. This may be a bug in your sighash implementation. The SIGHASH_ALL for this input is 3a3e868a8ecd6c213007561a81c66008661a8bd831f7d528bd3cb553fd2dcfef.

Relevant tx:
https://blockstream.info/tx/245b31ba640bb06862b90e862cac5613088b0e5200af9619aa9f0d500e8dbd07

Input tx:
https://blockstream.info/tx/bda7ca825e43151ff149fbf0132daf3cd821d47d6f90f01d9e96039175660623

To reproduce:

🌑  $ btcdeb --tx=01000000000102d200f8939dd0b1078c39426d19a91112beecafdd33d0b2c8407acc81a7bccc6d0000000000feffffff230666759103969e1df0906f7dd421d83caf2d13f0fb49f11f15435e82caa7bd0100000000feffffff0292681e0000000000160014ef664686809ac47fdb5a1909bde542f248cf200b0000000000000000166a14a2760fae2b10c85d48951b0077aa9cd32954cb880248304502210083b8a3569df9cdd8ead0cb2217c82b73d8427eba1359583856d66ed0485f97eb0220587561cffc22ef06bcde5457e22535bf764787e53a910ae832cad973604376db0121038b8f1123a130e976f95b160b5ab54c308482b8b57a33b113b56c5e28c0641f2102483045022100da7237baba714c9b0680369f6aa45e23b1175c61061ae50c225e889882434e7a0220274746f72290e7e34063ccce333c4c6ee4eae4f53283d59d29c62b092455bf960121038b8f1123a130e976f95b160b5ab54c308482b8b57a33b113b56c5e28c0641f2100000000 --txin=01000000000101d1e0f4cebc2322072ba36d338580279900c53c50ef329f8e3d9f6947c1d41d7b0000000000feffffff02a8ba06000000000016001442a870dbf5fdb9e72a87d170cd352823c0208bba80841e0000000000160014ef664686809ac47fdb5a1909bde542f248cf200b02483045022100a7b09b01fa54dfa46030de6c8ba13a3dc0db63a4d157e314a76629816a5776b002201e49477972520879ecf640027f3a322667b4f5ec561ebbd3811a495fc1994fad012103dce50589d2b42e65f6c81fc55c7bd700b52337e4a9aedec61d8f1162332ff30721790800

End result:

script                                   |                                                             stack 
-----------------------------------------+-------------------------------------------------------------------
OP_CHECKSIG                              | 038b8f1123a130e976f95b160b5ab54c308482b8b57a33b113b56c5e28c0641f21
                                         | 3045022100da7237baba714c9b0680369f6aa45e23b1175c61061ae50c225e8...
#0004 OP_CHECKSIG
btcdeb> step
error: Signature must be zero for failed CHECK(MULTI)SIG operation (is this a historical transaction from before NULLFAIL enforcement? Try with --modify-flags=-NULLFAIL)

got witness stack of size 0

Just tried to go step-by-step through your Tapscript example using Tap. Installed/compiled and started with the following command:

tap \
--privkey=1229101a0fcf2104e8808dab35661134aa5903867d44deb73ce1c7e4eb925be8 \
--tx=02000000015ef2502ea8ec2314b97034cdef696a662ab2b70ef1ee4b61dd1665171dacdcd40000000000ffffffff01905f01000000000016001484db588517f65341b0f129b0a1fc38cafb20151000000000 \
--txin=0200000000010162ba7ef7f4ed7e7e1f2fbca227459e1246b565f6c262fdc3f720415d7d1a46d40100000000feffffff02a086010000000000225120a5ba0871796eb49fb4caa6bf78e675b9455e2d66e751676420f8381d5dda8951c785ff2901000000160014068d953d034da27b8affddb1e66240c2c0ccb30c0247304402202f11adb63ae0563d6cbb1955421c7081ac559319b924f1519b3e35b334c8721b02207436ed5d3b9490c7796ee4d4fe2a90f8697c49fb4b4a8531e9446a658cef2c7d0121023f9b34f7749620702e1ade7d8f29f6d1d86122bc0dcf2aac6af1cc7cbb11d91046020000 \
f30544d6009c8d8d94f5d030b2e844b1a3ca036255161c479db1cca5b374dd1c \
2 \
'[144 OP_CHECKSEQUENCEVERIFY OP_DROP 9997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803be OP_CHECKSIG]' \
'[OP_SHA256 6c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd5333 OP_EQUALVERIFY 4edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10 OP_CHECKSIG]'

Then received strange output, part of it corresponds to what to be expected:

tap 0.2.19 -- type `tap -h` for help
WARNING: This is experimental software. Do not use this with real bitcoin, or you will most likely lose them all. You have been w a r n e d.
LOG: sign segwit taproot
targeting transaction vin at index #0
Internal pubkey: f30544d6009c8d8d94f5d030b2e844b1a3ca036255161c479db1cca5b374dd1c
- no spend arguments; TAPROOT mode
2 scripts:
- #0: 029000b275209997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803beac
- #1: a8206c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd533388204edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10ac
Script #0 leaf hash = TapLeaf<<0xc0 || 029000b275209997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803beac>>
 → c81451874bd9ebd4b6fd4bba1f84cdfb533c532365d22a0a702205ff658b17c9
Script #1 leaf hash = TapLeaf<<0xc0 || a8206c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd533388204edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10ac>>
 → 632c8632b4f29c6291416e23135cf78ecb82e525788ea5ed6483e3c6ce943b42
Branch (#0, #1)
 → 41646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b
Tweak value = TapTweak(f30544d6009c8d8d94f5d030b2e844b1a3ca036255161c479db1cca5b374dd1c || 41646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b) = 620fc4000ba539753ffa0e5893b4243cb1cf0a258cf8a09a9038f5f1352607a9
Tweaked pubkey = a5ba0871796eb49fb4caa6bf78e675b9455e2d66e751676420f8381d5dda8951 (not negated)
Pubkey matches the scriptPubKey of the input transaction's output #0
Resulting Bech32 address: sb1p5kaqsuted66fldx256lh3en4h9z4uttxuagkwepqlqup6hw639gsy7hxn9
tweaked privkey -> 4fe6b3e5fbd61870577980ad5e4e13080776069f0fb3c1e353572e0c4993abc1
The given private key matches the tweaked public key
input tx index = 0; tx input vout = 0; value = 100000

Then the result differs from expected output:

got witness stack of size 0
ERROR: exhausted variants with no match (single) <-- added std::cerr << exc.what();
miniscript failed to parse script; miniscript support disabled
SignatureHashSchnorr(in_pos=0, hash_type=00)
- UNKNOWN sighash
tap: script/interpreter.cpp:1476: bool SignatureHashSchnorr(uint256&, const ScriptExecutionData&, const T&, unsigned int, uint8_t, SigVersion, const PrecomputedTransactionData&) [with T = CTransaction; uint8_t = unsigned char]: Assertion `false' failed.
Aborted (core dumped)

Trying to follow low level (btcdeb) utility guide produced some output, yet this output was rejected by BTC node (compiled from taproot/Schnorr enabled branch). Here I believe that I could miss something when dealing with btcdeb, however I believe tap should work as expected and produce got witness stack of size 1 as in example. I added exception logging into instance.cpp that produced line

ERROR: exhausted variants with no match (single)

Running `make` shows error missing `#include <cstring>` in file `strencodings.h`

I just tried to make btcdeb and I got the following error:

make[1]: Entering directory '/home/standup/btcdeb'
  CXX      util/libbitcoin_a-strencodings.o
In file included from util/strencodings.cpp:6:
./util/strencodings.h: In function ‘bool ValidAsCString(const string&)’:
./util/strencodings.h:31:26: error: ‘strlen’ was not declared in this scope
   31 |     return str.size() == strlen(str.c_str());
      |                          ^~~~~~
./util/strencodings.h:17:1: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
   16 | #include <iterator>
  +++ |+#include <cstring>
   17 | #include <string>
make[1]: *** [Makefile:1345: util/libbitcoin_a-strencodings.o] Error 1
make[1]: Leaving directory '/home/standup/btcdeb'
make: *** [Makefile:1626: all-recursive] Error 1

After this I simple included #include <cstring> in the file ./util/strencodings.h and I ran fine.

Please fix :)

How to use exec command

Maybe this isn't implemented yet, or I'm doing it wrong, but I've tried:

btcdeb> exec OP_1
Error: Opcode missing or not understood
script  |  stack
--------+--------
btcdeb> exec 'OP_1'
Error: Opcode missing or not understood
script  |  stack
--------+--------
btcdeb> exec '[OP_1]'
error: invalid opcode [OP_1]
script  |  stack
--------+--------
btcdeb> exec 'OP_1 OP_2 OP_ADD'
error: invalid opcode OP_1 OP_2 OP_ADD
script  |  stack
--------+--------
btcdeb> exec 'OP_ADD'
Error: Opcode missing or not understood
script  |  stack
--------+--------

Emscripten compilation error

I receive the following compilation error when compiling to Emscripten as per the instructions here:

wasm-ld: error: --shared-memory is disallowed by btcdeb-instance.o because it was not compiled with 'atomics' or 'bulk-memory' features.

My Emscripten SDK is at the following version:

$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.2 (a77b559a8b40b7e89fc8c17e41034128df9543e4)
clang version 14.0.0 (https://github.com/llvm/llvm-project 782c0dd1a1c235afb09a34e7da4a1267ead14765)
Target: wasm32-unknown-emscripten
Thread model: posix

I attempted the compilation on both the master branch and the 0.3.20 tag.

A bit of research led me to believe that the makefile could have an issue with pthread flags; however, I don't have the ability to pursue that lead meaningfully. Any help would be greatly appreciated. Thank you!

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.