3

I install Electrum in Ubuntu.

sudo apt-get install python-qt4 python-pip
sudo pip install https://download.electrum.org/2.6.4/Electrum-2.6.4.tar.gz

Then I start RPC on port 7777 and run daemon:

electrum setconfig rpcport 7777
electrum daemon start

I try RPC by curl:

curl --data-binary '{"id":"curltext","method":"wallet.create_new_address()","params":[]}' http://127.0.0.1:7777

I got error output:

{"error": {"message": "Method wallet.create_new_address() not supported.", "code": -32601}, "jsonrpc": "2.0", "id": "curltext"}

I tried the command 'wallet.create_new_address()' which can be executed in GUI console but RPC gives error.

1 Answer 1

1

There are two problems with your command.

First, any method you call should not be prefixed by wallet. or suffixed by ().

Also, there is no RPC method create_new_address. If you have a look at lib/commands.py you will see that the internal python method create_new_address() is called by the RPC method getunusedaddress, and only when the parameter force=true is given.

With the above in mind, try this:

curl --data-binary '{"id":"curltext","method":"getunusedaddress","params":{"force":true}}' http://127.0.0.1:7777

The equivalent shell command would be

electrum getunusedaddress --force

I tried this on electrum 2.8.3. Sadly, it always returns the same address. This is because the address remains unused.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.