An RPC server that extends the default
neo-python RPC server with plugable commands.
Install the package via
pip install neopython-extended-rpc-server
Next, open your neo-python's
protocol.<network>.json, find the
RPCServer key and set it as follows
Note that the default installation has no additional commands over
neo-python's build-in RPC Server.
Extending with new commands
You can extend the RPC server with your own commands by creating a plugin. This has 2 requirements:
- Your plugin must extend the
ExtendedRpcCommandclass and implement the required methods.
- Your plugin must be installed using
setuptoolsand register an entrypoint under
neopython.extrpc.plugins. See the
entry_pointskey in /extrpc-plugin-example/setup.py for an example.
If your plugin does not adhere to the above 2 requirements it will not be picked up by the loader. The easiest approach is probably to copy the example plugin folder and adjust it to your needs.
Note: you have to restart the RPC server for new commands to be picked up.
If you get the following error when starting the Extended RPC server after you've installed your custom command:
Failed to import module neopython_ext_rpc_server.ExtRpcServer with error: No module named 'your_plugin_name'
Then that likely means you did not include an __init__.py file in your module package. Add it, install again and you should be good to go.