GithubHelp home page GithubHelp logo

cityofzion / neo-python Goto Github PK

View Code? Open in Web Editor NEW
314.0 41.0 192.0 118.69 MB

Python Node and SDK for the NEO 2.x blockchain. For NEO 3.x go to our successor project neo-mamba

Home Page: https://neo-python.readthedocs.io/en/latest/

License: MIT License

Python 99.74% Makefile 0.11% Shell 0.03% Dockerfile 0.12%
neo smartcontracts python cityofzion

neo-python's Introduction

CoZ logo

Deprecated

Neo-python was for version 2.x of the NEO Network. neo-mamba is its successor for NEO 3.x and beyond.

neo-python

Python Node and SDK for the NEO blockchain.

Pypi

Travis CI

ReadTheDocs

Coveralls

Overview

What does it currently do

  • This project aims to be an alternative implementation for the original C# NEO project
  • Run a Python based P2P node
  • Interactive CLI for configuring node and inspecting blockchain
  • Compile, test, deploy and run Smart Contracts written in Python or any smart contract in the .avm format
  • Runs smart contracts on the blockchain in a Python virtual machine
  • Very basic Wallet functionality (not fully tested, please do not use on mainnet)
  • NEP2 and NEP5 compliant wallet functionality
  • NEP-7 and NEP-8 support
  • RPC Client
  • RPC server
  • Notification Server ( for viewing transfers of NEP5 tokens )
  • Runtime.Log and Runtime.Notify event monitoring

What will it do

  • Consensus nodes
  • More robust smart contract debugging and inspection

Documentation

The full documentation on how to install, configure and use neo-python can be found at Read The Docs.

Get help or give help

  • Open a new issue if you encounter a problem.
  • Or ping @ixje on the NEO Discord.
  • Pull requests welcome. Have a look at the issue list for ideas. You can help with wallet functionality, writing tests or documentation, or on any other feature you deem awesome.

Getting started

neo-python has two System dependencies (everything else is covered with pip):

We have published a Youtube video to help get you started. There are many more videos under the CityOfZion Youtube channel, check them out.

Docker

Using Docker is another option to run neo-python. There are example Dockerfiles provided in the /docker folder, and we have an image on Docker hub, tagged after the neo-python releases: https://hub.docker.com/r/cityofzion/neo-python/

Native installation

Instructions on the system setup for neo-python:

LevelDB

OSX

brew install leveldb

Ubuntu/Debian 18.04+

At the time of writing this message Ubuntu's package manager only lists Python 3.7.0. Variously memory leaks have been addressed since and it is recommended to run Python 3.7.3 or newer. Read this Ubuntu guide on how to add an alternative PPA to your sources list to install from or how to compile the latest version manually.

Centos/Redhat/Fedora

Note: - Not tested -

Please correct the REAMDE if there are issues. Install Python 3.7.3 following this CentOS guide.

Windows

Currently, you should use the Linux subsystem with Ubuntu, or a Virtual Machine with Linux. You can find more information and a guide for setting up the Linux subsystem here.

Installing "Ubuntu" from Microsoft Store installs Ubuntu 16.04. You should install Ubuntu 18.04 from Microsoft Store found here: https://www.microsoft.com/en-us/p/ubuntu-1804/9n9tngvndl3q?activetab=pivot%3aoverviewtab

Help needed for running natively. Installing the Python package plyvel seems to require C++ compiler support tied to Visual Studio and libraries. Refer to documentation.

Python 3.7+

neo-python is compatible with Python 3.7 and later.

On *nix systems, install Python Python 3.7 via your package manager, or download an installation package from the official homepage.

Install

It is recommended to put all project dependencies into its own virtual environment, this way we don't pollute the global installation which could lead to version conflicts.

  1. Install from Github:
git clone https://github.com/CityOfZion/neo-python.git
cd neo-python

# if you want to use the development branch, switch now
git checkout development

# create virtual environment using Python 3.7 and activate or skip to the next step for Python 3.6
python3.7 -m venv venv
source venv/bin/activate

# install the package in an editable form
(venv) pip install wheel -e .
  1. Install from PyPi
# create project dir
mkdir myproject
cd myproject

# create virtual environment using Python 3.7 and activate or skip to the next step for Python 3.6
python3.7 -m venv venv
source venv/bin/activate

(venv) pip install wheel neo-python

Running

After installing requirements and activating the environment, there is an easy to use CLI (np-prompt) that starts the node and allows some basic interactivity.

np-prompt
NEO cli. Type 'help' to get started

neo> show state
Progress: 10926 / 11145
Block-cache length 0
Blocks since program start 0
Time elapsed 0.02598465 mins
Blocks per min 0
TPS: 0

neo>

By default, the CLI connects to the TestNet (see below how to switch to MainNet or PrivNet).

Let's query for a block in the current server by hash or by block index:

np-prompt
NEO cli. Type 'help' to get started

neo> show block 122235
{
    "hash": "0xf9d7bc6f337a6cbe124b92b90ad7b29e2628e78202ea2daa19ed93fdc779c0e6",
    "size": 686,
    "version": 0,
    "previousblockhash": "0x1f262a0979d6da0eabaaf54252fb2508564a99fee642a77ff0773671fe5fddb9",
    "merkleroot": "0x5d4f86734c2a53187aa96751b9180d69f85f9bd7875f2eb83a27666ad052ea1e",
    "time": 1496920870,
    "index": 122235,
    "nonce": "7847dea9df7571c1",
    "nextconsensus": "AdyQbbn6ENjqWDa5JNYMwN3ikNcA4JeZdk",
    "script": {
        "invocation": "40e5a7d23cb065308412d769ca2ba6dd974aa453d0c915c25a7d951488eaa6c4eff5bbe251f01725b959fb89e7dd631f7f41efd50897c466d75e8359154f6137bf402f690a98a44e5ecb22e7f20bb75bac40cac89f4805f4706ec9daf8e6ccc15def216d667423bb148e78db9461e288d7363f699741a0efb4c7c6c6dc902250cf3f4023ba2eb464aa8841cb2230c0f9f016a47c1e54e1f809da550743c33b0529b5996f4c5993a38bb73887e0b3fd7a093f6abd00d136048169a99cf34373560b8956408e816d0a0b018c348070da63f513b5b3332ef31914c420203b792f25048c1b8b397bc4bd47315be44491f7182be8aeca39035a2cd51a20da034820e5e1b5c0644052ce1cb6769e9dc9375ea96db8d538e6b2210a093c555f759ccf1d908f8c2fe3cf6236c4dade54ebca825a36e81049c7f4b149c1458c30b37460fc22581201f2",
        "verification": "55210209e7fd41dfb5c2f8dc72eb30358ac100ea8c72da18847befe06eade68cebfcb9210327da12b5c40200e9f65569476bbff2218da4f32548ff43b6387ec1416a231ee821034ff5ceeac41acf22cd5ed2da17a6df4dd8358fcb2bfb1a43208ad0feaab2746b21026ce35b29147ad09e4afe4ec4a7319095f08198fa8babbe3c56e970b143528d2221038dddc06ce687677a53d54f096d2591ba2302068cf123c1f2d75c2dddc542557921039dafd8571a641058ccc832c5e2111ea39b09c0bde36050914384f7a48bce9bf92102d02b1873a0863cd042cc717da31cea0d7cf9db32b74d4c72c01b0011503e2e2257ae"
    },
    "tx": [
        {
            "txid": "0x5d4f86734c2a53187aa96751b9180d69f85f9bd7875f2eb83a27666ad052ea1e",
            "size": 10,
            "type": "MinerTransaction",
            "version": 0,
            "attributes": [],
            "vout": [],
            "vin": [],
            "sys_fee": "0",
            "net_fee": "0",
            "scripts": [],
            "nonce": 3749016001
        }
    ]
}
neo>

Bootstrapping the Blockchain

If you use neo-python for the first time, you need to synchronize the blockchain, which may take a long time. Included in this project is the script np-bootstrap to automatically download a chain directory for you.

np-bootstrap Usage

$ np-bootstrap -h
usage: np-bootstrap [-h] [-m] [-c CONFIG] [-n] [-s] [--datadir DATADIR]

optional arguments:
  -h, --help            show this help message and exit
  -m, --mainnet         use MainNet instead of the default TestNet
  -c CONFIG, --config CONFIG
                        Use a specific config file
  -n, --notifications   Bootstrap notification database
  -s, --skipconfirm     Bypass warning about overwriting data in Chains
  -k, --keep-bootstrap-file
                        Keep the downloaded bootstrap file
  --datadir DATADIR     Absolute path to use for database directories

Bootrapping Testnet

To bootstrap the testnet blockchain, run np-bootstrap, get a cup of coffee and wait. Then, bootstrap the testnet notifications database with np-bootstrap -n.

Bootstrapping Mainnet

To bootstrap the mainnet blockchain, run np-bootstrap -m and get 8 cups of coffee (9+ GB file). Then, bootstrap the mainnet notifications database with np-bootstrap -m -n.

Important: do not use the chain files from https://github.com/CityOfZion/awesome-neo.git, they will not work with neo-python.

Basic Wallet commands

wallet create {wallet_path}
wallet open {wallet_path}
wallet close

wallet (verbose)
wallet rebuild (start block)

wallet import wif {wif}
wallet export wif {address}

wallet send {args}       # (NEO/GAS)
wallet token send {args} # NEP5

For a complete list of commands use help.

Running on MainNet

To run the prompt on MainNet, you can use the CLI argument -m (eg. np-prompt -m), for running on PrivNet you can use -p. Be sure to check out the details of the parameters:

$ np-prompt -h
usage: np-prompt [-h] [-m | -p [host] | --coznet | -c CONFIG]
                 [-t {dark,light}] [-v] [--datadir DATADIR] [--version]

optional arguments:
  -h, --help            show this help message and exit
  -m, --mainnet         Use MainNet instead of the default TestNet
  -p [host], --privnet [host]
                        Use a private net instead of the default TestNet,
                        optionally using a custom host (default: 127.0.0.1)
  --coznet              Use the CoZ network instead of the default TestNet
  -c CONFIG, --config CONFIG
                        Use a specific config file
  -t {dark,light}, --set-default-theme {dark,light}
                        Set the default theme to be loaded from the config
                        file. Default: 'dark'
  -v, --verbose         Show smart-contract events by default
  --datadir DATADIR     Absolute path to use for database directories
  --maxpeers MAXPEERS   Max peers to use for P2P Joining
  --version             show program's version number and exit

Logging

Currently, np-prompt logs to prompt.log

Tests

Note we make use of a Blockchain fixture database (~15 MB). This file is not kept in the repo, but is downloaded the first time the tests are run, this can take some time (depending on the internet connection), but happens only once.

Useful commands

make lint
make test
make coverage
make docs


# run only neo-python tests
python -m unittest discover neo

# run only neo-boa tests
python -m unittest discover boa_test

Updating the version number and releasing new versions of neo-python

This is a checklist for releasing a new version, which for now means:

  1. Merging the changes from development into master
  2. Setting the version from eg. 0.4.6-dev to 0.4.6 (which automatically created a tag/release)
  3. On the dev branch, setting the version to the next patch, eg. 0.4.7-dev
  4. Pushing master, development and the tags to GitHub

Make sure you are on the development branch and have all changes merged that you want to publish. Then follow these steps:

# Only in case you want to increase the version number again (eg. scope changed from patch to minor):
# bumpversion --no-tag minor|major

# Update CHANGELOG.rst: make sure all changes are there and remove `-dev` from the version number
vi CHANGELOG.rst
git commit -m "Updated changelog for release" CHANGELOG.rst

# Merge development branch into master
git checkout master
git merge development

# Set the release version number and create the tag
bumpversion release

# Switch back into the development branch
git checkout development

# Increase patch number and add `-dev`
bumpversion --no-tag patch

# Push to GitHub, which also updates the PyPI package and Docker Hub image
git push origin master development --tags

Troubleshooting

If you run into problems, check these things before ripping out your hair:

  • Double-check that you are using Python 3.7.x
  • Update the project dependencies (pip install -e .)
  • If you encounter any problems, please take a look at the installation section in the docs, and if that doesn't help open an issue. We'll try to help.
  • You can reach us on the NEO Discord, or simply file a GitHub issue.

License

Donations

Accepted at ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU

neo-python's People

Contributors

alpha11 avatar ashrolls avatar belane avatar brianlenz avatar bsathvik avatar dautt avatar dethos avatar fl0wjacky avatar hal0x2328 avatar iddoberger avatar igormcoelho avatar inomad avatar itzlixin avatar ixje avatar jorritvandenberg avatar jseagrave21 avatar lobosque avatar localhuman avatar lysandergg avatar melvin0008 avatar metachris avatar mjakl avatar nunojusto avatar revett avatar rockacola avatar saun0063 avatar tangys avatar thomaslobker avatar tomascarvalho avatar tommah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-python's Issues

Invoking a (Java) smart contract that is using Runtime.log("..") will cause: "COULD NOT GET STR LENGTH!" could not execute command: maximum recursion depth exceeded

Invoking a (Java) smart contract that is using Runtime.log("..") in the Main method will cause the following error:

COULD NOT GET STR LENGTH! could not execute command: maximum recursion depth exceeded
...
File "/neo-python/neo/VM/InteropService.py", line 349, in stack_item_to_py
return [stack_item_to_py(item) for item in stack_item.GetArray()]
RecursionError: maximum recursion depth exceeded

estack.Pop().GetBigInteger() -> AttributeError: 'NoneType' object has no attribute 'GetBigInteger'

Was watching TestNet and keep seeing this exception over and over:

Traceback (most recent call last):
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 789, in StepInto
    self.ExecuteOp(op, self.CurrentContext)
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 432, in ExecuteOp
    x2 = estack.Pop().GetBigInteger()
AttributeError: 'NoneType' object has no attribute 'GetBigInteger'

Here with more context:

[Neo.Storage.Get] [Script:50cff8131c66e0ecfb92153b78a9faf512906fe7] [b'mult'] -> bytearray(b'01101201E01201311202F01401511412611502712612912811312802A12901C12B01012B01C01D01H01D01H01E02G02F01H02G')
    ERROR - neo.VM.ExecutionEngine.ExecutionEngine(L:792) - Exception
Traceback (most recent call last):
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 789, in StepInto
    self.ExecuteOp(op, self.CurrentContext)
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 432, in ExecuteOp
    x2 = estack.Pop().GetBigInteger()
AttributeError: 'NoneType' object has no attribute 'GetBigInteger'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute result] Could not execute smart contract.  See logs for more details. 'NoneType' object has no attribute 'GetBigInteger'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: Invoke tx] -> index, tx hash 735542 b'8b30bdab9c25b0f0e3ef91639a34e1e58b0df3b3f74ef0359dc253ec59bec16e'
[Neo.Storage.Get] [Script:50cff8131c66e0ecfb92153b78a9faf512906fe7] [b'mult'] -> bytearray(b'01101201E01201311202F01401511412611502712612912811312802A12901C12B01012B01C01D01H01D01H01E02G02F01H02G')
    ERROR - neo.VM.ExecutionEngine.ExecutionEngine(L:792) - Exception
Traceback (most recent call last):
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 789, in StepInto
    self.ExecuteOp(op, self.CurrentContext)
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 432, in ExecuteOp
    x2 = estack.Pop().GetBigInteger()
AttributeError: 'NoneType' object has no attribute 'GetBigInteger'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute result] Could not execute smart contract.  See logs for more details. 'NoneType' object has no attribute 'GetBigInteger'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: Invoke tx] -> index, tx hash 735543 b'162c9fb702d7d6dcb5fe01578a765e27c5a8db4a0f48b83b58d75d7eb3b865ea'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute] -> Success
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute result] -> IOp Interface: <neo.Core.State.ContractState.ContractState object at 0x7f9fa6a9e5c0>
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: Invoke tx] -> index, tx hash 735549 b'65d6e4360465d62f36e953afb0a839aa5f31c4e99e5b1f7d2c73ee186869822a'
[Neo.Storage.Get] [Script:50cff8131c66e0ecfb92153b78a9faf512906fe7] [b'm'] -> 0
[Neo.Storage.Put] [Script: 50cff8131c66e0ecfb92153b78a9faf512906fe7] [b'm'] -> bytearray(b'01101201E01201311202F01401511412611502712612912811312802A12901C12B01012B01C01D01H01D01H01E02G02F01H02G')
[neo.SmartContract.StateReader] -> RUNTIME.Log: b'D-'
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute] -> Success
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute result] -> Array: []
[neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: engine execute result] -> ByteArray: bytearray(b'\x00')
    [neo.Implementations.Blockchains.LevelDBBlockchain.PersistBlock: Invoke tx] -> index, tx hash 735553 b'c7ee7dafd07b13879cd264c408207427708a0ec01897be596caf614151c594da'
[Neo.Storage.Get] [Script:50cff8131c66e0ecfb92153b78a9faf512906fe7] [b'm'] -> bytearray(b'01101201E01201311202F01401511412611502712612912811312802A12901C12B01012B01C01D01H01D01H01E02G02F01H02G')
    ERROR - neo.VM.ExecutionEngine.ExecutionEngine(L:792) - Exception
Traceback (most recent call last):
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 789, in StepInto
    self.ExecuteOp(op, self.CurrentContext)
File "/opt/neo/neo-python/neo/VM/ExecutionEngine.py", line 432, in ExecuteOp
    x2 = estack.Pop().GetBigInteger()
AttributeError: 'NoneType' object has no attribute 'GetBigInteger'

RocksDB integration

PR #151 added RocksDB support.

The implementation is using this rocksdb Python package: https://github.com/twmht/python-rocksdb (python-rocksdb on PyPI). The PR was merged into the feature-rocksdb branch.

Next steps:

ExecutionEngine.py - exception BigInteger no attribute Sign

While observing testnet syncing. Probably could use a more graceful handling.

[I 171120 13:43:59 EventHub:99] [SmartContract.Execution.Success][718081] [17f7abfbd4ab65a9aef430e30e05c109c373b3fe] [tx d8968bd24b817e28a080a3c94e757a3309497ae95a2017b30fd9ea130ee59a84] [<neo.Core.State.ContractState.ContractState object at 0x12255d748>]
[E 171120 13:43:59 ExecutionEngine:800] COULD NOT EXECUTE OP: 'BigInteger' object has no attribute 'Sign' b'\x8d' SIGN
[E 171120 13:43:59 ExecutionEngine:801] 'BigInteger' object has no attribute 'Sign'
Traceback (most recent call last):
File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 798, in StepInto
self.ExecuteOp(op, self.CurrentContext)
File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 414, in ExecuteOp
estack.PushT(x.Sign)
AttributeError: 'BigInteger' object has no attribute 'Sign'

Error when running prompt.py in Docker container

Hi all,

First of all, great work that you are doing for NEO. I noticed this library and wanted to use it myself to test NEO smart contract development in Python. I created a Dockerfile with the following lines:

FROM ubuntu:16.04

RUN apt-get update && apt-get -y install git python-dev python-pip libleveldb-dev

RUN git clone https://github.com/CityOfZion/neo-python.git

WORKDIR neo-python

RUN pip install -r requirements.txt

CMD python prompt.py

However, when running a container build from this Dockerfile, it results in the following error.

Traceback (most recent call last):
File "prompt.py", line 15, in
from neo.Network.NodeLeader import NodeLeader
File "/neo-python/neo/Network/NodeLeader.py", line 2, in
from neo.Core.Block import Block
File "/neo-python/neo/Core/Block.py", line 6, in
from neo.Core.TX.Transaction import Transaction,TransactionType
File "/neo-python/neo/Core/TX/Transaction.py", line 10, in
from neo.Core.TX.TransactionAttribute import *
File "/neo-python/neo/Core/TX/TransactionAttribute.py", line 16, in
class TransactionAttributeUsage(object):
File "/neo-python/neo/Core/TX/TransactionAttribute.py", line 17, in TransactionAttributeUsage
ContractHash = int.from_bytes(b'\x00','little')
AttributeError: type object 'int' has no attribute 'from_bytes'

Did I miss something or maybe need to use a Python version other than 2.7? Or am I being too curious and is it not ready yet?

Thanks again and if you need any help with development please let me know.

uncatched wallet functionality errors

send nonexistingassetid {address} {amount}
throws an uncatched AttributeError.
The wallet can actually do more than is currently described in the readme and I'll update that once the current pull request is worked in.

tkn_send creates invalid tx, testinvoke creates valid tx but funds are not processed

wallet tkn_send RPX <wallet address> <destination address> 1

I get a prompt asking to confirm + password. Then I see

Verifying transaction: <txid>
Relayed TX: <txid>

But when then trying to run:

tx <txid> 

I get the response

Could not find transaction for hash <txid>

even after 30+ blocks have been processed.

Alternatively, doing the following as suggested by @localhuman

testinvoke {hash} 0710 05 True transfer ['from_addr', 'to_addr', 1]

where
hash is the token script_hash (under the Token[idx].script_hash key of the Wallet)
from_addr is public_keys[idx].Address key of the wallet holding the tokens
to_addr is the destination address (LEN:34)

This does instantly create a valid txid that can be queried using tx <txid>. However the funds are never deducted.

Development branch: db617bf
MainNet

contrib.smartcontract: Invoke smart contract methods

Feature: Functionality for contrib.smartcontract to invoke SC methods.

I'm currently working on this. Using this issue for discussion, brainstorming and feedback.

As a reference: This was done for another project (imusify) like this: https://github.com/imusify/blockchain-middleware/blob/imusify2/imusify/imusmartcontract.py#L105

Thinking about a better way to integrate this -- in the above example it was a bit cumbersome with the wallet handling, waiting for the transactions to show up, and sometimes the wallet not showing correctly synced balances (this has been solved by the new neo-python updates).

Storage.Put() overcharging GAS fees

Storage.Put() currently overcharges by setting a minimum GAS fee of 1 regardless of the data size.

I've made a PR for a proposed updated but it probably needs to be discussed: #111

Max Recursion depth issue

Could not check message data maximum recursion depth exceeded while calling a Python object

Seems like a race condition that happens when a node has been running for some time.

This bug has a 10 NEO bounty to anyone who resolves it!

PR #49 is not backward compatible

PR #49 is nice but not backward compatible. It requires ApplicationConfiguration.themes in the configuration json file. If it is not existing it fails with:

Traceback (most recent call last):
  File "prompt.py", line 823, in <module>
    settings.setup(args.config)
  File "/Users/chris/Projects/chris/neo/neo-python/neo/Settings.py", line 79, in setup
    self.token_style = config['themes'][config['theme']]
KeyError: 'themes'

I would suggest to check if this key exists and if not use the old default.

Getting error with python 3.5.4

When i use final command : i.e. pip install -e D:/pyt
Then i am facing the problem. Please let me know where i am doing wrong.
c:\users\xyz\appdata\local\programs\python\python35\include\pyconfig.h(243): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

rror No module named 'logzero'

When i run python bootstrap.py it give this error No module named 'logzero'.

Traceback (most recent call last):
File "bootstrap.py", line 1, in
from neo.Settings import settings
File "D:\python\neo-python-master\neo\Settings.py", line 14, in
import logzero
ImportError: No module named 'logzero'

Improvement Idea: restrict dynamic prompt `args` list as much as possible to prompt

Opening this for discussion.

I understand the prompt needs to read generic input strings. I think it would be beneficial to add function signatures as soon as possible, and restrict this dynamic args list to prompt.py as much as possible.

For instance neo.Prompt.Commands.LoadSmartContract.LoadContract: Instead of def LoadContract(args): it could/should be def LoadContract(path, params, return_type, needs_storage):

This would make the code a lot easier to understand, and also more resilient to errors and bugs.

Add Postgres implementation

One of the goals of this project is to allow users to choose their backend implementation. I think the first step in that direction would be to add an alternative implementation to LevelDB which might be a bit more user friendly for people to work with. My preference would be postgres.

[Feature] Persist SC events

  • Add persistence for events generated via execution of smart contracts
  • most important event is the transfer event, so that transaction histories can be generated for NEP5 tokens
  • other events may be more difficult to reliably serialize, and should be implemented later
  • Perhaps add RPC server to serve queryable interface for transfer events. Other option is to have this be a separate project

Current work is at https://github.com/CityOfZion/neo-python/tree/feature-persist-notifications

How to bundle several smart contract invocations into a single tx?

I would love to be able to bundle several smart contract invocations into a single transaction.

If anyone wants to take a stab at this, that would be great! If not, perhaps at some later date I'll find enough time to try taking a look. I think this feature will become an increasingly important thing to do for more complex SC interactions.

Adding this ticket mainly to keep track of any development and references.

docker_build.sh - if neo-cli.zip can not be downloaded empty zip files are created and build fails

For example if wget in docker_build.sh can not download the
https://github.com/neo-project/neo-cli/releases/download/v2.5.2/neo-cli-ubuntu.16.04-x64.zip

2 files with 0 size are generated:
-rw-r--r-- 1 user staff 0B 15 Jan 09:29 neo-cli.zip
-rw-r--r-- 1 user staff 0B 15 Jan 09:29 neo-release-2.5.2.zip

This again causes the build fail:

Step 13/40 : RUN unzip -q -d /opt/node1 /opt/neo-cli.zip
---> Running in 3ed4eb892609
[/opt/neo-cli.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
#!/bin/bash
unzip: cannot find zipfile directory in one of /opt/neo-cli.zip or
/opt/neo-cli.zip.zip, and cannot find /opt/neo-cli.zip.ZIP, period.

Solved this problem with using the
--no-check-certificate for wget in my case.
wget --no-check-certificate -O https://github.com/neo-project/neo-cli/releases/download/v2.5.2/neo-cli-ubuntu.16.04-x64.zip

But the underlying problem should be solved in my opinion:
If files are not downloaded in a correct manner:
docker build -t neo-privnet .
should not be executed

ExecutionEngine.py - 'NoneType' object has no attribute 'GetBigInteger'

I observed this while watching testnet sync on latest dev (2018-10)(92d5171)

Could use some love to handle it more gracefully

[E 180110 13:38:04 ExecutionEngine:835] COULD NOT EXECUTE OP: 'NoneType' object has no attribute 'GetBigInteger' b'\x9f' LT
[E 180110 13:38:04 ExecutionEngine:836] 'NoneType' object has no attribute 'GetBigInteger'
    Traceback (most recent call last):
      File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 833, in StepInto
        self.ExecuteOp(op, self.CurrentContext)
      File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 524, in ExecuteOp
        x2 = estack.Pop().GetBigInteger()
    AttributeError: 'NoneType' object has no attribute 'GetBigInteger'

Remove public key argument from neo.Cryptography.Sign()

Removing the unused parameter. I encountered this while writing docstrings but there is too much to refactor to keep that in the PR with docstrings. Consider this a note for myself such that I don't forget to do this.

[Feature] Configurable logging

Right now there's 2 logs- print to the console ( fun, but annoying sometimes ) and log to prompt.log.

Ideally we'd keep prompt.log as it is, but add another log or loglevel to print smart contract debugging statements and Runtime.Notify events.

Sudden high memory usage running prompt.py

I'm running a Python node on my workstation on NEO TestNet for almost three weeks now. Suddenly my workstation starts running slow. The Python process was using a lot of resources (over 12 GB memory and about 50% CPU) and the usage was climbing quite quickly. I had to shutdown the node.

Command:

python prompt.py -t

Last state of the node:

[TestNet] Progress: 884333/884402

Environment:

Ubuntu 16.04 LTS
Python 3.5.2

Version:

Commit: fe5f65f

I'm having no further issues with my workstation.

last_console.log

Exception in "python node.py "

running node.py in OSX shows following exceptions

python node.py
Traceback (most recent call last):
File "node.py", line 36, in
d = connectProtocol(point, NeoNode(NeoFactory))
TypeError: init() missing 1 required positional argument: 'leader'

ImportError: dynamic module does not define module export function (PyInit__plyvel)

Hi,

I've run into an issue while following the install instructions for OSX with Python 3.5. I've installed leveldb with brew and successfully installed the requirements with pip with no errors outputted. However, when I ran:

python prompt.py

i received the following output:

Traceback (most recent call last):
  File "prompt.py", line 25, in <module>
    from neo.Implementations.Blockchains.LevelDB.LevelDBBlockchain import LevelDBBlockchain
  File "/Users/andylee/Desktop/Repos/neo-python/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 2, in <module>
    import plyvel
  File "/Users/andylee/Desktop/Repos/neo-python/venv/lib/python3.5/site-packages/plyvel/__init__.py", line 6, in <module>
    from ._plyvel import (  # noqa
ImportError: dlopen(/Users/andylee/Desktop/Repos/neo-python/venv/lib/python3.5/site-packages/plyvel/_plyvel.cpython-35m-darwin.so, 2): Symbol not found: __ZTIN7leveldb10ComparatorE
  Referenced from: /Users/andylee/Desktop/Repos/neo-python/venv/lib/python3.5/site-packages/plyvel/_plyvel.cpython-35m-darwin.so
  Expected in: dynamic lookup

I followed the recommended solution and uninstalled plyvel and reinstalled with the recommended cflags

pip uninstall plyvel
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"

Now when I run python prompt.py I am faced with the following

Traceback (most recent call last):
  File "prompt.py", line 25, in <module>
    from neo.Implementations.Blockchains.LevelDB.LevelDBBlockchain import LevelDBBlockchain
  File "/Users/andylee/Desktop/Repos/neo-python/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 2, in <module>
    import plyvel
  File "/Users/andylee/Desktop/Repos/neo-python/venv/lib/python3.5/site-packages/plyvel/__init__.py", line 6, in <module>
    from ._plyvel import (  # noqa
ImportError: dynamic module does not define module export function (PyInit__plyvel)

Not quite sure where to go from here, and any help would be greatly appreciated!

pip install -r requirements.txt installs neo-python-rpc v0.1.5 as 'neo'

pip install -r requirements.txt installs neo-python-rpc in 2 versions:

  • The latest 0.1.6, as expected as neo-python-rpc. This is okay.
  • 0.1.5 as neo. This is bad and fucks things up. You can find the wrong neo package in venv/lib/python3.5/site-packages/neo. You can also see it in the neo-python-rpc/0.1.5 package download: https://pypi.python.org/pypi/neo-python-rpc/0.1.5

I'm not sure where this is coming from -- what is requiring [email protected]?

Interesting events to broadcast

I've been thinking of interesting events that neo-python could broadcast via the EventHub. Interesting for instance for third party developers, or the prompt.py ui.

For instance:

  • Node connected / disconnected
  • Block received, Block height updated

Also possible:

  • Balance changes of addresses

Issue for brainstorming, please leave comments with further thoughts and ideas.

[Feature] Add RPC Client

  • Add RPC client for interacting with other nodes via an RPC interface rather than the normal network protocol

  • Add Tests for the RPC client

Breaking changes when upgrading to plyvel v1.0.2

The latest plyvel release (v1.0.2) has some breaking changes it seems: https://travis-ci.org/CityOfZion/neo-python/builds/329522567

Traceback (most recent call last):
File "/home/travis/build/CityOfZion/neo-python/neo/Utils/WalletFixtureTestCase.py", line 59, in setUpClass
    super(WalletFixtureTestCase, cls).setUpClass()
File "/home/travis/build/CityOfZion/neo-python/neo/Utils/BlockchainFixtureTestCase.py", line 51, in setUpClass
    cls._blockchain = TestLevelDBBlockchain(path=cls.leveldb_testpath())
File "/home/travis/build/CityOfZion/neo-python/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 154, in __init__
    for key, value in self._db.iterator(prefix=DBPrefix.DATA_Block):
File "plyvel/_plyvel.pyx", line 829, in plyvel._plyvel.Iterator.__next__
File "plyvel/_plyvel.pyx", line 874, in plyvel._plyvel.Iterator.real_next
File "plyvel/_plyvel.pyx", line 91, in plyvel._plyvel.raise_for_status
plyvel._plyvel.CorruptionError: b'Corruption: corrupted compressed block contents'

See also wbolster/plyvel#68

InteropService Clone() - list index out of range

Observed while syncing test net

[I 171120 13:40:57 EventHub:99] [SmartContract.Execution.Success][646058] [8947279d24cfcac050e14c84d748ec78aeea6dd4] [tx a0f11cf23d1c828d782beae8103b6089e036aacce776a55ccfb544994f1925ea] [b'\x00']
[E 171120 13:40:57 ExecutionEngine:800] COULD NOT EXECUTE OP: list assignment index out of range b'\xc4' SETITEM
[E 171120 13:40:57 ExecutionEngine:801] list assignment index out of range
Traceback (most recent call last):
File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 798, in StepInto
self.ExecuteOp(op, self.CurrentContext)
File "/Users/erik/Documents/code/neo-python/neo/VM/ExecutionEngine.py", line 710, in ExecuteOp
newItem = newItem.Clone()
File "/Users/erik/Documents/code/neo-python/neo/VM/InteropService.py", line 265, in Clone
newArray[i] = None
IndexError: list assignment index out of range
[I 171120 13:40:57 EventHub:99] [SmartContract.Execution.Fail][646061] [8947279d24cfcac050e14c84d748ec78aeea6dd4] [tx 18378c04113089f56ce36ac474a2a6da9da249db628e37ba4c23bec370834a5c] [[[<neo.Core.TX.InvocationTransaction.InvocationTransaction object at 0x107011978>, <neo.Core.TX.Transaction.TransactionOutput object at 0x10590f630>, b'/<\xaa!\xd8(\x94\x02\xf2\x96\tT\x9a2\xed\xa0aZ7\xb7', [<neo.Core.TX.Transaction.TransactionOutput object at 0x117dfa550>, <neo.Core.TX.Transaction.TransactionOutput object at 0x117dfaeb8>, <neo.Core.TX.Transaction.TransactionOutput object at 0x120613160>], b"\xd4m\xea\xaex\xecH\xd7\x84L\xe1P\xc0\xca\xcf$\x9d'G\x89", 10000000000, [<neo.Core.TX.Transaction.TransactionOutput object at 0x117dfa550>, <neo.Core.TX.Transaction.TransactionOutput object at 0x117dfaeb8>, <neo.Core.TX.Transaction.TransactionOutput object at 0x120613160>], 3, <neo.Core.TX.Transaction.TransactionOutput object at 0x120613160>, False, None, None], 10], None, 6]

Exception calculating gas consumbed Not supported- Cant get byte array for item

testinvoke ad60f5039b4fb0b5cd606ab7b77c770ddb2d6cce deploy []
invoking contract - ImusifyXYZ
checkhing hash...
key is <neo.Wallets.KeyPair.KeyPair object at 0x7fa84ac4e470>
Signing.... <neo.Core.TX.InvocationTransaction.InvocationTransaction object at 0x7fa8426d71d0> <neo.Wallets.KeyPair.KeyPair object at 0x7fa84ac4e470>
private key b'AXMzg\x07\xc5r\xc5\x93W\x08\xeb,\xed\x13\x9a\xbf\x11\x87\xbf\xb1O\xc1\x8b\xff\x919<\xfelI' result is bytearray(b'o\xab\x16\x91\xd2\xa1\xe6h\x1c\xb0m?7\x88\xaa+=\x83_T\xf5\xd7-I\x0fc\x1d\x81\xdd\x08:Zjr\x16\xbb`\xfd\xa1\xff\xd28\x1eW\xfd\xf9/\xbfy@\xd5\xfa\x91\xe61\xc2\x9f\xba\xa8w\xfb\xd9\x00\x18')
signature bytearray(b'o\xab\x16\x91\xd2\xa1\xe6h\x1c\xb0m?7\x88\xaa+=\x83_T\xf5\xd7-I\x0fc\x1d\x81\xdd\x08:Zjr\x16\xbb\xfd\xa1\xff\xd28\x1eW\xfd\xf9/\xbfy@\xd5\xfa\x91\xe61\xc2\x9f\xba\xa8w\xfb\xd9\x00\x18') ADDING SIG!! .... <neo.SmartContract.Contract.Contract object at 0x7fa84431c908> 0 bytearray(b'o\xab\x16\x91\xd2\xa1\xe6h\x1c\xb0m?7\x88\xaa+=\x83_T\xf5\xd7-I\x0fc\x1d\x81\xdd\x08:Zjr\x16\xbb\xfd\xa1\xff\xd28\x1eW\xfd\xf9/\xbfy@\xd5\xfa\x91\xe61\xc2\x9f\xba\xa8w\xfb\xd9\x00\x18')
ADDING iTEM:: <neo.SmartContract.ContractParameterContext.ContextItem object at 0x7fa8427675f8>
result is True
success is True
going through items b'2102d69b910e9158304eeed1627a06fae7177c257caa8d4106937b9ee50dfea9f39fac'
item parameters??? <neo.SmartContract.ContractParameterContext.ContractParamater object at 0x7fa8428aa748>
going through items b'2102d69b910e9158304eeed1627a06fae7177c257caa8d4106937b9ee50dfea9f39fac'
item parameters??? <neo.SmartContract.ContractParameterContext.ContractParamater object at 0x7fa8428aa748>
GETTING SCRIPTS, item is <neo.SmartContract.ContractParameterContext.ContextItem object at 0x7fa8427675f8>
[Neo.Storage.Get] [Script:ad60f5039b4fb0b5cd606ab7b77c770ddb2d6cce] [b'totalSupply'] -> 0

  self._bootstrap_inner()
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
  self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
  self._target(*self._args, **self._kwargs)
File "~/venv/lib/python3.5/site-packages/twisted/_threads/_threadworker.py", line 46, in work
  task()
File "~/venv/lib/python3.5/site-packages/twisted/_threads/_team.py", line 190, in doWork
  task()
File "~/venv/lib/python3.5/site-packages/twisted/python/threadpool.py", line 250, in inContext
  result = inContext.theWork()
File "~/venv/lib/python3.5/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
  inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
File "~/venv/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
  return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "~/venv/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
  return func(*args,**kw)
File "prompt.py", line 742, in run
  self.test_invoke_contract(arguments)
File "prompt.py", line 596, in test_invoke_contract
  tx, fee, results,num_ops = TestInvokeContract(self.Wallet, args)
File "~/neo-python/neo/Prompt/Commands/Invoke.py", line 139, in TestInvokeContract
  return test_invoke(out, wallet, outputs)
File "~/neo-python/neo/Prompt/Commands/Invoke.py", line 201, in test_invoke
  success = engine.Execute()
File "~/neo-python/neo/SmartContract/ApplicationEngine.py", line 163, in Execute
  self.gas_consumed = self.gas_consumed + self.GetPrice() * self.ratio
File "~/neo-python/neo/SmartContract/ApplicationEngine.py", line 208, in GetPrice
  return self.GetPriceForSysCall()
Exception calculating gas consumbed Not supported- Cant get byte array for item <class 'neo.VM.InteropService.InteropInterface'> <neo.SmartContract.StorageContext.StorageContext object at 0x7fa842773400>```

error executing contract.....
Error testing contract invoke

Error creating list from attached gas value

Issue

When compiling and importing a contract resembling a NEP5 token scenario, I try to create a list with a length assigned to the amount of gas attached

Contract

from boa.blockchain.vm.Neo.Storage import Get, Put, Delete, GetContext
from boa.blockchain.vm.Neo.Runtime import Notify
from boa.blockchain.vm.System.ExecutionEngine import GetScriptContainer, GetExecutingScriptHash
from boa.blockchain.vm.Neo.Blockchain import GetHeight, GetHeader
from boa.blockchain.vm.Neo.Runtime import GetTrigger, CheckWitness
from boa.blockchain.vm.Neo.Output import GetScriptHash, GetValue, GetAssetId
from boa.code.builtins import concat, list, range, take, substr

SERIALIZED_NAME = 'AWESOME'

GAS_ASSET_ID = b'\xe7-(iy\xeel\xb1\xb7\xe6]\xfd\xdf\xb2\xe3\x84\x10\x0b\x8d\x14\x8ewX\xdeB\xe4\x16\x8bqy,`'
OWNER = b'\xda\x06\xe3G\xda\x9c(\x9eWv-6\x0c\xac9~\x90\x92\x88\xf7'
TWOWEEKS = 1209600000

def Main(operation):
    tx = GetScriptContainer()
    context = GetContext()
    references = tx.References

    print("adding entry")
    if len(references) < 1:
        print("no gas attached")
        return False

    print("reading reference")
    reference = references[0]
    print("reference read")

    sender = GetScriptHash(reference)
    print("sender hash is")
    print(sender)
    print("reading script hash")
    print("getting asset ID. ID is here:")
    output_asset_id = GetAssetId(reference)
    print(output_asset_id)
    print('asset id printed above')
    if output_asset_id == GAS_ASSET_ID:
        print("executing script hash")
        receiver = GetExecutingScriptHash()
        for output in tx.Outputs:
            shash = GetScriptHash(output)
            print("getting shash..")
            if shash == receiver:
                print("adding value?")
                value = GetValue(output)
                print("value storing in entries")
                Notify(value)
                print('string we will save to the entries array')
                entries = Get(context, 'entries')
                print('current entries')
                print(entries)
                new_entries = list(length=value)
                Notify(new_entries)

    return entries

Result when compiled

screen shot 2017-11-08 at 11 12 48 pm

The compilation fails. When I assign a static number of 10 to new_entries = list(length=value) to the list and Notify the value of GetValue(output) I get the following:

screen shot 2017-11-08 at 11 14 24 pm

I'm not sure how to resolve this compiler issue. You can see that even though I attached 3 gas the Notify call says that I attached 300000000.

[Feature] Add Claim functionality

  • Add the ability to monitor unclaimed coins in a wallet
  • Add the ability to claim unclaimed coins in a wallet
  • Add tests to verify this functionality

[Feature] Add RPC server

  • Add RPC server to allow other clients to interface with neo-python

  • Add tests for RPC server interface

Issue when deploying

Can somebody tell me what can be the problem?

`neo> import contract /home/myaps/Documents/neo_systems/neosense/contract/neosense.avm test 0710 05 True False contract properties: 3 Please fill out the following contract details: [Contract Name] > asdasdasd [Contract Version] > 1 [Contract Author] > Es [Contract Email] > [email protected] [Contract Description] > asdasdasd Creating smart contract.... Name: asdasdasd Version: 1 Author: Es Email: [email protected] Description: asdasdasd Needs Storage: True Needs Dynamic Invoke: True { "script": "0138c56b6c766b00527ac46c766b51527ac46c766b51c300c36c766b52527ac46c766b52c36168184e656f2e52756e74696d652e436865636b5769746e657373616c766b53527ac46c766b53c3632d000e4e6f7420417574686f72697a656461680f4e656f2e52756e74696d652e4c6f676162030000616c75660a417574686f72697a656461680f4e656f2e52756e74696d652e4c6f67616c766b51c351c36c766b54527ac46c766b52c36c766b54c3617e6c766b55527ac46c766b51c361c0539c6455001a4c6963656e736520666f7220646966666572656e74207573657261680f4e656f2e52756e74696d652e4c6f67616c766b51c352c36c766b56527ac46c766b56c36c766b54c3617e6c766b57527ac4623d000e4c6963656e736520666f72206d6561680f4e656f2e52756e74696d652e4c6f67616c766b52c36c766b56527ac46c766b55c36c766b57527ac46c766b00c3009e6400006c766b00c30f526567697374657250726f647563749c64cf000f526567697374657250726f6475637461680f4e656f2e52756e74696d652e4c6f67616168164e656f2e53746f726167652e476574436f6e74657874616c766b54c37c61680f4e656f2e53746f726167652e476574616c766b58527ac46c766b58c3636a006168164e656f2e53746f726167652e476574436f6e74657874616c766b54c36c766b52c3527261680f4e656f2e53746f726167652e507574611250726f64756374205265676973746572656461680f4e656f2e52756e74696d652e4c6f676162030051616c75666c766b00c30e4c6963656e736550726f647563749c6496000e4c6963656e736550726f6475637461680f4e656f2e52756e74696d652e4c6f67616c766b54c361650b036468006168164e656f2e53746f726167652e476574436f6e74657874616c766b57c36c766b56c3527261680f4e656f2e53746f726167652e507574611050726f64756374204c6963656e73656461680f4e656f2e52756e74696d652e4c6f676162030051616c75666c766b00c30f5472616e736665724c6963656e73659c647e016168164e656f2e53746f726167652e476574436f6e74657874616c766b55c37c61680f4e656f2e53746f726167652e476574616c766b59527ac46c766b59c3643c010e4c6963656e73652065786973747361680f4e656f2e52756e74696d652e4c6f67616c766b59c36168184e656f2e52756e74696d652e436865636b5769746e657373616c766b5a527ac46c766b5ac364ea001555736572206973204c6963656e7365204f776e657261680f4e656f2e52756e74696d652e4c6f67616c766b51c352c36c766b5b527ac46c766b5bc36c766b54c3617e6c766b5c527ac46168164e656f2e53746f726167652e476574436f6e74657874616c766b55c37c6168124e656f2e53746f726167652e44656c657465616168164e656f2e53746f726167652e476574436f6e74657874616c766b5cc36c766b5bc3527261680f4e656f2e53746f726167652e50757461124c6963656e7365205472616e73666572656461680f4e656f2e52756e74696d652e4c6f676162030051616c75666c766b00c30d52656d6f76654c6963656e73659c646e006c766b54c36165ef006462006c766b51c352c36c766b5d527ac46c766b5dc36c766b54c3617e6c766b5e527ac46168164e656f2e53746f726167652e476574436f6e74657874616c766b5ec37c6168124e656f2e53746f726167652e44656c6574656162030051616c75666c766b00c30a4765744c6963656e73659c646f000a4765744c6963656e736561680f4e656f2e52756e74696d652e4c6f67616168164e656f2e53746f726167652e476574436f6e74657874616c766b57c37c61680f4e656f2e53746f726167652e476574616c766b59527ac46c766b59c3640f006203006c766b59c3616c7566620300006600616c756657c56b6c766b00527ac417416d2049207468652070726f64756374206f776e65723f61680f4e656f2e52756e74696d652e4c6f67616168164e656f2e53746f726167652e476574436f6e74657874616c766b00c37c61680f4e656f2e53746f726167652e476574616c766b51527ac46c766b51c36168184e656f2e52756e74696d652e436865636b5769746e657373616c766b52527ac46c766b52c3632d00164e6f74207468652070726f64756374206f776e65722161680f4e656f2e52756e74696d652e4c6f67616203006c766b52c3616c756653c56b6c766b00527ac46c766b51527ac462030000616c756653c56b6c766b00527ac46c766b51527ac462030000616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac462030000616c756653c56b6c766b00527ac46c766b51527ac462030000616c756651c56b62030000616c756652c56b6c766b00527ac462030000616c7566", "hash": "54b96f38b8ca5ff9ff93a1b953ff91b941a16ff9", "returntype": "0710", "parameters": "10" } Could not execute command: ord() expected a character, but string of length 2 found File "/usr/lib/python3.5/threading.py", line 882, in _bootstrap self._bootstrap_inner() File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/_threads/_threadworker.py", line 46, in work task() File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/_threads/_team.py", line 190, in doWork task() File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/python/threadpool.py", line 250, in inContext result = inContext.theWork() File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/python/threadpool.py", line 266, in inContext.theWork = lambda: context.call(ctx, func, *args, **kw) File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/home/myaps/Documents/neo_systems/neo-boa/venv/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext return func(*args,**kw) File "prompt.py", line 914, in run traceback.print_stack() Traceback (most recent call last): File "prompt.py", line 867, in run self.do_import(arguments) File "prompt.py", line 325, in do_import return self.load_smart_contract(arguments) File "prompt.py", line 729, in load_smart_contract contract_script = GatherContractDetails(function_code, self) File "/home/myaps/Documents/neo_systems/neo-python/neo/Prompt/Commands/LoadSmartContract.py", line 200, in GatherContractDetails function_code.ContractProperties, ord(function_code.ReturnType), TypeError: ord() expected a character, but string of length 2 found neo> exit

 `

Improving error handling with neocore

It would be great if we would improve the error handling at some point. I'd like to remove the logzero dependency from neocore and throw exceptions instead of logging errors and returning default values. This will need some refactoring on the implementation points in neo-python.

Not a hurry, but I think would improve the overall robustness and usability of neocore.

Idea: add pyup.io

pyup.io is a service that helps you to keep your requirements files up to date. It sends you automated pull requests whenever there’s a new release for one of your dependencies.

https://pyup.io

JSON RPC API Functionality

Work in progress, now already in dev. See also #273 for tracking issues.

Links:

Initial calls:

  • getaccountstate
  • getbestblockhash
  • getblockcount
  • getblockhash
  • getblocksysfee
  • getconnectioncount
  • getrawmempool
  • getpeers
  • getrawtransaction
  • getstorage
  • getversion
  • sendrawtransaction
  • validateaddress
  • invoke
  • invokefunction
  • invokescript
  • getassetstate
  • getblock (int)
  • getblock (hash)
  • gettxout (the C# side is broken #156)
  • getcontractstate (TODO: can't successfully run this call against the live nodes)
  • getbalance
  • getnewaddress

Additional calls

  • listaddress (more info)
  • getapplicationlog (more info)
  • dumpprivkey
  • sendtoaddress
  • sendmany

See also:

  • #233 (JsonRpcApi input & output differs from C#)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.