Skip to main content

libdogecoin

A simple Python interface to interact with the libdogecoin C library written by the Dogecoin Foundation. This module contains wrappers for all user-facing address and transaction functions. For more information on usage of these wrappers, please refer to the bindings doc in the Dogecoin Foundation libdogecoin repo.

Installation

To begin using the libdogecoin module, simply install libdogecoin using pip3:

pip3 install libdogecoin

Libdogecoin is now ready to be imported within your python script!

API

All functions are prefixed with the letter "w" to differentiate the Python wrapper functions from the underlying C functions exposed via cffi.


w_context_start()

Start the secp256k1 context necessary for key pair generation. Must be started before calling any functions dealing with private or public keys.


w_context_stop()

Stop the current instance of the secp256k1 context. It is advised to wait until the session is completely over before stopping the context.


w_generate_priv_pub_key_pair(chain_code=0, as_bytes=False)

Generate a valid private key paired with the corresponding p2pkh address.

Parameters:

  • chain_code -- 0 for mainnet pair, 1 for testnet pair
  • as_bytes -- if True, return raw bytes instead of strings

Returns:

  • privkey -- the generated private key of the pair
  • p2pkh_pubkey -- the generated public key of the pair

w_generate_hd_master_pub_key_pair(chain_code=0, as_bytes=False)

Generate a master private and public key pair for use in hierarchical deterministic wallets. Public key can be used for child key derivation using w_generate_derived_hd_pub_key().

Parameters:

  • chain_code -- 0 for mainnet pair, 1 for testnet pair
  • as_bytes -- if True, return raw bytes instead of strings

Returns:

  • master_privkey -- the generated HD master private key of the pair
  • master_p2pkh_pubkey -- the generated HD master public key of the pair

w_generate_derived_hd_pub_key(wif_privkey_master, as_bytes=False)

Given a HD master private key, derive a child public key from it.

Parameters:

  • wif_privkey_master -- HD master private key as wif-encoded string
  • as_bytes -- if True, return raw bytes instead of a string

Returns:

  • child_p2pkh_pubkey -- the resulting child public key derived from the provided HD master private key

w_verify_priv_pub_keypair(wif_privkey, p2pkh_pubkey, chain_code=0)

Given a key private/public key pair, verify that the keys are valid and are associated with each other.

Parameters:

  • wif_privkey -- string containing wif-encoded private key
  • p2pkh_pubkey -- string containing address derived from wif_privkey
  • chain_code -- 0 for mainnet, 1 for testnet

Returns:

  • res -- 1 if the key pair is valid, 0 otherwise

w_verify_master_priv_pub_keypair(wif_privkey_master, p2pkh_pubkey_master, chain_code=0)

Given a keypair from generate_hd_master_pub_key_pair, verify that the keys are valid and are associated with each other.

Parameters:

  • wif_privkey_master -- string containing wif-encoded private master key
  • p2pkh_pubkey_master -- string containing address derived from wif_privkey
  • chain_code -- 0 for mainnet, 1 for testnet

Returns:

  • res -- 1 if the master key pair is valid, 0 otherwise

w_verify_p2pkh_address(p2pkh_pubkey)

Given a p2pkh address, confirm address is in correct Dogecoin format.

Parameters:

  • p2pkh_pubkey -- string containing basic p2pkh address

Returns:

  • res -- 1 if the address is valid, 0 otherwise.

w_start_transaction()

Create a new, empty dogecoin transaction.

Returns:

  • res -- the index of the newly created transaction in the session hash table

w_add_utxo(tx_index, hex_utxo_txid, vout)

Given the index of a working transaction, add another input to it.

Parameters:

  • tx_index -- the index of the working transaction to update
  • hex_utxo_txid -- the transaction id of the utxo to be spent
  • vout -- the number of outputs associated with the specified utxo

Returns:

  • res -- 1 if the input was added successfully, 0 otherwise.

w_add_output(tx_index, destination_address, amount)

Given the index of a working transaction, add another output to it.

Parameters:

  • tx_index -- the index of the working transaction to update
  • destination_address -- the address of the output being added
  • amount -- the amount of dogecoin to send to the specified address

Returns:

  • res -- 1 if the input was added successfully, 0 otherwise.

w_finalize_transaction(tx_index, destination_address, subtracted_fee, out_dogeamount_for_verification, changeaddress)

Given the index of a working transaction, prepares it for signing by specifying the recipient and fee to subtract, directing extra change back to the sender.

Parameters:

  • tx_index -- the index of the working transaction
  • destination address -- the address to send coins to
  • subtracted_fee -- the amount of dogecoin to assign as a fee
  • out_dogeamount_for_verification -- the total amount of dogecoin being sent (fee included)
  • changeaddress -- the address of the sender to receive their change

Returns:

  • res -- the hex string representation of the transaction if successfully finalized, 0 otherwise

w_get_raw_transaction(tx_index)

Given the index of a working transaction, returns the serialized object in hex format.

Parameters:

  • tx_index -- the index of the working transaction

Returns:

  • res -- the hex string representation of the transaction at index tx_index if it exists, 0 otherwise

w_clear_transaction(tx_index)

Discard a working transaction.

Parameters:

  • tx_index -- the index of the working transaction

w_sign_raw_transaction(tx_index, incoming_raw_tx, script_hex, sig_hash_type, privkey)

Sign a finalized raw transaction using the specified private key.

Parameters:

  • tx_index -- the input index to sign (0-based)
  • incoming_raw_tx -- the serialized hex string of the transaction to sign
  • script_hex -- the scriptPubKey hex of the input being signed
  • sig_hash_type -- the type of signature hash to be used (typically 1)
  • privkey -- the wif-encoded private key to sign with

Returns:

  • res -- the hex string of the (partially) signed transaction, 0 on failure

w_sign_transaction(tx_index, script_pubkey, privkey)

Sign all inputs of a working transaction using the specified private key and public key script.

Parameters:

  • tx_index -- the index of the working transaction to sign
  • script_pubkey -- the scriptPubKey hex associated with the inputs
  • privkey -- the wif-encoded private key to sign with

Returns:

  • res -- 1 if all inputs were signed successfully, 0 otherwise

w_store_raw_transaction(incoming_raw_tx)

Stores a raw transaction at the next available index in the hash table.

Parameters:

  • incoming_raw_tx -- the serialized hex string of the transaction to store

Returns:

  • res -- the index of the stored transaction, or 0 if the transaction exceeds 100 KB

w_remove_all()

Clear all working transactions from the session hash table.


available()

Return a list of the libdogecoin C function names present in the build this wheel was compiled against. Useful for checking which API surface is available at runtime.

Metadata

Release files for libdogecoin 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libdogecoin 0.1.1
File Size Uploaded
libdogecoin-0.1.1.tar.gz 17.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for libdogecoin 0.1.1
File
libdogecoin-0.1.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
libdogecoin-0.1.1-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details
libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARMv7l Details
libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
libdogecoin-0.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 CPython 3.10 Linux glibc 2.5+ x86-32, Linux glibc 2.17+ x86-32 Details
libdogecoin-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details

Total release size: 10.0 MB

Release files / libdogecoin-0.1.1.tar.gz

Download URL libdogecoin-0.1.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d6e3d5c443ad1efde20d24041be58a55d3f8160d6d90679bdd12e98dabf91f91
BLAKE2b-256 checksum
How to use checksums
fbaf0a649978e7d54a285f07cee54afb53789953473213b04f890c130f02f564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-win_amd64.whl

Download URL libdogecoin-0.1.1-cp310-cp310-win_amd64.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
325823396790dcc835b6aaa4eff64ce6d4e367a9abe5d2298ef8882b918d803d
BLAKE2b-256 checksum
How to use checksums
033232d33bec75fa0ac8c5d6e46d8e1acc3f60b2b2b8eebfd945be68cbf92ea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-win32.whl

Download URL libdogecoin-0.1.1-cp310-cp310-win32.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
9a7b4880c2d84175a85c3bf3f5e7b8de4e4811949b49c210126dc78e0b868c29
BLAKE2b-256 checksum
How to use checksums
a53d48e368a0ef778129d1c3446d1435dc4bfaa3f6b2d05d1349590f1139e2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
29b57543c79ae106702e99d7a3a6b34d0132a43f4b00d343b5cdb1754951f45e
BLAKE2b-256 checksum
How to use checksums
73e76f6e21e43056e5703a0386d5dbcc86321cf4c20266ede24096392a6be481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
8d1afee4e1a587120f473391c635ac5274cdd2407d9d69c0843bc732be70aa9c
BLAKE2b-256 checksum
How to use checksums
f2ad11148b05ba486a818c20efd409e951426a93d55926cbb0ee71e516305dae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL libdogecoin-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
5a8b8c848c0fa25a77439f39a4553be80a3ff9ae7d0a324995345cd13232e68f
BLAKE2b-256 checksum
How to use checksums
7a17a94628f8de3a337524478d8956d4a249d659319a8d140efe91e67de98458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL libdogecoin-0.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
1b88b817bdde1048e501e5510eb4adf29cb4ea8964521b1993f051c7e2a323e0
BLAKE2b-256 checksum
How to use checksums
7d220beed29493f0733dbc99f82d21067e6dc46da299461576a5200f50ec58a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / libdogecoin-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl

Download URL libdogecoin-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5265ccca295f01219a1d980796bc00e67ef6030b6f967ffd89ab88eff0ed5b4c
BLAKE2b-256 checksum
How to use checksums
6ace9d3ef93295520b6dafba95ea6834274d5526a0b5f7097e3fed5d59939350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

0.1.4

9 release files

0.1.3

9 release files

0.1.2

8 release files

This release

0.1.1 This release

8 release files

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page