Using ElectronCash Console (Beginner)

This website was created for the convenience of finding most ElectronCash commands, please see official Python Console Documents for more console information.

The commands on this page are compatible with the following ElectronCash clients:

ElectronCash (BitcoinCash Wallet) - https://electroncash.org/#download

Make sure to only download from the official ElectronCash website and always verify the digital signatures.


First enable the console tab by going to View -> Show Console.

e1

Continue by typing "I understand the risk" and clicking "Confirm".

e2

Do not enter code here that you don't understand. Executing the wrong code could lead to your coins being irreversibly lost. If someone you do not trust wants you to enter something here, that person might be attempting a social engineering / phishing attack on you.

Pre Generate Addresses

Command:
for i in range(0,500): wallet.create_new_address(False)

Description: Sometimes you need to pre generate addresses in advance and need a high number of them, this command will pre generate 500 receiving addresses.

>>> for i in range(0,500): wallet.create_new_address(False)

Now that you have generated the addresses, change the gap limit so ElectronCash daemon can sync transactions from these addresses and show true balance.

Command:
wallet.change_gap_limit(550)

>>> wallet.change_gap_limit(550)
True

We can now list the addresses we generated.

Command:
listaddresses()

>>> listaddresses()
[
    "qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78",
    "qpz66v2kw6h73e5ffx632xlkfpe34pa4w5tn369zgt",
    "qpggvazsw2rd76fu00tz7h4j3gpdpa3g6ses7dxycm",
    "qp8qhzwvmx238rd6mk7f97ugg064pc5fssjhlz4ea8",
    "qz3vraytldmq7fswqnusjzn0m8zwrm3pns37lg90el",
    ...
]

getinfo()

Command:
getinfo()

Description: Return network info, wallet path, version, ect.

Example Usage:
>>> getinfo()
{
    "auto_connect": true,
    "blockchain_height": 775000,
    "connected": false,
    "default_wallet": "/home/user/.electron-cash/wallets/default_wallet",
    "fee_per_kb": 1000,
    "path": "/home/user/.electron-cash",
    "server": "bch.soul-dev.com",
    "server_height": 0,
    "spv_nodes": 0,
    "version": "4.2.14",
    "wallets": {
        "/home/user/.electron-cash/wallets/default_wallet": false
    }
}

getbalance()

Command:
getbalance()

Description: Return ElectronCash balance (Synchronization required first for true balance).

Example Usage:
>>> getbalance()
{
    "confirmed": "5.250202"
}

getservers()

Command:
getservers()

Description: Return list of ElectronCash servers.

Example Usage:
>>> getservers()
{
    "7nshufncf3nmp7pa42oqhnj6whsjgo2eok4jveex62tczuhvqur5ciad.onion": {
        "display": "electrum.imaginary.cash",
        "pruning": "-",
        "t": "50001",
        "version": "1.4.1"
    },
    "bch.crypto.mldlabs.com": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.2"
    },
    "bch.cyberbits.eu": {
        "pruning": "-",
        "s": "50002",
        "version": "1.4.2"
    },
    "bch.imaginary.cash": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.1"
    },
    "bch.loping.net": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.1"
    },
    "bch.soul-dev.com": {
        "pruning": "-",
        "s": "50002",
        "version": "1.4.1"
    },
    "bch0.kister.net": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.1"
    },
    "bch2.electroncash.dk": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.3"
    },
    "bitcoincash.network": {
        "pruning": "-",
        "s": "50002",
        "version": "1.4.1"
    },
    "blackie.c3-soft.com": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.1"
    },
    "cashnode.bch.ninja": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.4"
    },
    "electron.jochen-hoenicke.de": {
        "pruning": "-",
        "s": "51002",
        "t": "51001",
        "version": "1.4.1"
    },
    "electroncash.de": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4"
    },
    "electroncash.dk": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.2"
    },
    "electrs.bitcoinunlimited.info": {
        "pruning": "-",
        "s": "50002",
        "version": "1.4"
    },
    "electrs.electroncash.de": {
        "pruning": "-",
        "s": "40002",
        "version": "1.4"
    },
    "electrum.bitcoinverde.org": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.4"
    },
    "electrum.imaginary.cash": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.3"
    },
    "electrumx-bch.cryptonermal.net": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.2"
    },
    "electrumx-cash.1209k.com": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.2"
    },
    "fulcrum.fountainhead.cash": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4"
    },
    "j2tjfxntnsqpojaamnndgmfrc6lh3thattnlpc2xx53h2ojoi7agccid.onion": {
        "display": "bch.loping.net",
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4.1"
    },
    "jh3jgcrwweh6yvmprtjnp72u2hqn34nlftlg3msrr4vmlapft4yvt2id.onion": {
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4"
    },
    "jktsologn7uprtwn7gsgmwuddj6rxsqmwc2vaug7jwcwzm2bxqnfpwad.onion": {
        "display": "electroncash.de",
        "pruning": "-",
        "s": "50002",
        "t": "50001",
        "version": "1.4"
    },
    "kisternet5tgeekwidrj7r7yd3n2l5j7y72b74y6xu3q2b6xdjrte6id.onion": {
        "pruning": "-",
        "t": "50001",
        "version": "1.4.1"
    }
}

getunusedaddress()

Command:
getunusedaddress()

Description: Return an unused receiving address.

Example Usage:
>>> getunusedaddress()
"qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78"

getaddressbalance()

Command:
getaddressbalance(address)

Description: Return balance from address.

Example Usage:
>>> getaddressbalance('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78')

getaddresshistory()

Command:
getaddresshistory(address)

Description: Return history from address.

Example Usage:
>>> getaddresshistory('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78')

getaddressunspent()

Command:
getaddressunspent(address)

Description: Return unspent from address.

Example Usage:
>>> getaddressunspent('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78')

payto()

Command:
payto(destination, amount)

Description: Send amount to destination address, using '!' will send entire balance, returns transaction ID for later broadcast.

Example Usage:
>>> payto('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78', '!')
000000FFEEAABBCCDDEE010203040506070809

broadcast()

Command:
broadcast(tx);

Description: Broadcast a transaction, used after payto().

Example Usage:
>>> broadcast('000000FFEEAABBCCDDEE010203040506070809')
true

listaddresses()

Command:
listaddresses()

Description: Return list of receiving addresses.

Example Usage:
>>> listaddresses()
[
    "qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78",
    "qpz66v2kw6h73e5ffx632xlkfpe34pa4w5tn369zgt",
    "qpggvazsw2rd76fu00tz7h4j3gpdpa3g6ses7dxycm",
    "qp8qhzwvmx238rd6mk7f97ugg064pc5fssjhlz4ea8",
    "qz3vraytldmq7fswqnusjzn0m8zwrm3pns37lg90el",
    "qpqdjjmlcuarhtt82kgxyrlfc2qp6x476uvqpr69f9",
    "qzsg43xzrc524nysjp5mx099x07qharx8vjfdxfrwu",
    "qz7ppen9dse3gzmxudnvwphxj2vsj8ky6cdm204we4",
    "qqtjfxz7wfq7fd9fanmv9xmllljg5pg6jyqvx43xgz",
    "qq7z2en92dd0sxvr68tp8cmgx35jm0kmnyj59flt28",
    "qrf6wvvk2h28zlp34vt39mymn94x3dh3mc7l8nspx0",
    "qpjkfqac4s55swmrfrctvfcrfc6ucz8wuv8fektn6f",
    "qz7l6reamvj86fwtvk0y3ffgpp34cx0elc75lchya7",
    "qr3xlg43kwwsu24gz78m43r2wdc03hyyf5kdumedl9",
    "qp68yywsw58cfj874nj07w4cvv827ymwa59rxf7ya7",
    "qpvjumcf3qkta8yzalwkrzrze58y2qhavs2k2wxncl",
    "qzxy3z40fcguwrgty3hmq8tfknr65q0ldsnhw6qq2u",
    "qr9mym9h5jhuh7wr9et39xvulw4xeu3nnvtgq96zw3",
    "qzeg9ca4x0veqf5ydrugnvesxezlp0tdlvaghtdq44",
    "qq6jppll03xg6xdvzekxj4e9vwjkjf42yusv42yme0"
]

is_synchronized()

Command:
is_synchronized()

Description: Return ElectronCash daemon syncronization status.

Example Usage:
>>> is_synchronized()
true

close_wallet()

Command:
close_wallet()

Description: Closes ElectronCash wallet.

Example Usage:
>>> close_wallet()
true

version()

Command:
version()

Description: Return ElectronCash client version.

Example Usage:
>>> version()
"4.3.4"

freeze()

Command:
freeze(address)

Description: Freeze address so funds cannot be withdrawn.

Example Usage:
>>> freeze('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78')

unfreeze()

Command:
unfreeze(address)

Description: Unfreeze address so funds can be withdrawn.

Example Usage:
>>> unfreeze('qzvndlrh2hsx4as4jjammcyg0ehwscrp7y3y6l7q78')

help()

Command:
help()

Description: Return list of all console commands.

Example Usage:
>>> help()
[
    "addrequest",
    "addressconvert",
    "broadcast",
    "check_electrum_seed",
    "check_seed",
    "clearrequests",
    "close_wallet",
    "commands",
    "create",
    "createmultisig",
    "createnewaddress",
    "decrypt",
    "deserialize",
    "dumpprivkeys",
    "encrypt",
    "freeze",
    "freeze_utxo",
    "get",
    "getaddressbalance",
    "getaddresshistory",
    "getaddressunspent",
    "getalias",
    "getbalance",
    "getconfig",
    "getfeerate",
    "getinfo",
    "getmasterprivate",
    "getmerkle",
    "getmpk",
    "getprivatekeys",
    "getpubkeys",
    "getrequest",
    "getseed",
    "getservers",
    "gettransaction",
    "getunusedaddress",
    "help",
    "history",
    "importprivkey",
    "is_synchronized",
    "ismine",
    "list_wallets",
    "listaddresses",
    "listcontacts",
    "listrequests",
    "listunspent",
    "load_wallet",
    "make_electrum_seed",
    "make_seed",
    "notify",
    "password",
    "payto",
    "paytomany",
    "restore",
    "rmrequest",
    "rpa_extract_private_keys_from_transaction",
    "rpa_generate_paycode",
    "rpa_generate_transaction_from_paycode",
    "searchcontacts",
    "serialize",
    "setconfig",
    "setlabel",
    "signmessage",
    "signrequest",
    "signtransaction",
    "stop",
    "sweep",
    "unfreeze",
    "unfreeze_utxo",
    "validateaddress",
    "verifymessage",
    "version"
]