Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 01, 2015, 11:25:16 PM Last edit: September 03, 2015, 05:47:42 PM by Kefkius Merited by malevolent (10) |
|
Hashmal Hashmal is an IDE for Bitcoin transaction scripts. Its purpose is to make it easier to write, evaluate, and learn about transaction scripts. There are very few tools that help people learn about how transaction scripts work; hopefully Hashmal can do this. Demonstration of stack evaluation. Hashmal is intended for cryptocurrency developers and power users. It uses python-bitcoinlib for most of its functionality. Key Features- Write scripts in human-readable form.
- Observe the stack as scripts are executed.
- See explanations of script operations as they are evaluated.
NoticeHashmal is a project in its infancy. Please be careful if you intend to use any scripts you make in Hashmal with an actual blockchain. This is alpha software.You can download Hashmal from Github.
|
|
|
|
Uptrenda
Member
Offline
Activity: 114
Merit: 16
|
|
September 01, 2015, 11:40:51 PM |
|
First POST and OP congratulations because you just solved a problem that every Bitcoin developer of the past few years has grappled with. I'm definitely going to be checking this out.
Edit: seems like an easy improvement to this is add another field for raw transactions to check that the TX is valid and to inspect the script works as intended. I just noticed what you wrote about multi-sig but should be quite easy to code this (pybitcoin-lib already has all the code.)
|
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 03, 2015, 03:36:44 AM |
|
First POST and OP congratulations because you just solved a problem that every Bitcoin developer of the past few years has grappled with. I'm definitely going to be checking this out.
Edit: seems like an easy improvement to this is add another field for raw transactions to check that the TX is valid and to inspect the script works as intended. I just noticed what you wrote about multi-sig but should be quite easy to code this (pybitcoin-lib already has all the code.)
Thanks! The thing about CHECKSIG is that the Stack View tool was getting pretty crowded so I didn't put in any way to include a transaction. But you're definitely right in that it wouldn't be very difficult to do. I think the best way to accomplish that is to create a tool called "Transaction Deserializer" or some such, and have it be able to interact with the Stack View tool. I'll give that a shot.
|
|
|
|
|
Uptrenda
Member
Offline
Activity: 114
Merit: 16
|
|
September 03, 2015, 04:17:10 AM |
|
First POST and OP congratulations because you just solved a problem that every Bitcoin developer of the past few years has grappled with. I'm definitely going to be checking this out.
Edit: seems like an easy improvement to this is add another field for raw transactions to check that the TX is valid and to inspect the script works as intended. I just noticed what you wrote about multi-sig but should be quite easy to code this (pybitcoin-lib already has all the code.)
Thanks! The thing about CHECKSIG is that the Stack View tool was getting pretty crowded so I didn't put in any way to include a transaction. But you're definitely right in that it wouldn't be very difficult to do. I think the best way to accomplish that is to create a tool called "Transaction Deserializer" or some such, and have it be able to interact with the Stack View tool. I'll give that a shot. Oh man, where were you 2 years ago when I was getting started? I'm wishing good things for this project
|
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 03, 2015, 07:15:39 AM |
|
I hadn't thought of that. It's a good idea, albeit one that would complicate starting Hashmal (e.g. compiling the C++ extension). The current method of stepping through scripts - via re-implementing EvalScript() from python-bitcoinlib - is rather inelegant. I'm also relatively unfamiliar with C++ (as opposed to C) extensions in Python. Anyway, there probably should be a better implementation of script evaluation, so that's currently the only option on the table. First POST and OP congratulations because you just solved a problem that every Bitcoin developer of the past few years has grappled with. I'm definitely going to be checking this out.
Edit: seems like an easy improvement to this is add another field for raw transactions to check that the TX is valid and to inspect the script works as intended. I just noticed what you wrote about multi-sig but should be quite easy to code this (pybitcoin-lib already has all the code.)
Thanks! The thing about CHECKSIG is that the Stack View tool was getting pretty crowded so I didn't put in any way to include a transaction. But you're definitely right in that it wouldn't be very difficult to do. I think the best way to accomplish that is to create a tool called "Transaction Deserializer" or some such, and have it be able to interact with the Stack View tool. I'll give that a shot. Oh man, where were you 2 years ago when I was getting started? I'm wishing good things for this project Thanks for the good wishes.
|
|
|
|
Luke-Jr
Legendary
Offline
Activity: 2576
Merit: 1186
|
|
September 03, 2015, 07:33:38 AM |
|
I hadn't thought of that. It's a good idea, albeit one that would complicate starting Hashmal (e.g. compiling the C++ extension). The current method of stepping through scripts - via re-implementing EvalScript() from python-bitcoinlib - is rather inelegant. I'm also relatively unfamiliar with C++ (as opposed to C) extensions in Python. Anyway, there probably should be a better implementation of script evaluation, so that's currently the only option on the table. libbitcoinconsensus, while it does use C++, exports only a C API Should be able to just use ctypes I would think (with stock libbitcoinconsensus lib). (Of course, this only works with #6178 merged )
|
|
|
|
sAt0sHiFanClub
|
|
September 03, 2015, 08:07:40 AM |
|
Well done, this looks really good. I think you are going in the right direction with this.
|
We must make money worse as a commodity if we wish to make it better as a medium of exchange
|
|
|
walletrecoveryservices
|
|
September 03, 2015, 08:35:08 AM |
|
Nice idea OP. Thanks for your contribution to the community.
|
Providing Cryptocurrency Wallet, Password and Seed Recovery Services since 2013
|
|
|
anton000
Newbie
Offline
Activity: 21
Merit: 0
|
|
September 03, 2015, 08:47:00 AM |
|
Wow. Pretty awesome contribution op. If this were only available 2 years go... Damn
|
|
|
|
antanst
|
|
September 03, 2015, 09:06:16 AM |
|
Very nice, thank you!
Should there be a list of the Python dependencies somewhere, like a requirements file?
|
|
|
|
SteamGamesBTC.com
|
|
September 03, 2015, 09:58:48 AM |
|
Python isn't so bad at all, Electrum is also written in Python and works. ;-) However the Windows version of Electrum is nicely compiled to the one executable file. Do you plan the same?
|
►SteamGamesBTC.com◄ > Automatic 24/7 bot: purchase any Steam game 20% cheaper with Bitcoin! <
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 03, 2015, 10:34:46 AM |
|
Very nice, thank you!
Should there be a list of the Python dependencies somewhere, like a requirements file?
Yeah, there's a requirements.txt now. Python isn't so bad at all, Electrum is also written in Python and works. ;-) However the Windows version of Electrum is nicely compiled to the one executable file. Do you plan the same?
When it's a little more mature, definitely.
|
|
|
|
CanaryInTheMine
Donator
Legendary
Offline
Activity: 2352
Merit: 1060
between a rock and a block!
|
|
September 03, 2015, 02:24:25 PM |
|
Great tool!! It's very useful, wish it was made sooner
|
|
|
|
georgem
Legendary
Offline
Activity: 1484
Merit: 1007
spreadcoin.info
|
|
September 03, 2015, 03:40:26 PM |
|
exactly the tool I need right now. Thanks!
|
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 03, 2015, 05:46:05 PM |
|
Thanks for the feedback. Repo transferred to its new home. We're now in #hashmal on freenode.
|
|
|
|
mustyoshi
|
|
September 03, 2015, 08:03:17 PM |
|
Any chance of porting this to Javascript?
|
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 04, 2015, 12:05:35 AM |
|
Any chance of porting this to Javascript?
Not really, no. The whole thing was designed with Python in mind. Anyway, there are now some basic usage docs here. I've also put in a basic Transaction Deserializer tool which can be upgraded with the functionality talked about earlier in the thread at a later time. The most significant update is that you can now specify a "spending transaction" in the Stack Evaluator, and select one of its inputs. That input's scriptSig will be pushed to the stack before your script starts. "OP_CHECKSIG" and "OP_CHECKSIGVERIFY" should work now. Pretty soon I'll have to start incrementing the version number and providing changelogs.
|
|
|
|
chrisrico
|
|
September 04, 2015, 05:59:02 PM |
|
I'm having difficulty getting it to run. Here's what I'm getting after installing from git on OSX Yosemite. $ hashmal Traceback (most recent call last): File "/usr/local/bin/hashmal", line 13, in <module> import hashmal_lib File "/usr/local/lib/python2.7/site-packages/hashmal_lib/__init__.py", line 5, in <module> from main_window import HashmalMain File "/usr/local/lib/python2.7/site-packages/hashmal_lib/main_window.py", line 8, in <module> from dock_handler import DockHandler File "/usr/local/lib/python2.7/site-packages/hashmal_lib/dock_handler.py", line 4, in <module> from docks.addr_encoder import AddrEncoder File "/usr/local/lib/python2.7/site-packages/hashmal_lib/docks/__init__.py", line 6, in <module> import tx_deserializer ImportError: No module named tx_deserializer
|
|
|
|
Kefkius (OP)
Member
Offline
Activity: 64
Merit: 20
|
|
September 04, 2015, 06:15:55 PM |
|
I'm having difficulty getting it to run. Here's what I'm getting after installing from git on OSX Yosemite. $ hashmal Traceback (most recent call last): File "/usr/local/bin/hashmal", line 13, in <module> import hashmal_lib File "/usr/local/lib/python2.7/site-packages/hashmal_lib/__init__.py", line 5, in <module> from main_window import HashmalMain File "/usr/local/lib/python2.7/site-packages/hashmal_lib/main_window.py", line 8, in <module> from dock_handler import DockHandler File "/usr/local/lib/python2.7/site-packages/hashmal_lib/dock_handler.py", line 4, in <module> from docks.addr_encoder import AddrEncoder File "/usr/local/lib/python2.7/site-packages/hashmal_lib/docks/__init__.py", line 6, in <module> import tx_deserializer ImportError: No module named tx_deserializer
My bad. I hadn't included that file in the list of modules in setup.py. Fixed now.
|
|
|
|
|