Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Wallet API acess  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

Offline EkremH

  • Newbie
  • *
  • Posts: 16
    • View Profile
Wallet API acess
« on: November 26, 2014, 04:08:35 PM »

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!

Offline svk

Re: Wallet API acess
« Reply #1 on: November 26, 2014, 05:38:49 PM »
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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12175
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Wallet API acess
« Reply #2 on: November 26, 2014, 07:48:35 PM »
An example for the use of the RPC interface with python:
https://github.com/xeroc/pytshares/blob/master/btsrpcapi.py

Also related thread:
https://bitsharestalk.org/index.php?topic=5562.0;all
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline EkremH

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Wallet API acess
« Reply #3 on: December 01, 2014, 03:41:54 PM »
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 pc

  • Hero Member
  • *****
  • Posts: 1032
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BTS: cyrano
  • Witness: cyrano
  • Payrate: 100%
Re: Wallet API acess
« Reply #4 on: December 01, 2014, 04:08:43 PM »
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
Please vote for my BitShares witness "cyrano" and for my STEEM witness "cyrano.witness"!
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12175
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Wallet API acess
« Reply #5 on: December 01, 2014, 05:46:32 PM »
maybe someday bitsharesblocks.com will have a documented API
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline EkremH

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Wallet API acess
« Reply #6 on: December 04, 2014, 12:56:54 PM »
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: 12175
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Wallet API acess
« Reply #7 on: December 04, 2014, 01:54:25 PM »
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
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline toast

Re: Wallet API acess
« Reply #8 on: December 04, 2014, 04:27:21 PM »
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 EkremH

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Wallet API acess
« Reply #9 on: December 05, 2014, 02:47:00 PM »
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 xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12175
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline EkremH

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Wallet API acess
« Reply #11 on: December 05, 2014, 05:57:22 PM »
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 valzav

  • Sr. Member
  • ****
  • Posts: 294
    • View Profile
Re: Wallet API acess
« Reply #12 on: December 05, 2014, 06:39:07 PM »
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.

 

Google+