Skip to main content

A simple library to store/retrieve information in bitcoin transactions using OP_RETURN.

Project description

A library to read/write data to bitcoin transactions as nulldata outputs.

Installation

pip install btctxstore

CLI usage

Write data to bitcoin transaction as nulldata new output. Prints new raw transaction with added output.

python -m btctxstore write_bin <unsigned rawtx hex> <data hex>

Read data from bitcoin transaction with nulldata output. Prints hex data from output.

python -m btctxstore read_bin <rawtx hex>

python usage

Write data to bitcoin transaction as nulldata new output. Prints new raw transaction with added output.

from btctxstore import BtcTxStore
api = BtcTxStore()

# using hex data
outputrawtx = api.write_bin(unsignedrawtx, hexdata)

# using pycoin tx and binary data
api.write(pycointx, bindata)

Read data from bitcoin transaction with nulldata output. Prints hex data from output.

from btctxstore import BtcTxStore
api = BtcTxStore()

# using hex data
hexdata = api.read_bin(rawtx)

# using pycoin tx and binary data
bindata = api.read(pycointx)

json-rpc usage

Starting the rpc server.

python -m btctxstore startserver --hostname=<hostname> --port=<port>

Write data to bitcoin transaction as nulldata new output. Prints new raw transaction with added output.

import pyjsonrpc
rpc = pyjsonrpc.HttpClient(url = "http://localhost:8080")

# using hex data
outputrawtx = rpc.write_bin(unsignedrawtx, hexdata)

Read data from bitcoin transaction with nulldata output. Prints hex data from output.

import pyjsonrpc
rpc = pyjsonrpc.HttpClient(url = "http://localhost:8080")

# using hex data
hexdata = rpc.read_bin(rawtx)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btctxstore-0.1.0.tar.gz (2.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page