Zecwallet-Python is a simple wrapper around the Zecwallet Command Line LightClient written in Python

Overview

Zecwallet-Python

A wrapper around Zecwallet Command Line LightClient, written in Python

Table of Contents

About

Zecwallet-Python is a simple wrapper around the Zecwallet Command Line LightClient written in Python, allowing Python programs to easily interact with a fully-capable, lightweight Zcash wallet. Using this package with Zecwallet, one can easily send and receive (shielded) transactions, encrypt and decrypt messages, fetch the current, market value of Zcash, and so much more. This package makes all of the Zecwallet functionality easily available in Python, and uses no dependencies outside of Zecwallet, and the Python Standard Library. Common use cases for this package include cryptocurrency trading bots, online payment processing for Zcash (including support for shielded transactions), and encrypted communication systems.

Please note that this project is independent from Zecwallet, and has not been audited for security and reliability. Use at your own risk.

Installation

To use Zecwallet-Python, you will need to install Zecwallet Command Line LightClient first. You can do this by downloading their latest release, unzipping it, and then making note of the filepath to the zecwallet-cli executable on your system.

Note: The latest version of Zecwallet to be tested for full compatibility with Zecwallet-Python is v1.7.7

Example installation for most Linux distributions:

wget https://github.com/adityapk00/zecwallet-light-cli/releases/download/v1.7.7/linux-zecwallet-cli-v1.7.7.zip -O /tmp/zecwallet.zip
unzip /tmp/zecwallet.zip -d /home/ubuntu/ZcashWallet

Next, you will need to install Zecwallet-Python, which can by done using pip:

pip3 install zecwallet

Alternatively, you may copy the wallet.py file from our GitHub repository, and import that locally into your project.

Usage

To interact with your Zcash wallet in Python, you must first import the Wallet class, then initialize it, providing the full filepath to the zecwallet-cli executable and your wallet decryption key. It is not required nor recommended to provide the wallet decryption key unless you need to take advantage of functionality that requires the key.

from zecwallet.wallet import Wallet
myWallet = Wallet('/path/to/zecwallet-cli' , 'MyDecryptionKey')

Once you've instantiated your wallet, you'll have access to all of the following functions. These functions accept (sometimes optional) arguments as indicated below, and return the same datatypes returned by the Zecwallet CLI (usually a dictionary or a list).

Note that, as a wrapper, the descriptions, functionality, and returned results are nearly identical to those provided by Zecwallet.
 |  addresses()
 |      List current addresses in the wallet
 |  
 |  balance()
 |      Show the current ZEC balance in the wallet
 |      
 |      Transparent and Shielded balances, along with the addresses they belong to are displayed
 |  
 |  clear()
 |      Clear the wallet state, rolling back the wallet to an empty state.
 |      
 |      This command will clear all notes, utxos and transactions from the wallet, setting up the wallet to be synced from scratch.
 |  
 |  communicate(command)
 |      Send a custom command directly to zecwallet
 |  
 |  decrypt()
 |      Completely remove wallet encryption, storing the wallet in plaintext on disk
 |      Note 1: This will decrypt the seed and the sapling and transparent private keys and store them on disk.
 |      Note 2: If you've forgotten the password, the only way to recover the wallet is to restore
 |      from the seed phrase.
 |  
 |  decryptMessage(encryptedMessageBase64)
 |      Attempt to decrypt a message with all the view keys in the wallet.
 |  
 |  defaultFee(blockHeight='')
 |      Returns the default fee in zats for outgoing transactions
 |  
 |  encrypt(WALLET_ENCRYPTION_KEY)
 |      Encrypt the wallet with a password
 |      Note 1: This will encrypt the seed and the sapling and transparent private keys.
 |      Use 'decrypt' to permanatly remove the encryption
 |      Note 2: If you forget the password, the only way to recover the wallet is to restore
 |      from the seed phrase.
 |  
 |  encryptMessage(address, memo)
 |      Encrypt a memo to be sent to a z-address offline
 |      
 |      NOTE: This command only returns the encrypted payload. It does not broadcast it. You are expected to send the encrypted payload to the recipient offline
 |  
 |  encryptionStatus()
 |      Check if the wallet is encrypted and if it is locked
 |  
 |  export()
 |      Export private key for an individual wallet addresses.
 |      Note: To backup the whole wallet, use the 'seed' command insted
 |  
 |  getOption(optionName)
 |      Get a wallet option
 |  
 |  height()
 |      Get the latest block height that the wallet is at.
 |  
 |  importKey(spendingOrViewingKey, birthday, noRescan=False)
 |      Import an external spending or viewing key into the wallet
 |      
 |      Birthday is the earliest block number that has transactions belonging to the imported key. Rescanning will start from this block. If not sure, you can specify '0', which will start rescanning from the first sapling block.
 |      Note that you can import only the full spending (private) key or the full viewing key.
 |  
 |  info()
 |      Get info about the lightwalletd we're connected to
 |  
 |  lastTXID()
 |      Show the latest TxId in the wallet
 |  
 |  list(allMemos=False)
 |      List all incoming and outgoing transactions from this wallet
 |      
 |      If you include the 'allmemos' argument, all memos are returned in their raw hex format
 |  
 |  newShieldedAddress()
 |      Create a new shielded address in this wallet
 |  
 |  newTransparentAddress()
 |      Create a new transparent address in this wallet
 |  
 |  notes(all=False)
 |      Show all sapling notes and utxos in this wallet
 |      
 |      If you supply the "all = True" argument, all previously spent sapling notes and spent utxos are also included
 |  
 |  quit()
 |      Save the wallet to disk and quit
 |      
 |      Destroys the wallet instance
 |  
 |  rescan()
 |      Rescan the wallet, rescanning all blocks for new transactions
 |      
 |      This command will download all blocks since the intial block again from the light client server
 |      and attempt to scan each block for transactions belonging to the wallet.
 |  
 |  save()
 |      Save the wallet to disk
 |      
 |      The wallet is saved to disk. The wallet is periodically saved to disk (and also saved upon exit)
 |      but you can use this command to explicitly save it to disk
 |  
 |  seed()
 |      Show the wallet's seed phrase
 |      
 |      Your wallet is entirely recoverable from the seed phrase. Please save it carefully and don't share it with anyone
 |  
 |  send(destinationAddress, amountInZatoshis, memo='')
 |      Send ZEC to a given address(es)
 |      
 |      NOTE: The fee required to send this transaction is additionally deducted from your balance.
 |  
 |  sendProgress()
 |      Get the progress of any send transactions that are currently computing
 |  
 |  setOption(optionName, optionValue)
 |      Set a wallet option
 |      
 |      List of available options:
 |      download_memos : none | wallet | all
 |  
 |  shield(optionalAddress='')
 |      Shield all your transparent funds
 |      
 |      NOTE: The fee required to send this transaction is additionally deducted from your balance.
 |  
 |  sync()
 |      Sync the light client with the server
 |  
 |  syncStatus()
 |      Get the sync status of the wallet
 |  
 |  zecPrice()
 |      Get the latest ZEC price in the wallet's currency (USD)

Examples

>>> from zecwallet.wallet import Wallet
>>> myWallet = Wallet('/home/ubuntu/ZcashWallet/zecwallet-cli' , 'decryptionKey')
>>> myWallet.zecPrice()
{'zec_price': 93.11905232470494, 'fetched_at': 1654321098, 'currency': 'USD'}
>>> myWallet.newShieldedAddress()
['zs1tnk62y6sn4mwrwyxrhjxjth6lzlsaggmnkEXAMPLEwsftk760yxrsme44kp997eps0w6z4g7vd9']
>>> myWallet.save()
{'result': 'success'}
>>> del myWallet
You might also like...
A command line application, written in Python, for interacting with Spotify.
A command line application, written in Python, for interacting with Spotify.

spotify-py-cli A command line application, written in Python, for interacting with Spotify. The primary purpose behind developing this app was to gain

Color preview command-line tool written in python
Color preview command-line tool written in python

Color preview command-line tool written in python

A collection of command-line interface games written in python
A collection of command-line interface games written in python

Command Line Interface Python Games Collection of some starter python game projects for beginners How to play these games Clone this repository git cl

Animefetch is an anime command-line system information tool written in python
Animefetch is an anime command-line system information tool written in python

Animefetch - v0.0.3 An anime command-line system information tool written in python. Description Animefetch is an anime command-line system informatio

An anime command-line system information tool written in python.
An anime command-line system information tool written in python.

Animefetch - v0.0.3 An anime command-line system information tool written in python. Description Animefetch is an anime command-line system informatio

split-manga-pages: a command line utility written in Python that converts your double-page layout manga to single-page layout.

split-manga-pages split-manga-pages is a command line utility written in Python that converts your double-page layout manga (or any images in double p

A simple command-line tracert implementation in Python 3 using ICMP packets
A simple command-line tracert implementation in Python 3 using ICMP packets

Traceroute A simple command-line tracert implementation in Python 3 using ICMP packets Details Traceroute is a networking tool designed for tracing th

A very simple and lightweight ToDo app using python that can be  used from the command line
A very simple and lightweight ToDo app using python that can be used from the command line

A very simple and lightweight ToDo app using python that can be used from the command line

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Releases(v1.5.1)
Owner
Priveasy
The Official, Priveasy GitHub Account.
Priveasy
Get latest astronomy job and rumor news in your command line

astrojobs Tired of checking the AAS job register and astro rumor mill for job news? Get the latest updates in the command line! astrojobs automaticall

Philip Mocz 19 Jul 20, 2022
Easily handle day to day CLI operation via Python instead of regular Bash programs.

pz Ever wished to use Python in Bash? Would you choose the Python syntax over sed, awk, ...? Should you exactly know what command would you use in Pyt

CZ.NIC 697 Jan 03, 2023
電通大のCLIツールです

uecli 電通大のCLIツールです。コマンドラインからシラバス検索、成績参照、図書館の貸出リストなどを見ることができます インストール pip install uecli 使い方 シラバスを検索 uecli syllabus search -s 'コンピュータサイエンス' シラバスを取得し、Mar

UEC World Dominators 2 Oct 31, 2021
Command line tool to keep track of your favorite playlists on YouTube and many other places.

Command line tool to keep track of your favorite playlists on YouTube and many other places.

Wolfgang Popp 144 Jan 05, 2023
A Julia library for solving Wordle puzzles.

Wordle.jl A Julia library for solving Wordle puzzles. Usage julia import Wordle: play julia play("panic") 4 julia play("panic", verbose = true) I

John Myles White 3 Jan 23, 2022
A simple script to make the operation of AltServer-Linux more easier with cli

A simple script to make the operation of AltServer-Linux more easier with cli

powen 23 Dec 13, 2022
xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt.

xonsh xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.6+ with additio

xonsh 6.7k Jan 08, 2023
Simple tool, to update linux kernel on ubuntu

Kerbswap Simple tool, to update linux kernel on ubuntu Information At the moment, this tool only supports "Ubuntu" distributions, but will be expanded

dword 1 Oct 31, 2021
A command line application to analyse reports from TBC Warcraft Logs.

README A command line application to analyse reports from TBC Warcraft Logs. The application was written and tested with Python 3.9. Features Dumps an

2 Dec 17, 2021
A simple note taker CLI program written in python

note-taker A simple note taker program written in python This allows you to snip your todo's, notes, and your tasks easily without extra charges Requi

marcusz 4 Nov 02, 2021
eBay's TSV Utilities: Command line tools for large, tabular data files. Filtering, statistics, sampling, joins and more.

Command line utilities for tabular data files This is a set of command line utilities for manipulating large tabular data files. Files of numeric and

eBay 1.4k Jan 09, 2023
A Yahtzee-solving python package and command line tool.

yahtzee A Yahtzee-solving python package and command line tool. The algorithm is mathematically guaranteed to have the best strategy. That is, it maxi

David Merrell 0 Aug 19, 2022
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
A simple and easy-to-use CLI parse tool.

A simple and easy-to-use CLI parse tool.

AbsentM 1 Mar 04, 2022
A CLI Password Manager made using Python and Postgresql database.

ManageMyPasswords (CLI Edition) A CLI Password Manager made using Python and Postgresql database. Quick Start Guide First Clone The Project git clone

Imira Randeniya 1 Sep 11, 2022
Lets you view, edit and execute Jupyter Notebooks in the terminal.

Lets you view, edit and execute Jupyter Notebooks in the terminal.

David Brochart 684 Dec 28, 2022
jenkins-tui is a terminal based user interface for Jenkins.

jenkins-tui 📦 jenkins-tui is a terminal based user interface for Jenkins. 🚧 ⚠️ This app is a prototype and in very early stages of development. Ther

Craig Gumbley 22 Oct 24, 2022
Autosub - Command-line utility for auto-generating subtitles for any video file

Auto-generated subtitles for any video Autosub is a utility for automatic speech recognition and subtitle generation. It takes a video or an a

Anastasis Germanidis 3.9k Jan 05, 2023
Create argparse subcommands with decorators.

python-argparse-subdec This is a very simple Python package that allows one to create argparse's subcommands via function decorators. Usage Create a S

Gustavo José de Sousa 7 Oct 21, 2022
A simple command-line tracert implementation in Python 3 using ICMP packets

Traceroute A simple command-line tracert implementation in Python 3 using ICMP packets Details Traceroute is a networking tool designed for tracing th

James 3 Jul 16, 2022