Author Topic: Wallet API acess  (Read 5067 times)

0 Members and 1 Guest are viewing this topic.

Offline valzav

  • Sr. Member
  • ****
  • Posts: 294
    • View Profile
I've tried some examples accessing bitshres_client started at port 5000 for example, but now it looks I have problems with cross origin allowed. Does anyone have any idea ?
Looks like you are using JS to access bitshares_client.  Take a look at https://github.com/BitShares/web_wallet - it's a good example of JS application communticating with with the wallet.

EkremH

  • Guest
I've tried some examples accessing bitshres_client started at port 5000 for example, but now it looks I have problems with cross origin allowed. Does anyone have any idea ?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
« Last Edit: July 31, 2019, 08:47:16 am by xeroc »

EkremH

  • Guest
I think you helped me. I tried with curl and I get result. But do you have any simple example with angular.js ore node.js how to access directly ? It would help me too much

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
You CAN just load the page in a browser, if you're trying to access the wallet GUI. In that case you need to make "htdocs" point to "web_wallet/generated" after you run "lineman build".

If you're trying to do direct API access then you need to POST to /rpc
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
You nees to post a request .. you cannot just load the page in the browser... search the forum for "curl" to find a working example

EkremH

  • Guest
I've followed the instructions form Bitshares GUI (web wallet). I wanna start a client and access the RCP json. My config file looks like this:
  "rpc": {
    "enable": true,
    "rpc_user": "test",
    "rpc_password": "test",
    "rpc_endpoint": "127.0.0.1:0",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "./htdocs"
  }
and so on.

I start the client with this command: ./bitshares_client --server / --rpcuser=test --rpcpassword=test /  --httpdendpoint=127.0.0.1:5000.

 And I get this result at console:

Loading blockchain from: /home/ekrem/.BitShares/chain
Loading config from file: /home/ekrem/.BitShares/config.json
Starting JSON RPC server on port 48449 (localhost only)
Starting HTTP JSON RPC server on port 5000 (localhost only)
Attempting to map P2P port 1776 with UPNP...
Listening for P2P connections on port 1776
Adding peer 54.77.51.177:1776 to peer database
Adding peer 104.131.35.149:1776 to peer database
Adding peer 106.185.26.162:1776 to peer database
Adding peer 178.62.50.61:1779 to peer database
Adding peer 178.62.50.61:1778 to peer database
Adding peer 178.62.157.161:1776 to peer database
Adding peer 180.153.142.120:1777 to peer database
Adding peer 5.101.106.138:1777 to peer database
Adding peer 61.129.33.213:1776 to peer database
Adding peer 95.85.33.16:8764 to peer database
Adding peer 46.226.109.66:1776 to peer database
Adding peer 84.238.140.192:42577 to peer database
Adding peer 188.226.195.137:60696 to peer database
Adding peer 5.101.106.138:1778 to peer database
Adding peer 5.101.106.138:1776 to peer database
Adding peer 178.62.50.61:1776 to peer database
Adding peer 54.79.27.224:1776 to peer database
Adding peer 185.25.22.21:1776 to peer database
Adding peer 178.62.50.61:1777 to peer database
Adding peer 85.214.53.224:1776 to peer database
--- there are now 8 active connections to the p2p network
--- syncing with p2p network, 4861 blocks left to fetch
--- syncing with p2p network, our last block is 10 hours old
--- currently syncing at 48 blocks/sec, 70 seconds remaining
--- in sync with p2p network
--- there are now 6 active connections to the p2p network
(wallet closed)

When I go to localhost:5000, it show me a dialog windows that requires username and password (A username and password are beeing required by localhost:5000. This site says "bts wallet"). I've wrote username: test and password: test, like in my config.json file and the command I started bitshares_client, and the result I've get is "Invalid RPC Request".

Does anyone have the idea how to solve this?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
maybe someday bitsharesblocks.com will have a documented API

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Ok, I'll try to explain. I wanna show for example any data from my bitshares wallet in my app. To do this, is there any public API or I have to install the bitshares tookit?

These guys are creating a "public" API for their mobile wallet: https://bitsharestalk.org/index.php?topic=11902.0
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

EkremH

  • Guest
Ok, I'll try to explain. I wanna show for example any data from my bitshares wallet in my app. To do this, is there any public API or I have to install the bitshares tookit?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc

Offline svk

I'm not sure what you mean by wallet API. The web_wallet is simply the html/javascript code for the wallet, you can use it to run a wallet as a web server on your local machine. The RPC API of the wallet is run from the client, by launching it with:

Code: [Select]
bitshares_client --server
You'll need to setup the config.json file in the .Bitshares folder in order to set the password and login name.

If you explain what you're trying to more precisely we can probably help you better.
Worker: dev.bitsharesblocks

EkremH

  • Guest
I wanna play around with wallet API. To install I followed the instruction from 'github.com/BitShares/web_wallet' and I cannot find this directory '/bitshares_toolkit/programs/client/RelWithDebInfo' (the folder 'RelWithDebInfo' doesn't exist in my bitshares toolkit insalled in my machine using these instructions). Does anyone have any idea if the folder is changed (if I am doing right)? Or, may anyone give me any idea how to access the wallet API? I'll appreciate your help!