X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=docs%2Fconsole.html;fp=docs%2Fconsole.html;h=9026a86382d7b42aed00dc54aaa81eebcde354c7;hb=89df5801499864753755cd069a267addbf7003e1;hp=0000000000000000000000000000000000000000;hpb=967abcb359fa416879fe1a0cab7578babe3856d0;p=electrum-nvc.git diff --git a/docs/console.html b/docs/console.html new file mode 100644 index 0000000..9026a86 --- /dev/null +++ b/docs/console.html @@ -0,0 +1,61 @@ + + +This is the documentation for the Electrum Console.
+ + +
+
+Most Electrum command-line commands are also available in the console.
+The results are Python objects, even though they are +sometimes rendered as JSON for clarity.
+
+Let us call listunspent(), to see the list of unspent outputs in the wallet: +
+>> listunspent()
+[
+    {
+        "address": "12cmY5RHRgx8KkUKASDcDYRotget9FNso3", 
+        "index": 0, 
+        "raw_output_script": "76a91411bbdc6e3a27c44644d83f783ca7df3bdc2778e688ac", 
+        "tx_hash": "e7029df9ac8735b04e8e957d0ce73987b5c9c5e920ec4a445130cdeca654f096", 
+        "value": 0.01
+    }, 
+    {
+        "address": "1GavSCND6TB7HuCnJSTEbHEmCctNGeJwXF", 
+        "index": 0, 
+        "raw_output_script": "76a914aaf437e25805f288141bfcdc27887ee5492bd13188ac", 
+        "tx_hash": "b30edf57ca2a31560b5b6e8dfe567734eb9f7d3259bb334653276efe520735df", 
+        "value": 9.04735316
+    }
+]
+
+Note that the result is rendered as JSON.
+However, if we save it to a Python variable, it is rendered as a Python object: +
+>> u = listunspent()
+>> u
+[{'tx_hash': u'e7029df9ac8735b04e8e957d0ce73987b5c9c5e920ec4a445130cdeca654f096', 'index': 0, 'raw_output_script': '76a91411bbdc6e3a27c44644d83f783ca7df3bdc2778e688ac', 'value': 0.01, 'address': '12cmY5RHRgx8KkUKASDcDYRotget9FNso3'}, {'tx_hash': u'b30edf57ca2a31560b5b6e8dfe567734eb9f7d3259bb334653276efe520735df', 'index': 0, 'raw_output_script': '76a914aaf437e25805f288141bfcdc27887ee5492bd13188ac', 'value': 9.04735316, 'address': '1GavSCND6TB7HuCnJSTEbHEmCctNGeJwXF'}]
+
+
+This makes it possible to combine Electrum commands with Python.
+For example, let us pick only the addresses in the previous result: +
+>> map(lambda x:x.get('address'), listunspent())
+[
+    "12cmY5RHRgx8KkUKASDcDYRotget9FNso3", 
+    "1GavSCND6TB7HuCnJSTEbHEmCctNGeJwXF"
+]
+
+Here we combine two commands, listunspent +and dumpprivkeys, in order to dump the private keys of all adresses that have unspent outputs: +
+>> dumpprivkeys( map(lambda x:x.get('address'), listunspent()) )
+{
+    "12cmY5RHRgx8KkUKASDcDYRotget9FNso3": "***************************************************", 
+    "1GavSCND6TB7HuCnJSTEbHEmCctNGeJwXF": "***************************************************"
+}
+
+Note that dumpprivkey will ask for your password if your wallet is encrypted. +
+ +