How to pass the `password` argument to password set wallet through JSONRPC API?
I created password set wallet.
Started electrum deamon with command electrum daemon start
Then loaded the wallet electrum daemon load_wallet
It had been successfully loaded.
I want to use payto command. So I tested it out on console.
electrum payto ADDRESS AMOUNT --fee FEE --password PASSWORD
And it worked. Returning the result of
{
"complete": true,
"final": true,
"hex": "HEX...."
}
But when I try this though JSONRPC...
requests.post("http://localhost:7777", json={
"id": "asdf",
"method": "payto",
"params": {
"amount": 0.01,
"destination": "ADDRESS",
"tx_fee": 0.01,
"password": "PASSWORD"
}
})
I get this
{"error": {"message": "Server error: File \\"/Users/jinsung/Desktop/AlecPay/electrum/lib/python2.7/site-packages/electrum/commands.py\\", line 83, in func_wrapper | TypeError: payto() got an unexpected keyword argument \'password\'", "code": -32603}, "jsonrpc": "2.0", "id": "asdf"}
And if I send the request without the password argument, I get this
{"error": {"message": "Server error: File \\"/Users/jinsung/Desktop/AlecPay/electrum/lib/python2.7/site-packages/electrum/bitcoin.py\\", line 769, in deserialize_xkey | TypeError: object of type \'NoneType\' has no len()", "code": -32603}, "jsonrpc": "2.0", "id": "asdf"}
Question: Can you use password set wallet on electrum deamon through json-rpc? If so, how?
FYI, I'm using the daemon with -P --testnet options. But I think it doesn't matter.
that is not possible with the current design. I'll try to fix that before the next release.
@ecdsa : any ETA on next release ?
The same problem
I really would like to be able to create a wallet or restore a wallet from the command line by also passing a password (or blank password) through to electrum
Hello! I try send bitcoin from JSONRPC API:
curl --data-binary '{"jsonrpc":"2.0","id":"curltext","method":"payto", "params":["mhurdcChDVEd6PzN4uSqXBUiH5Tinbdi2j", "0.0001"]}' http://user:[email protected]:7777
But, I get error:
`{"result": {"error": "Password required"}, "id": "curltext", "jsonrpc": "2.0"}`
Yes, my wallet use password. I enter it at start:
(core) antsa0110@pc:~/Documents/projects/test/core$ electrum daemon start --testnet
starting daemon (PID 12375)
(core) antsa0110@pc:~/Documents/projects/test/core$ electrum daemon load_wallet -w /home/antsa0110/.electrum/testnet/wallets/testnet_electrum_wallet --testnet
Password:
true
(core) antsa0110@pc:~/Documents/projects/test/core$ electrum daemon status --testnet
{
"auto_connect": true,
"blockchain_height": 1782018,
"connected": true,
"current_wallet": "/home/antsa0110/.electrum/testnet/wallets/testnet_electrum_wallet",
"fee_per_kb": 1000,
"path": "/home/antsa0110/.electrum/testnet",
"server": "testnet.qtornado.com",
"server_height": 1782018,
"spv_nodes": 5,
"version": "3.3.8",
"wallets": {
"/home/antsa0110/.electrum/testnet/wallets/testnet_electrum_wallet": true
}
}
How to pass the password argument to password set wallet through JSONRPC API?
I found solution:
curl --data-binary '{"jsonrpc":"2.0","id":"curltext","method":"payto", "params": {'amount': '0.0001', 'destination': 'mx5yUVPjJuWWnKYBLLftFHv8X6JB6XhnmY', 'password': '123'}}' http://user:[email protected]:7777
params is dict, not list...
@antsa0110 related: https://github.com/spesmilo/electrum/issues/6221