python-elementstx


Namepython-elementstx JSON
Version 0.1.5.post0 PyPI version JSON
download
home_pagehttps://github.com/Simplexum/python-elementstx
SummaryElements module for python-bitcointx
upload_time2024-04-09 13:19:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords bitcoin elements
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This Python3 module implements support for Elements transactions.

It builds on top, and is intended to be used along with python-bitcointx library.

## Requirements

- [python-bitcointx](https://github.com/Simplexum/python-bitcointx) (version >= 1.0.0)
- [secp256k1-zkp](https://github.com/ElementsProject/secp256k1-zkp)

  Configure parameters for `secp256k1-zkp`:

```
    ./configure --enable-experimental \
                --enable-module-generator \
                --enable-module-rangeproof \
                --enable-module-surjectionproof \
                --enable-module-ecdh \
                --enable-module-recovery
```

## Usage:

With contextual switch to Elements parameters:

```python
import os
import elementstx
from bitcointx import ChainParams, get_current_chain_params
from bitcointx.wallet import CCoinKey, CCoinExtKey, CCoinAddress, P2PKHCoinAddress

with ChainParams('elements'):
    k = CCoinExtKey.from_seed(os.urandom(32))
    a = P2PKHCoinAddress.from_pubkey(k.derive_path("m/0'/0'/1").pub)
    print('example {} address: {}'.format(get_current_chain_params().name, a))
    assert CCoinAddress(str(a)) == a
```

With global switch to Elements parameters:

```python
from elementstx import ElementsParams
from bitcointx import select_chain_params

select_chain_params('elements')
# or, using the chain params class directly
select_chain_params(ElementsParams)

# To switch to Liquid Network parameters:
select_chain_params('elements/liquidv1')

```

Without the switch of chain parameters:

```python
from elementstx.core import CElementsTransaction

transaction_data = read_tx_data()
tx = CElementsTransaction.deserialze(transaction_data)
print("Number of txout witnesses:", len(tx.wit.vtxoutwit))

```

# Example Code

See `examples/` directory.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Simplexum/python-elementstx",
    "name": "python-elementstx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "bitcoin, elements",
    "author": null,
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "This Python3 module implements support for Elements transactions.\n\nIt builds on top, and is intended to be used along with python-bitcointx library.\n\n## Requirements\n\n- [python-bitcointx](https://github.com/Simplexum/python-bitcointx) (version >= 1.0.0)\n- [secp256k1-zkp](https://github.com/ElementsProject/secp256k1-zkp)\n\n  Configure parameters for `secp256k1-zkp`:\n\n```\n    ./configure --enable-experimental \\\n                --enable-module-generator \\\n                --enable-module-rangeproof \\\n                --enable-module-surjectionproof \\\n                --enable-module-ecdh \\\n                --enable-module-recovery\n```\n\n## Usage:\n\nWith contextual switch to Elements parameters:\n\n```python\nimport os\nimport elementstx\nfrom bitcointx import ChainParams, get_current_chain_params\nfrom bitcointx.wallet import CCoinKey, CCoinExtKey, CCoinAddress, P2PKHCoinAddress\n\nwith ChainParams('elements'):\n    k = CCoinExtKey.from_seed(os.urandom(32))\n    a = P2PKHCoinAddress.from_pubkey(k.derive_path(\"m/0'/0'/1\").pub)\n    print('example {} address: {}'.format(get_current_chain_params().name, a))\n    assert CCoinAddress(str(a)) == a\n```\n\nWith global switch to Elements parameters:\n\n```python\nfrom elementstx import ElementsParams\nfrom bitcointx import select_chain_params\n\nselect_chain_params('elements')\n# or, using the chain params class directly\nselect_chain_params(ElementsParams)\n\n# To switch to Liquid Network parameters:\nselect_chain_params('elements/liquidv1')\n\n```\n\nWithout the switch of chain parameters:\n\n```python\nfrom elementstx.core import CElementsTransaction\n\ntransaction_data = read_tx_data()\ntx = CElementsTransaction.deserialze(transaction_data)\nprint(\"Number of txout witnesses:\", len(tx.wit.vtxoutwit))\n\n```\n\n# Example Code\n\nSee `examples/` directory.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Elements module for python-bitcointx",
    "version": "0.1.5.post0",
    "project_urls": {
        "Homepage": "https://github.com/Simplexum/python-elementstx"
    },
    "split_keywords": [
        "bitcoin",
        " elements"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1f3987fe103956eea68fc02b4da8d86a301c7ae80bc88223ef10a30bab65574",
                "md5": "5494b714fe148422ce20a913b681ee33",
                "sha256": "7f6018ad1ee19e1234215641b10a1a2278f67c60fbe15e80ed86038e0cc75799"
            },
            "downloads": -1,
            "filename": "python_elementstx-0.1.5.post0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5494b714fe148422ce20a913b681ee33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 50569,
            "upload_time": "2024-04-09T13:19:31",
            "upload_time_iso_8601": "2024-04-09T13:19:31.155955Z",
            "url": "https://files.pythonhosted.org/packages/b1/f3/987fe103956eea68fc02b4da8d86a301c7ae80bc88223ef10a30bab65574/python_elementstx-0.1.5.post0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 13:19:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Simplexum",
    "github_project": "python-elementstx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-elementstx"
}
        
Elapsed time: 0.22713s