diff --git a/VanityTXID-Plugin.zip b/VanityTXID-Plugin.zip index 661bd97..899b87d 100644 Binary files a/VanityTXID-Plugin.zip and b/VanityTXID-Plugin.zip differ diff --git a/VanityTXID/qt.py b/VanityTXID/qt.py index 69c2de8..c56a246 100644 --- a/VanityTXID/qt.py +++ b/VanityTXID/qt.py @@ -3,7 +3,7 @@ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QLineEdit, QLabel, QPlainTextEdit, QPushButton from electroncash.i18n import _ from electroncash.plugins import BasePlugin, hook -import electroncash, subprocess, multiprocessing, threading, zipfile, shutil +import electroncash, subprocess, multiprocessing, threading, zipfile, shutil, os from electroncash import bitcoin class Plugin(BasePlugin): @@ -15,7 +15,7 @@ def __init__(self, parent, config, name): def on_close(self): """BasePlugin callback called when the wallet is disabled among other things.""" for window in list(self.wallet_windows.values()): self.close_wallet(window.wallet) - shutil.rmtree(self.parent.get_external_plugin_dir()+'\\VanityTXID') + shutil.rmtree(self.parent.get_external_plugin_dir()+'/VanityTXID') @hook def init_qt(self, qt_gui): """Hook called when a plugin is loaded (or enabled).""" @@ -23,10 +23,11 @@ def init_qt(self, qt_gui): if len(self.wallet_windows): return Dir=self.parent.get_external_plugin_dir() - Zip=zipfile.ZipFile(Dir+'\\VanityTXID-Plugin.zip') + Zip=zipfile.ZipFile(Dir+'/VanityTXID-Plugin.zip') for Item in Zip.namelist(): - if 'bin' in Item: Zip.extract(Item,Dir+'\\VanityTXID') + if 'bin' in Item: Zip.extract(Item,Dir+'/VanityTXID') Zip.close() + if os.name is not 'nt': subprocess.Popen(['chmod','+x',Dir+'/VanityTXID/bin/VanityTXID-Plugin']) # These are per-wallet windows. for window in qt_gui.windows: self.load_wallet(window.wallet, window) @@ -39,10 +40,11 @@ def load_wallet(self, wallet, window): tab = window.create_list_tab(l) self.wallet_payment_tabs[wallet_name] = tab self.wallet_payment_lists[wallet_name] = l - window.tabs.addTab(tab, QIcon(self.parent.get_external_plugin_dir()+"\\VanityTXID\\bin\\Icon.ico"), 'VanityTXID') + window.tabs.addTab(tab, QIcon(self.parent.get_external_plugin_dir()+"/VanityTXID/bin/Icon.ico"), 'VanityTXID') @hook def close_wallet(self, wallet): - subprocess.Popen('TaskKill /IM VanityTXID-Plugin.exe /F',creationflags=subprocess.CREATE_NO_WINDOW) + if os.name is 'nt': subprocess.Popen('TaskKill /IM VanityTXID-Plugin.exe /F',creationflags=subprocess.CREATE_NO_WINDOW) + else: subprocess.Popen(['pkill','VanityTXID']) wallet_name = wallet.basename() window = self.wallet_windows[wallet_name] del self.wallet_windows[wallet_name] @@ -61,12 +63,12 @@ def __init__(self, window, plugin): VBox = QVBoxLayout() self.setLayout(VBox) - Title=QLabel('VanityTXID v1.0.3'); + Title=QLabel('VanityTXID v1.1.0'); Title.setAlignment(Qt.AlignCenter) VBox.addWidget(Title) AddressesLabel=QLabel(_('VanityTXID Addresses: ')) - ConverterLabel=QLabel(_('Address converter: ')) + ConverterLabel=QLabel(_('Address Converter: ')) AddressesLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) ConverterLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) VBoxAddressesLabels=QVBoxLayout() @@ -192,8 +194,8 @@ def IsHex(String): if Input['signatures']==[None]: window.show_transaction(TX) # More sigs needed, return. return - Pattern=' '+self.Pattern.text() - if Pattern==' ': + Pattern=self.Pattern.text() + if len(Pattern) is 0: window.show_transaction(TX) #Empty Pattern, return return @@ -207,15 +209,19 @@ def IsHex(String): Input['scriptSig']=bitcoin.int_to_hex(MessageSize)+Message+'080000000000000000'+SigScript break TX=electroncash.Transaction(TX.serialize()) - NoncePos=' '+bitcoin.rev_hex(bitcoin.int_to_hex(int(TX.raw.find(SigScript)/2)-8,2)) + NoncePos=bitcoin.rev_hex(bitcoin.int_to_hex(int(TX.raw.find(SigScript)/2)-8,2)) - Threads=' '+bitcoin.int_to_hex(int(self.Threads.text())-1) #I figure ' 00' means 1 since highest index is specified to C++ binary. + Threads=bitcoin.int_to_hex(int(self.Threads.text())-1) #I figure ' 00' means 1 since highest index is specified to C++ binary. Dir=self.plugin.parent.get_external_plugin_dir() - Command='"'+Dir+'\\VanityTXID\\bin\\VanityTXID-Plugin.exe"'+Threads+NoncePos+Pattern+' '+TX.raw - Process=subprocess.Popen(Command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,stdin=subprocess.DEVNULL,creationflags=subprocess.CREATE_NO_WINDOW | subprocess.BELOW_NORMAL_PRIORITY_CLASS) + if os.name is 'nt': + Command='"'+Dir+'/VanityTXID/bin/VanityTXID-Plugin.exe"'+' '+Threads+' '+NoncePos+' '+Pattern+' '+TX.raw + Process=subprocess.Popen(Command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,stdin=subprocess.DEVNULL,creationflags=subprocess.CREATE_NO_WINDOW | subprocess.BELOW_NORMAL_PRIORITY_CLASS) + else: + Command=[Dir+'/VanityTXID/bin/VanityTXID-Plugin',''+Threads,''+NoncePos,Pattern,TX.raw] + Process=subprocess.Popen(Command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,stdin=subprocess.DEVNULL) threading.Thread(target=self.Bin,args=(Process,len(TX.raw))).start() - self.Button.setText('TaskKill') + self.Button.setText('Cancel') self.Button.clicked.disconnect() self.Button.clicked.connect(self.Cancel) def Bin(self,Process,lenTX): @@ -226,7 +232,9 @@ def Bin(self,Process,lenTX): def ShowTX(self): try: self.window.show_transaction(electroncash.Transaction(self.HiddenBox.toPlainText())) except: return - def Cancel(self): subprocess.Popen('TaskKill /IM VanityTXID-Plugin.exe /F',creationflags=subprocess.CREATE_NO_WINDOW) + def Cancel(self): + if os.name is 'nt': subprocess.Popen('TaskKill /IM VanityTXID-Plugin.exe /F',creationflags=subprocess.CREATE_NO_WINDOW) + else: subprocess.Popen(['pkill','VanityTXID']) def AddressGen(self): wallet=self.window.wallet for Word in self.Converter.text().split(): #Generate many addresses simultaneously. @@ -256,4 +264,4 @@ def FindAddresses(self): if pAddress.to_cashaddr()==label or pAddress.to_string(pAddress.FMT_LEGACY)==label: self.AddressLine.insert(label+' ') #List all P2SH addresses. except: continue - \ No newline at end of file + diff --git a/bin/VanityTXID-Plugin b/bin/VanityTXID-Plugin new file mode 100644 index 0000000..7a8747d Binary files /dev/null and b/bin/VanityTXID-Plugin differ diff --git a/bin/VanityTXID-Plugin.exe b/bin/VanityTXID-Plugin.exe index 9267fe3..c456bdd 100644 Binary files a/bin/VanityTXID-Plugin.exe and b/bin/VanityTXID-Plugin.exe differ diff --git a/bin/libgcc_s_dw2-1.dll b/bin/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..97f8fcb Binary files /dev/null and b/bin/libgcc_s_dw2-1.dll differ diff --git a/bin/libstdc++-6.dll b/bin/libstdc++-6.dll index a7dc1e2..56809a3 100644 Binary files a/bin/libstdc++-6.dll and b/bin/libstdc++-6.dll differ diff --git a/bin/libwinpthread-1.dll b/bin/libwinpthread-1.dll index 500de9d..da00916 100644 Binary files a/bin/libwinpthread-1.dll and b/bin/libwinpthread-1.dll differ diff --git a/manifest.json b/manifest.json index 9ea8f5e..5d2e55e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "display_name": "VanityTXID", - "version": "1.0.3", - "description": "Generate TX which has ID starting with any choice of hex digits. Currently Windows only. First generate P2SH address which gets imported into a watching-only wallet, from which raw TX hex is copied to the original wallet, to be signed & mined.", + "version": "1.1.0", + "description": "Generate TX which has ID starting with any choice of hex digits. First generate P2SH address which gets imported into a watching-only wallet, from which raw TX hex is copied to the original wallet, to be signed & mined. Linux is faster than Windows, for now. ", "project_url": "https://github.com/TinosNitso/VanityTXID-Plugin", "minimum_ec_version": "3.2", "package_name": "VanityTXID", diff --git a/src/LICENSE.txt b/src/LICENSE.txt index 4b765aa..5ab8911 100644 --- a/src/LICENSE.txt +++ b/src/LICENSE.txt @@ -1,4 +1,4 @@ -The following applies only to the sha256.cpp & sha256.h code used in compiling VanityTXID-Plugin.exe +The following applies only to the sha256.cpp & sha256.h code used in compiling VanityTXID-Plugin executables. The three .dll libraries are copy-pasted from Code::Blocks and aren't related to this. /* diff --git a/src/main.cpp b/src/main.cpp index f487e05..500d13a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "sha256.cpp" std::string FromHex(std::string Hex){ @@ -70,13 +71,13 @@ void Hasher(int ThreadN,char **argv) { char Return[2*String.length()]; for (int i = 0; i < String.length(); i++) sprintf(Return+2*i, "%02x", (uint8_t) String[i]); - std::cout<nul 2>&1"); + std::cout<