diff --git a/README.md b/README.md index 8daa401fe..827316299 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ ## Getting started -You will need to install the libleveldb library. Install [Python 3.5](https://www.python.org/downloads/release/python-354/) to make sure you don't run into any issues with your version of Python being different than the current maintainer's version. +You will need to install the libleveldb library. Install [Python 3.5](https://www.python.org/downloads/release/python-354/) to make sure you don't run into any issues with your version of Python being different than the current maintainer's version. Note that Python 3.6 is not currently supported due to incompatibilities with the byteplay module. We have published a Youtube [video](https://youtu.be/oy6Z_zd42-4) to help get you started with this library. There are other videos under the CityOfZion Youtube channel. @@ -117,17 +117,24 @@ You may need to uninstall plyvel (python libleveldb library), and reinstall with ``` pip uninstall plyvel -CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel plyvel --no-cache-dir +CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel plyvel --no-cache-dir --global-option=build_ext --global-option="-I/usr/local/Cellar/leveldb/1.20_2/include/" --global-option="-L/usr/local/lib" ``` -Moreover, this pip installation must see the leveldb header file db.h. -You may need to add flags similar to the following to the -installation command +You may also encounter issues when installing the pycrypto module on OSX: ``` ---global-option=build_ext ---global-option="-I/usr/local/Cellar/leveldb/1.20_2/include/" ---global-option="-L/usr/local/lib" +src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found +# include + ^~~~~~~ +330 warnings and 1 error generated. +error: command 'clang' failed with exit status 1 +``` + +This may be fixed by installing the gmp library using homebrew and running pip install with the following commandline: + +``` +brew install gmp +CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel pycrypto --no-cache-dir --global-option=build_ext --global-option="-I/usr/local/Cellar/gmp/6.1.2/include/" --global-option="-L/usr/local/lib" ``` ## Running @@ -229,4 +236,4 @@ coverage report -m --omit=venv/* ## Donations -Accepted at __ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU__ \ No newline at end of file +Accepted at __ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU__ diff --git a/neo/Core/TX/TransactionAttribute.py b/neo/Core/TX/TransactionAttribute.py index b0a053929..c222074ed 100644 --- a/neo/Core/TX/TransactionAttribute.py +++ b/neo/Core/TX/TransactionAttribute.py @@ -125,6 +125,9 @@ def Serialize(self, writer): def ToJson(self): + + + obj = { 'usage': self.Usage, 'data': '' if not self.Data else self.Data.hex() diff --git a/neo/Prompt/Commands/Send.py b/neo/Prompt/Commands/Send.py index 2649ed313..1558979d2 100755 --- a/neo/Prompt/Commands/Send.py +++ b/neo/Prompt/Commands/Send.py @@ -59,13 +59,7 @@ def construct_and_send(prompter, wallet, arguments): print("insufficient funds") return - - passwd = prompt("[Password]> ", - completer=prompter.completer, - is_password=True, - history=prompter.history, - get_bottom_toolbar_tokens=prompter.get_bottom_toolbar, - style=prompter.token_style) + passwd = prompt("[Password]> ", is_password=True) if not wallet.ValidatePassword(passwd): print("incorrect password") diff --git a/neo/Prompt/Notify.py b/neo/Prompt/Notify.py index e9de50f4d..2902f2d54 100644 --- a/neo/Prompt/Notify.py +++ b/neo/Prompt/Notify.py @@ -53,6 +53,21 @@ def HandleBlockchainNotification(notification): amount = event_args[1].GetBigInteger() print("[Neo.Runtime.Notify :: REFUND] amount %s " % amount) + + elif event_name in ['deposit','withdraw','withdraw_reconcile']: + to = event_args[0].GetByteArray() + + if len(to) == 20: + to = Crypto.ToAddress(UInt160(data=to)) + + ename = event_name.upper() + print("[Neo.Runtime.Notify :: %s] TO %s " % (ename,to)) + amount = event_args[1].GetBigInteger() + print("[Neo.Runtime.Notify :: %s] amount %s " % (ename,amount)) + + + + else: # print("event name not handled %s " % event_args) diff --git a/neo/VM/ExecutionEngine.py b/neo/VM/ExecutionEngine.py index d9b724e15..636d51f1b 100644 --- a/neo/VM/ExecutionEngine.py +++ b/neo/VM/ExecutionEngine.py @@ -800,7 +800,7 @@ def StepInto(self): # opname = ToName(op) # print("____________________________________________________") -# print("%s -> %s" % (op, opname)) +# print("%02x -> %s" % (int.from_bytes(op,byteorder='little'), opname)) # print("-----------------------------------") self.ops_processed += 1 diff --git a/neo/VM/OpCode.py b/neo/VM/OpCode.py index a5fab458c..ba64bdd1e 100644 --- a/neo/VM/OpCode.py +++ b/neo/VM/OpCode.py @@ -2,6 +2,79 @@ PUSH0 = b'\x00' # An empty array of bytes is pushed onto the stack. PUSHF = PUSH0 PUSHBYTES1 = b'\x01' # b'\x01-b'\x4B The next opcode bytes is data to be pushed onto the stack +PUSHBYTES2 = b'\x02' +PUSHBYTES3 = b'\x03' +PUSHBYTES4 = b'\x04' +PUSHBYTES5 = b'\x05' +PUSHBYTES6 = b'\x06' +PUSHBYTES7 = b'\x07' +PUSHBYTES8 = b'\x08' +PUSHBYTES9 = b'\x09' +PUSHBYTES10 = b'\x0A' +PUSHBYTES11 = b'\x0B' +PUSHBYTES12 = b'\x0C' +PUSHBYTES13 = b'\x0D' +PUSHBYTES14 = b'\x0E' +PUSHBYTES15 = b'\x0F' +PUSHBYTES16 = b'\x10' +PUSHBYTES17 = b'\x11' +PUSHBYTES18 = b'\x12' +PUSHBYTES19 = b'\x13' +PUSHBYTES20 = b'\x14' +PUSHBYTES21 = b'\x15' +PUSHBYTES22 = b'\x16' +PUSHBYTES23 = b'\x17' +PUSHBYTES24 = b'\x18' +PUSHBYTES25 = b'\x19' +PUSHBYTES26 = b'\x1A' +PUSHBYTES27 = b'\x1B' +PUSHBYTES28 = b'\x1C' +PUSHBYTES29 = b'\x1D' +PUSHBYTES30 = b'\x1E' +PUSHBYTES31 = b'\x1F' +PUSHBYTES32 = b'\x20' +PUSHBYTES33 = b'\x21' +PUSHBYTES34 = b'\x22' +PUSHBYTES35 = b'\x23' +PUSHBYTES36 = b'\x24' +PUSHBYTES37 = b'\x25' +PUSHBYTES38 = b'\x26' +PUSHBYTES39 = b'\x27' +PUSHBYTES40 = b'\x28' +PUSHBYTES41 = b'\x29' +PUSHBYTES42 = b'\x2A' +PUSHBYTES43 = b'\x2B' +PUSHBYTES44 = b'\x2C' +PUSHBYTES45 = b'\x2D' +PUSHBYTES46 = b'\x2E' +PUSHBYTES47 = b'\x2F' +PUSHBYTES48 = b'\x30' +PUSHBYTES49 = b'\x31' +PUSHBYTES50 = b'\x32' +PUSHBYTES51 = b'\x33' +PUSHBYTES52 = b'\x34' +PUSHBYTES53 = b'\x35' +PUSHBYTES54 = b'\x36' +PUSHBYTES55 = b'\x37' +PUSHBYTES56 = b'\x38' +PUSHBYTES57 = b'\x39' +PUSHBYTES58 = b'\x3A' +PUSHBYTES59 = b'\x3B' +PUSHBYTES60 = b'\x3C' +PUSHBYTES61 = b'\x3D' +PUSHBYTES62 = b'\x3E' +PUSHBYTES63 = b'\x3F' +PUSHBYTES64 = b'\x40' +PUSHBYTES65 = b'\x41' +PUSHBYTES66 = b'\x42' +PUSHBYTES67 = b'\x43' +PUSHBYTES68 = b'\x44' +PUSHBYTES69 = b'\x45' +PUSHBYTES70 = b'\x46' +PUSHBYTES71 = b'\x47' +PUSHBYTES72 = b'\x48' +PUSHBYTES73 = b'\x49' +PUSHBYTES74 = b'\x4A' PUSHBYTES75 = b'\x4B' PUSHDATA1 = b'\x4C' # The next byte contains the number of bytes to be pushed onto the stack. PUSHDATA2 = b'\x4D' # The next two bytes contain the number of bytes to be pushed onto the stack. @@ -145,7 +218,7 @@ def ToName(op): n = getattr(module, item) try: - nn = int(binascii.hexlify(n)) + nn = int(binascii.hexlify(n), 16) if op == nn: return item diff --git a/prompt.py b/prompt.py index f56261db0..3aa54f50f 100644 --- a/prompt.py +++ b/prompt.py @@ -33,7 +33,7 @@ from prompt_toolkit.shortcuts import print_tokens from prompt_toolkit.token import Token from prompt_toolkit.contrib.completers import WordCompleter -from prompt_toolkit.history import InMemoryHistory +from prompt_toolkit.history import FileHistory logname = 'prompt.log' @@ -103,7 +103,7 @@ class PromptInterface(object): 'config log {on/off}', 'import wif {wif}', 'import contract {path} {params} {returntype}', - 'export wif {address}' + 'export wif {address}', 'open wallet {path}', 'create wallet {path}', 'wallet {verbose}', @@ -121,7 +121,7 @@ class PromptInterface(object): Token.Number: "#ffffff", }) - history = InMemoryHistory() + history = FileHistory('.prompt.py.history') start_height = Blockchain.Default().Height start_dt = datetime.datetime.utcnow()