BitShares Forum

Main => Technical Support => Topic started by: devlux on July 20, 2015, 01:31:19 am

Title: RPC API Reference?
Post by: devlux on July 20, 2015, 01:31:19 am
Does anyone have a link to the RPC API doc?

I'm getting a failure in something (can't disclose exactly what for security issues),
I'm not sure if I'm calling it wrong, parsing the result wrong or have something strange in my connection because the wallet is on a different box physically now whereas in dev it was on the same box in a VM container and an older client version.

I remember I had to make my own docs by doing a source code dive originally, but this really seems like the type of thing that should be documented somewhere and I'm just having a hard time sorting out where exactly.
Title: Re: RPC API Reference?
Post by: xeroc on July 20, 2015, 07:16:28 am
This is all we have got so far:
http://wiki.bitshares.org/index.php/BitShares/API
Note, that the API may change slightly with BitShares2.0 (we will have websockets too)

I don't really "understand" your issue .. maybe you could disclose a little more information about what exactly does not work as desired? Are you calling RPC and get an error or is the blockchain stuck? Do you run your own private network?
Title: Re: RPC API Reference?
Post by: jakub on July 20, 2015, 08:04:18 am
I'm not sure I fully understand the problem but maybe this will help:
Quote
Since HTTP basic authentication is used, the authentication credentials are sent over the socket in unencrypted plaintext. For this reason, binding to an interface other than localhost in the configuration file is not recommended. If you wish to access the RPC interface from a remote system, you should establish a secure connection using SSH port forwarding (the -L option in OpenSSH) or a reverse proxy SSL/TLS tunnel (typically supported by general-purpose webservers such as nginx).
It's taken from this guide:
https://github.com/bitshares/bitshares (https://github.com/bitshares/bitshares)

I used to work with BTS API a couple of months ago and I have a vague memory that accessing the RPC outside the localhost is disabled in the C++ source code for security reasons.
But I am not technical enough so this needs to be confirmed by devs.
Title: Re: RPC API Reference?
Post by: xeroc on July 20, 2015, 08:40:10 am
I used to work with BTS API a couple of months ago and I have a vague memory that accessing the RPC outside the localhost is disabled in the C++ source code for security reasons.
It is NOT! you can use RPC with remote hosts. Though, as you mentioned, communication is unencrypted (but may be encrypted via wif key today). I run my client's in a private network (VPN) to secure communications.

Alternatively, you can start the node with a separated WIF key in it's configuration and use the exact same wif for communications
Title: Re: RPC API Reference?
Post by: maqifrnswa on July 20, 2015, 12:56:26 pm
I used to work with BTS API a couple of months ago and I have a vague memory that accessing the RPC outside the localhost is disabled in the C++ source code for security reasons.

if you enable the rpc server, the default settings only allow 127.0.0.1 (localhost) to connect. You have to add allowed IPs. It's documented "./bitshares_client --help"
Title: Re: RPC API Reference?
Post by: devlux on July 20, 2015, 08:33:09 pm
Thanks, I modified a BTC library for golang to call the (roughly) equivalent JSON RPC calls for BTS.
Worked fine in development, as soon as I moved it to a live system it stopped working.

I'm thinking the JSON RPC system might be "deaf" since it's syncing but I can't rule out that the development system was using a different version of the bitshares_client.  It was compiled from source in what I think was the master branch at the time, this was around april or may.

I froze it there and built around that API and it seemed to work on testnet anyways.

Now I've changed so much in the live environment I'm not really sure where things are falling down.

I'm spinning up a new dev VM with the same images that I'm using in production to see if it's network related or client related.

I was hoping for more than a source code dive on the RPC API though :(
Come on, one yall gotta have a crib sheet somewhere :)  Just a peek!
Title: Re: RPC API Reference?
Post by: xeroc on July 21, 2015, 06:26:41 am
Worked fine in development, as soon as I moved it to a live system it stopped working.

I'm thinking the JSON RPC system might be "deaf" since it's syncing but I can't
rule out that the development system was using a different version of the
bitshares_client.  It was compiled from source in what I think was the master
branch at the time, this was around april or may.

Not sure what you mean by "stopped working". Could you elaborate?
You may want to take a look at my python implementation for RPC:
https://github.com/xeroc/python-bitsharesrpc
.. and some tools that make use of this library:
https://github.com/xeroc/bitshares-pytools

Anyways, you need to make sure to keep the client "up-to-date" to include
protocol-updates.  This will be more than necessary with BTS2.0 as you can then
vote for protocol updates (hard forks) and the protcol will enable new features
whenever the shareholders reach consensus about a hard fork (update)!

So, please make sure your ATMs can be updated easily!!