Waves icon indicating copy to clipboard operation
Waves copied to clipboard

Get Publickey and private key of an address?

Open geethsameer686 opened this issue 8 years ago • 7 comments

I am using GET /addresses API to get the address. When I want to transfer waves from one address to another using POST /assets/broadcast/transfer, I have to request with

"assetId" [optional] - Asset ID to transfer or omit that param when transfer WAVES, Base58-encoded
"senderPublicKey" - Sender account's public key, Base58-encoded
"recipient" - Recipient account's address, Base58-encoded
"fee" - Transaction fee for Asset transfer, min = 100000 (WAVElets)
"feeAssetId" [optional] - Asset ID of transaction fee. WAVES by default, if empty or absent 
"amount" - amount of asset'lets (or wavelets) to transfer
"attachment" - Arbitrary additional data included in transaction, max length is 140 bytes, Base58-encoded
"timestamp" - Transaction timestamp
"signature" - Signature of all transaction data, Base58-encoded

Here how to get Public Key and Private key (to sign the transaction) of an address ( '3MwMwdzo6k1wwDE8JgiZmbM7nXEL6xmftPc')

geethsameer686 avatar Mar 20 '18 13:03 geethsameer686

You can create an account yourself using this doc or python library, but it's impossible to extract private key to sign the transaction from the node wallet using API for now. Also you can use a code of node to create an app to extract the keys from the wallet using your wallet password, but it's easier to create a new account without the node.

Tolsi avatar Mar 26 '18 11:03 Tolsi

@Tolsi How can I get the asset id's of all the tokens on waves platform? I can't find any API call to get the list of all the tokens with the asset ids. Could you tell me the process of how to get all the tokens with asset ids? Thanks.

geethsameer686 avatar Mar 26 '18 13:03 geethsameer686

Use http://dev.pywaves.org/assets/

Tolsi avatar Mar 26 '18 14:03 Tolsi

@Tolsi Thanks a lot.

geethsameer686 avatar Mar 26 '18 14:03 geethsameer686

@Tolsi I used the python library which you recommended me to use. Along with that I am using my local node as a testnet. I can't send the transaction. I will post the code and error. Please tell me where am I doing wrong.

import pywaves as pw
pw.setNode(node = 'http://127.0.0.1:6869',chain = 'testnet')
address = '3Mq6YmrnfoSt5T36i3S2XPXpXh8kP87DUw4'
publicKey = '9u6mN4kN8U7iQVsyNaru7ko6VV3E3pQ6sqcmmDwM6k7a'
privateKey = 'GczfiQJoqkp4E4pXGj7wicx53nckPyG46EWChEd9brzM'
myAddress = pw.Address(privateKey=privateKey) 
t_id = myAddress.sendWaves(recipient=pw.Address('3MwMwdzo6k1wwDE8JgiZmbM7nXEL6xmftPc'),amount = 10000000)

Error: {'error': 112, 'message': 'State check failed. Reason: invalid signature', 'tx': {'type': 4, 'id': 'BPP2CSFUBey5UybNDZpeeKJ7aEptMc2mXVmdYnUrAf3F', 'sender': '3Mq6YmrnfoSt5T36i3S2XPXpXh8kP87DUw4', 'senderPublicKey': '9u6mN4kN8U7iQVsyNaru7ko6VV3E3pQ6sqcmmDwM6k7a', 'fee': 100000, 'timestamp': 1521476122683, 'signature': '4PYFgEYtKJWG1zXQtmw3KMgR54opCnNBkfNQKieP4A6ywGNHainhfpNqnqhMwsoNeSW42C5kNyNs6K76tsSg1o3E', 'recipient': '3MwMwdzo6k1wwDE8JgiZmbM7nXEL6xmftPc', 'assetId': None, 'amount': 10000000, 'feeAsset': None, 'attachment': '1'}}

geethsameer686 avatar Mar 26 '18 15:03 geethsameer686

@geethsameer686 Tried your code (but the node is https://testnodes.wavesnodes.com) and seems all work.

vsuharnikov avatar May 03 '18 12:05 vsuharnikov

Moved to Close since the last comment was more that two months ago.

monroid avatar Jul 23 '18 15:07 monroid