mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	Merge pull request #155 from BlockchainCommons/20200817-btcdeb-comments
Update 09_3_Testing_a_Bitcoin_Script.md
This commit is contained in:
		
						commit
						2686e95011
					
				| @ -10,10 +10,10 @@ This chapter thus describes a prime method for testing Bitcoin Scripts, which we | |||||||
| 
 | 
 | ||||||
| The Bitcoin Script Debugger (`btcdeb`) by @kallewoof is one of the most reliable methods we've found for debugging Bitcoin Scripts. It does, however, require setting up C++ and a few other accessories on your machine, so we'll also offer a few other options toward the end of this chapter. | The Bitcoin Script Debugger (`btcdeb`) by @kallewoof is one of the most reliable methods we've found for debugging Bitcoin Scripts. It does, however, require setting up C++ and a few other accessories on your machine, so we'll also offer a few other options toward the end of this chapter. | ||||||
| 
 | 
 | ||||||
| First, you need to clone the `btcdeb` GitHub, which will also require installing `git if you don't yet have it. | First, you need to clone the `btcdeb` GitHub repository, which will also require installing `git` if you don't yet have it. | ||||||
| ``` | ``` | ||||||
| $ sudo apt-get install git | $ sudo apt-get install git | ||||||
| $ git clone https://github.com/kallewoof/btcdeb.git | $ git clone https://github.com/bitcoin-core/btcdeb.git | ||||||
| ``` | ``` | ||||||
| Note that when you run `git clone` it will copy `btcdeb` into your current directory. We've chosen to do so in our `~standup` directory. | Note that when you run `git clone` it will copy `btcdeb` into your current directory. We've chosen to do so in our `~standup` directory. | ||||||
| ``` | ``` | ||||||
| @ -24,6 +24,10 @@ Afterward, you must install required C++ and other packages. | |||||||
| ``` | ``` | ||||||
| $ sudo apt-get install autoconf libtool g++ pkg-config make | $ sudo apt-get install autoconf libtool g++ pkg-config make | ||||||
| ``` | ``` | ||||||
|  | You should also install readline, as this makes the debugger a lot easier to use by supporting history using up/down arrows, left-right movement, autocompletion using tab, and other good user interfaces.  | ||||||
|  | ``` | ||||||
|  | $ sudo apt-get install libreadline-dev | ||||||
|  | ``` | ||||||
| You're now ready to compile and install `btcdeb`: | You're now ready to compile and install `btcdeb`: | ||||||
| ``` | ``` | ||||||
| $ cd btcdeb | $ cd btcdeb | ||||||
| @ -37,10 +41,6 @@ After all of that, you should have a copy of `btcdeb`: | |||||||
| $ which btcdeb | $ which btcdeb | ||||||
| /usr/local/bin/btcdeb | /usr/local/bin/btcdeb | ||||||
| ``` | ``` | ||||||
| You should also install readline, as this makes the debugger a lot easier to use by supporting history using up/down arrows, left-right movement, autocompletion using tab, and other good user interfaces.  |  | ||||||
| ``` |  | ||||||
| $ sudo apt-get install libreadline-dev |  | ||||||
| ``` |  | ||||||
| 
 | 
 | ||||||
| ## Use btcdeb | ## Use btcdeb | ||||||
| 
 | 
 | ||||||
| @ -188,7 +188,7 @@ Using these commands can make it easier to see what's going on and where you are | |||||||
| 
 | 
 | ||||||
| There are also a few web simulators that you can use to test scripts online. They can be superior to a command-line tool by offering a more graphical output, but we also find that they tend to have shortcomings. | There are also a few web simulators that you can use to test scripts online. They can be superior to a command-line tool by offering a more graphical output, but we also find that they tend to have shortcomings. | ||||||
| 
 | 
 | ||||||
| In the past we've tried to give extensive guidelines on using sites such as the [Script Playground](http://www.crmarsh.com/script-playground/) or the [Bitcoin Online Script Debugger](https://bitcoin-script-debugger.visvirial.com/), but they become out of date and/or disappear to quickly to keep up with them. | In the past we've tried to give extensive guidelines on using sites such as the [Script Playground](http://www.crmarsh.com/script-playground/) or the [Bitcoin Online Script Debugger](https://bitcoin-script-debugger.visvirial.com/), but they become out of date and/or disappear too quickly to keep up with them. | ||||||
| 
 | 
 | ||||||
| Assume that these debuggers have the nice advantage of showing things visually and explicitly telling you whether a script succeeds (unlocks) or fails (stays locked). Assume that they have disadvantages with signatures, where many of them either always return `true` for signature tests or else have very cumbersome mechanisms for incorporating them. | Assume that these debuggers have the nice advantage of showing things visually and explicitly telling you whether a script succeeds (unlocks) or fails (stays locked). Assume that they have disadvantages with signatures, where many of them either always return `true` for signature tests or else have very cumbersome mechanisms for incorporating them. | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user