Author Topic: RPC API Reference?  (Read 2046 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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!!


Offline devlux

  • Full Member
  • ***
  • Posts: 63
    • View Profile
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!

Offline maqifrnswa

  • Hero Member
  • *****
  • Posts: 661
    • View Profile
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"
maintains an Ubuntu PPA: https://launchpad.net/~showard314/+archive/ubuntu/bitshares [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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

jakub

  • Guest
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

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.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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?

Offline devlux

  • Full Member
  • ***
  • Posts: 63
    • View Profile
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.