Author Topic: Process of sending amount from my account to another  (Read 1845 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
- Instead of putting "localhost" for your wallet .. you can also use an IP address or a fully qualifying domain, e.g. mywallet.mydomain.com
- You can import private keys into your wallet with python the same way you would do it with the cli-wallet.. somthing along the lines of
  client.rpc.import_key("accountname", "privatekey")
- Transfers are initated by calling 'transfer' in the cli-wallet .. that call can be done with RPC as well and is available via
   client.rpc.transfer(from, to, amount, asset, memo, True)

As to your code .. please take a closer look at http://docs.bitshares.eu/api/#interfacing-with-graphene
the websocket server (as indicated with the "wss") does not offer a transfer API .. it is the full node and can only poll data from the blockchain.
you need to run a cli wallet locally and connect your python to that wallet ..

Offline sharique-knysys

  • Newbie
  • *
  • Posts: 19
    • View Profile
I have used that api. First of all I made witness node and wallet which runs on port 8090 and 8092 respectively, then connect to that api with above code. Import desired private key into cli_wallet(with command line) and run above code, this code can transfer funds from one account to another. In this code you mentioned localhost. My first question is how can I connect to remote host? My second question is how can I import private key through python code then transfer funds to other account? Or is there any rpc api of graphene for transferring funds. I used following code but it is not working. Can anybody tell me what is missing in that code?

Code: [Select]
import json
from grapheneapi import GrapheneAPI


if __name__ == '__main__':
    client = GrapheneAPI("wss://bitshares.openledger.info/ws", 443, "", "")
    res = client.transfer("fromaccount", "toaccount", "10", "BTS", "Sending 10 BTS", True);
« Last Edit: February 26, 2016, 09:50:11 am by sharique-knysys »

Offline xeroc

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

Code: [Select]
from grapheneapi import GrapheneAPI
rpc = GrapheneAPI("localhost", 8092, "", "")
res = rpc.transfer("sender","receiver","5", "USD", "memo", True);

note that I use rpc.transfer instead of client.transfer!

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Here is some more docs;
http://python-graphenelib.readthedocs.org/en/latest/client.html

Example:
Code: [Select]
from grapheneapi.grapheneclient import GrapheneClient
class Config():
    wallet_host           = "localhost"
    wallet_port           = 8092

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

Offline sharique-knysys

  • Newbie
  • *
  • Posts: 19
    • View Profile
I have found the scripts on this link. Now I want to transfer currency. How can I use previous account with wallet to transfer currency to other account

Offline sharique-knysys

  • Newbie
  • *
  • Posts: 19
    • View Profile
Hi

I am using graphenelib and I want to transfer some currency to another account. What is the process? I have found the docs of graphenelib but it says use  this line to transfer res = client.transfer("sender","receiver","5", "USD", "memo", True); on this link http://python-graphenelib.readthedocs.org/en/latest/rpc.html. I don't know how to use this code. Please share the code with me so I can transfer amount from my account.