Bitcoin Forum
May 06, 2024, 06:43:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Hashmal - Transaction Script IDE (alpha)  (Read 9134 times)
Kefkius (OP)
Member
**
Offline Offline

Activity: 64
Merit: 20


View Profile
September 01, 2015, 11:25:16 PM
Last edit: September 03, 2015, 05:47:42 PM by Kefkius
Merited by malevolent (10)
 #1

Hashmal
Transaction Script IDE (Github | IRC)

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.

Notice

Hashmal 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.

Developer of FreeBitcoins.com Clamcoin faucet.
1714977819
Hero Member
*
Offline Offline

Posts: 1714977819

View Profile Personal Message (Offline)

Ignore
1714977819
Reply with quote  #2

1714977819
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714977819
Hero Member
*
Offline Offline

Posts: 1714977819

View Profile Personal Message (Offline)

Ignore
1714977819
Reply with quote  #2

1714977819
Report to moderator
1714977819
Hero Member
*
Offline Offline

Posts: 1714977819

View Profile Personal Message (Offline)

Ignore
1714977819
Reply with quote  #2

1714977819
Report to moderator
1714977819
Hero Member
*
Offline Offline

Posts: 1714977819

View Profile Personal Message (Offline)

Ignore
1714977819
Reply with quote  #2

1714977819
Report to moderator
Uptrenda
Member
**
Offline Offline

Activity: 114
Merit: 16


View Profile
September 01, 2015, 11:40:51 PM
 #2

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 Offline

Activity: 64
Merit: 20


View Profile
September 03, 2015, 03:36:44 AM
 #3

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.

Developer of FreeBitcoins.com Clamcoin faucet.
Luke-Jr
Legendary
*
Offline Offline

Activity: 2576
Merit: 1186



View Profile
September 03, 2015, 03:52:36 AM
 #4

Would be nice if it could use libbitcoinconsensus for evaluation just to avoid any potential bugs.
I recall one time when Valgrind messed up an x86 instruction, it totally confused my debugging efforts for hours. Sad
... and that was without money at stake ... :|

Disclosure: Shameless try-to-build-demand for reopening Bitcoin Core pull request #6178, "Refactor EvalScript into a CScriptExecution class, so single-stepping can be done"

Uptrenda
Member
**
Offline Offline

Activity: 114
Merit: 16


View Profile
September 03, 2015, 04:17:10 AM
 #5

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  Smiley
Kefkius (OP)
Member
**
Offline Offline

Activity: 64
Merit: 20


View Profile
September 03, 2015, 07:15:39 AM
 #6

Would be nice if it could use libbitcoinconsensus for evaluation just to avoid any potential bugs.
I recall one time when Valgrind messed up an x86 instruction, it totally confused my debugging efforts for hours. Sad
... and that was without money at stake ... :|

Disclosure: Shameless try-to-build-demand for reopening Bitcoin Core pull request #6178, "Refactor EvalScript into a CScriptExecution class, so single-stepping can be done"

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  Smiley

Thanks for the good wishes. Smiley

Developer of FreeBitcoins.com Clamcoin faucet.
Luke-Jr
Legendary
*
Offline Offline

Activity: 2576
Merit: 1186



View Profile
September 03, 2015, 07:33:38 AM
 #7

Would be nice if it could use libbitcoinconsensus for evaluation just to avoid any potential bugs.
I recall one time when Valgrind messed up an x86 instruction, it totally confused my debugging efforts for hours. Sad
... and that was without money at stake ... :|

Disclosure: Shameless try-to-build-demand for reopening Bitcoin Core pull request #6178, "Refactor EvalScript into a CScriptExecution class, so single-stepping can be done"

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 Smiley
Should be able to just use ctypes I would think (with stock libbitcoinconsensus lib).
(Of course, this only works with #6178 merged Sad)

sAt0sHiFanClub
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500


Warning: Confrmed Gavinista


View Profile WWW
September 03, 2015, 08:07:40 AM
 #8

Well done, this looks really good. I think you are going in the right direction with this.  Wink

We must make money worse as a commodity if we wish to make it better as a medium of exchange
walletrecoveryservices
Member
**
Offline Offline

Activity: 89
Merit: 21



View Profile WWW
September 03, 2015, 08:35:08 AM
 #9

Nice idea OP. Thanks for your contribution to the community.

Providing Cryptocurrency Wallet, Password and Seed Recovery Services since 2013
anton000
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
September 03, 2015, 08:47:00 AM
 #10

Wow. Pretty awesome contribution op.

If this were only available 2 years go... Damn Cheesy
antanst
Sr. Member
****
Offline Offline

Activity: 294
Merit: 260


View Profile
September 03, 2015, 09:06:16 AM
 #11

Very nice, thank you!

Should there be a list of the Python dependencies somewhere, like a requirements file?

SteamGamesBTC.com
Hero Member
*****
Offline Offline

Activity: 734
Merit: 507



View Profile WWW
September 03, 2015, 09:58:48 AM
 #12

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 Offline

Activity: 64
Merit: 20


View Profile
September 03, 2015, 10:34:46 AM
 #13

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.

Developer of FreeBitcoins.com Clamcoin faucet.
CanaryInTheMine
Donator
Legendary
*
Offline Offline

Activity: 2352
Merit: 1060


between a rock and a block!


View Profile
September 03, 2015, 02:24:25 PM
 #14

Great tool!! It's very useful, wish it was made sooner Smiley
georgem
Legendary
*
Offline Offline

Activity: 1484
Merit: 1007


spreadcoin.info


View Profile WWW
September 03, 2015, 03:40:26 PM
 #15

exactly the tool I need right now. Thanks!

Kefkius (OP)
Member
**
Offline Offline

Activity: 64
Merit: 20


View Profile
September 03, 2015, 05:46:05 PM
 #16

Thanks for the feedback. Repo transferred to its new home. We're now in #hashmal on freenode.

Developer of FreeBitcoins.com Clamcoin faucet.
mustyoshi
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile
September 03, 2015, 08:03:17 PM
 #17

Any chance of porting this to Javascript?
Kefkius (OP)
Member
**
Offline Offline

Activity: 64
Merit: 20


View Profile
September 04, 2015, 12:05:35 AM
 #18

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.

Developer of FreeBitcoins.com Clamcoin faucet.
chrisrico
Hero Member
*****
Offline Offline

Activity: 496
Merit: 500


View Profile
September 04, 2015, 05:59:02 PM
 #19

I'm having difficulty getting it to run. Here's what I'm getting after installing from git on OSX Yosemite.

Code:
$ 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 Offline

Activity: 64
Merit: 20


View Profile
September 04, 2015, 06:15:55 PM
 #20

I'm having difficulty getting it to run. Here's what I'm getting after installing from git on OSX Yosemite.

Code:
$ 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.

Developer of FreeBitcoins.com Clamcoin faucet.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!