SteemWalletRPC

Warning

This is a low level class that can be used in combination with SteemClient. Do not use this class unless you know what you are doing!

We now need to distinguish functionalities. If we want to only access the blockchain and do not want to perform on-chain operations like transfers or orders, we are fine to interface with any accessible witness node. In contrast, if we want to perform operations that modify the current blockchain state, e.g. construct and broadcast transactions, we are required to interface with a cli_wallet that has the required private keys imported. We here assume:

  • port: 8090 - witness
  • port: 8092 - wallet

Note

The witness API has a different instruction set than the wallet!

Definition

class pistonapi.steemwalletrpc.SteemWalletRPC(*args, **kwargs)

STEEM JSON-HTTP-RPC API

This class serves as an abstraction layer for easy use of the Grapehene API.

Parameters:
  • host (str) – Host of the API server
  • port (int) – Port to connect to
  • username (str) – Username for Authentication (if required, defaults to “”)
  • password (str) – Password for Authentication (if required, defaults to “”)

All RPC commands of the steem client are exposed as methods in the class SteemWalletRPC. Once an instance of SteemWalletRPC is created with host, port, username, and password, e.g.,

from pistonrpc import SteemRPC
rpc = SteemRPC("localhost", 8092, "", "")

any call available to that port can be issued using the instance via the syntax rpc.*command*(parameters). Example:

rpc.info()

Note

A distinction has to be made whether the connection is made to a witness/full node which handles the blockchain and P2P network, or a cli-wallet that handles wallet related actions! The available commands differ drastically!

If you are connected to a wallet, you can simply initiate a transfer with:

res = client.transfer("sender","receiver","5", "USD", "memo", True);

Again, the witness node does not offer access to construct any transactions, and hence the calls available to the witness-rpc can be seen as read-only for the blockchain.

__getattr__(name)

Map all methods to RPC calls and pass through the arguments

rpcexec(payload)

Manual execute a command on API (internally used)

param str payload: The payload containing the request return: Servers answer to the query rtype: json raises RPCConnection: if no connction can be made raises UnauthorizedError: if the user is not authorized raise ValueError: if the API returns a non-JSON formated answer

It is not recommended to use this method directly, unless you know what you are doing. All calls available to the API will be wrapped to methods directly:

info -> grapheneapi.info()