Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on November 24, 2019, 10:54:52 AM



Title: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 24, 2019, 10:54:52 AM
I'm always a fan of simplifying things and building GUIs and ever since I saw the Miniscript project (https://bitcointalk.org/index.php?topic=5177128.0) I wanted to make that happen. Since I recently resumed working on one of my oldest projects (Bitcoin Transaction Tool (https://bitcointalk.org/index.php?topic=1701507.0)) I decided to add it as a new feature to that project, for writing and running scripts at the same time.

It can be found under Tools > Script builder (or press F3). It currently supports all OP codes except the disabled ones (for obvious reasons) and *checksig OPs (since to support them I had to copy about 6000 lines of code into this project) and 2 locktime related OPs and CodeSeparator (because I haven't had time to understand how they work!). OPs are also categorized and can be filtered by using the ComboBox on top for ease of finding them.
Writing the script will also run it, the result of it is shown in a text box and the "box" at the bottom right is a list representing the "stack".

I plan on working on it and add more more features such as adding pre-defined script that only need filling up the data part. But before that I wanted to get some feedback about what you think about something like this, how can I improve it,...

Here is a preview:
https://i.imgur.com/HRM3NVx.jpg


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: MixMAx123 on November 24, 2019, 11:38:44 AM
That can be very useful. I will test it as soon as it gets published.
What are the "obvious" reasons for disabling some scripts?


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 24, 2019, 11:46:04 AM
That can be very useful. I will test it as soon as it gets published.
It is already on GitHub https://github.com/Coding-Enthusiast/BitcoinTransactionTool
Do you mean publishing the compiled binaries?

Quote
What are the "obvious" reasons for disabling some scripts?
You have to look at the buttons that are disabled for it to become obvious. These are a bunch of OP codes (such as OP_CAT, OP_Multiply,...) that were removed/disabled a long time ago. Since their names still exist in the source code and documentation, I also have them here as disabled buttons.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: MixMAx123 on November 24, 2019, 11:53:41 AM
Yes, I mean a compiled version as .exe, or is that unusual?


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 25, 2019, 04:06:15 AM
One should not really download and run .exe and since until now nobody had requested compiled version I've never thought about it. In any case I published it using ClickOnce, more info can be found here: https://github.com/Coding-Enthusiast/BitcoinTransactionTool/releases/tag/0.10.0.0

I've tried migrating to Avalonia (a multi platform GUI) but it lacks a lot of functionality specially when it comes to lists, so for the time being this project will remain only for windows. I'll try looking into other alternatives to migrate to .net core entirely which would make publishing and compiling easier too.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: MixMAx123 on November 25, 2019, 09:50:00 PM
I created a Tx with it:

"0100000001902dbe4ae9a20b85f53cb6813396e6aae272ee4e3b699e8c2498d2ce8f5833ee00000 00000ffffffff01c0270900000000001976a91415dee4a950952a3a5aa198543e37d310b6b7402f 88ac00000000"

Just how do I get the now signed?

No, I hope you understand the joke :-)

I played around with it. Works very well.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 26, 2019, 07:39:12 AM
No, I hope you understand the joke :-)
I played around with it. Works very well.

Of course I recognize my own UTXO anywhere!
Try checking the script window and play around with that too and let me know what you think. I'll try to add more to it this week.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 28, 2019, 08:55:37 AM
I tried it and works without any problem on Windows 10. It doesn't work on Wine (default configuration) though.
I did some search and it seems like Wine has some known bugs related to WPF (GUI that is used in this project). I won't spend any time on fixing this because there is a much better way of solving the issue and that would be using a cross-platform GUI so that you don't need Wine, you simply run it as you run any other application in another OS (Windows, Linux, Mac,...).
Currently there are a couple of them that I'm aware of. The one that I feel comfortable with (also used by Wsabi wallet) is called Avalonia (http://avaloniaui.net/), but since it is in beta, it lacks a lot of functionality or to do certain things you have to bend over backwards (like the grid-like lists where you enter addresses and the list containing UTXOs with categorization and headers).
The migration is in my "roadmap" which would make it easy to run it under any other OS without needing anything else. Meanwhile if someone is familiar with Xaml and Avalonia feel free to contribute...

I've heard https://www.monodevelop.com/ (https://www.monodevelop.com/) allows you to create/port C# and .NET software into multiple OS.
You probably already know about it though.
That is an IDE (development environment, ie. where you write code and compile), what is needed here is a GUI that is a graphical user interface that doesn't require windows APIs (like WPF does) to run.


I've released a new version and added description to each button in script writer window explaining what they do. Also the QR window now lets you choose the encoding you want to use (eg. Electrum uses Base43 to encode raw unsigned transactions).
https://github.com/Coding-Enthusiast/BitcoinTransactionTool/releases/tag/0.10.1.0


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: TechPriest on November 29, 2019, 10:12:02 AM
Quote
What are the "obvious" reasons for disabling some scripts?
You have to look at the buttons that are disabled for it to become obvious. These are a bunch of OP codes (such as OP_CAT, OP_Multiply,...) that were removed/disabled a long time ago. Since their names still exist in the source code and documentation, I also have them here as disabled buttons.

Hello, and why is disabled OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY? The second one is very useful for creating bitcoin-testament smart conract, for example.
I will be appreciated for your answer.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on November 29, 2019, 12:38:23 PM
Hello, and why is disabled OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY? The second one is very useful for creating bitcoin-testament smart conract, for example.

It is because I am not sure how to implement these two as an IOperation. In the near future I will add these OPs and also eventually will release my Cryptocurrency.Net library which would also mean additional features including signing, verification and communication with nodes.

In this topic I was hoping for some ideas on how to improve the user interface. For instance how would you like to create such smart contracts?


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: TechPriest on November 29, 2019, 01:39:56 PM
Hello, and why is disabled OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY? The second one is very useful for creating bitcoin-testament smart conract, for example.

It is because I am not sure how to implement these two as an IOperation.

Understood. Maybe it will be enough to ad them and they will return only "true" doesn't matter what block height or time have been pushed to stack?

It's sound logical, for me.

User interface is enough friendly, at least for me.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: AltcoinBuilder on November 30, 2019, 10:25:34 AM
I'm always a fan of simplifying things and building GUIs and ever since I saw the Miniscript project (https://bitcointalk.org/index.php?topic=5177128.0) I wanted to make that happen. Since I recently resumed working on one of my oldest projects (Bitcoin Transaction Tool (https://bitcointalk.org/index.php?topic=1701507.0)) I decided to add it as a new feature to that project, for writing and running scripts at the same time.

It can be found under Tools > Script builder (or press F3). It currently supports all OP codes except the disabled ones (for obvious reasons) and *checksig OPs (since to support them I had to copy about 6000 lines of code into this project) and 2 locktime related OPs and CodeSeparator (because I haven't had time to understand how they work!). OPs are also categorized and can be filtered by using the ComboBox on top for ease of finding them.
Writing the script will also run it, the result of it is shown in a text box and the "box" at the bottom right is a list representing the "stack".

I plan on working on it and add more more features such as adding pre-defined script that only need filling up the data part. But before that I wanted to get some feedback about what you think about something like this, how can I improve it,...

Here is a preview:
https://i.imgur.com/HRM3NVx.jpg
nice. I suggest you use dropdown and a RUN button for OP section  :)


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: MixMAx123 on October 01, 2021, 08:36:07 PM
Your tool is great. I work with it :-)
Please, please, I urgently need it in the testnet!
In the test network you work much more with such things.
It would be great, if it would go in the testnet too.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: NotATether on October 02, 2021, 08:08:39 AM
I did some search and it seems like Wine has some known bugs related to WPF (GUI that is used in this project). I won't spend any time on fixing this because there is a much better way of solving the issue and that would be using a cross-platform GUI so that you don't need Wine, you simply run it as you run any other application in another OS (Windows, Linux, Mac,...).

I can port this to Electron/NodeJS where it will run on any platform without the need for emulators (like Wine) or VMs. The best part is I can even deploy it as a web app.

^^ yes I see the thread creation date.


Title: Re: Writing/Running scripts by pressing buttons in a friendly GUI
Post by: Coding Enthusiast on October 02, 2021, 10:45:40 AM
I can port this to Electron/NodeJS where it will run on any platform without the need for emulators (like Wine) or VMs. The best part is I can even deploy it as a web app.
This project is old and kind of obsolete, so I never got around to fixing its bugs and adding the missing parts. However migration of this project is one of those items in my very long to-do list. I recently finished the transaction verification (https://github.com/Autarkysoft/Denovo/commit/acd38058a720ea85292a39123d79367d546032d5) part but haven't started working on the "script playground" part. The migration fixes the bugs and will cover every script that exists in Bitcoin protocol and the software can run on any operating system.
Here is an issue to track this #2 (https://github.com/Autarkysoft/Denovo/issues/2).