# Introduction
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/conflux-chain/python-conflux-sdk/dev?urlpath=tree/docs/en/examples/01-quickstart.ipynb)
[![Documentation Status](https://readthedocs.org/projects/python-conflux-sdk/badge/?version=latest)](https://python-conflux-sdk.readthedocs.io/en/latest/?badge=latest)
[![gitlocalized ](https://gitlocalize.com/repo/8175/whole_project/badge.svg)](https://gitlocalize.com/repo/8175/whole_project?utm_source=badge)
[![codecov](https://codecov.io/github/Conflux-Chain/python-conflux-sdk/branch/dev/graph/badge.svg?token=GZ62V9QW0A)](https://codecov.io/github/Conflux-Chain/python-conflux-sdk)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/conflux-web3)
[README](https://python-conflux-sdk.readthedocs.io/en/latest/README.html) | [δΈζζζ‘£](https://python-conflux-sdk.readthedocs.io/zh_CN/latest/README.html)
- [Introduction](#introduction)
- [Overview](#overview)
- [Quickstart](#quickstart)
- [Documentations](#documentations)
- [Run Code Examples Online!](#run-code-examples-online)
- [Localization](#localization)
## Overview
Python-conflux-sdk helps to interact with Conflux network using python. It is built over [web3.py](https://github.com/ethereum/web3.py) and most of its APIs are consistent with [web3.py](https://github.com/ethereum/web3.py).
## Quickstart
Requirements: python version >= 3.7
```bash
$ pip3 install conflux-web3
```
```python
from conflux_web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://test.confluxrpc.com"))
acct = w3.account.from_key("0xxxxxxxxxxxxxx")
w3.cfx.default_account = acct
w3.cfx.contract(name="Faucet").claimCfx().transact().executed()
w3.cfx.send_transaction({
'to': w3.address.zero_address(),
'value': 10**18,
}).executed()
```
Or you can also use API as you do in `web3.py`:
``` python
# modified from https://web3py.readthedocs.io/en/stable/middleware.html#signing
from conflux_web3 import Web3
w3 = Web3("https://test.confluxrpc.com")
from conflux_web3.middleware import construct_sign_and_send_raw_middleware
from cfx_account import Account
acct = Account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')
w3.middleware_onion.add(construct_sign_and_send_raw_middleware(acct))
w3.cfx.default_account = acct.address
transaction = {
'to': w3.address.zero_address(),
'value': 22,
}
w3.cfx.send_transaction(transaction)
```
## Documentations
More detailed code examples are provided in the [documentation](https://python-conflux-sdk.readthedocs.io/en/latest/README.html).
### Run Code Examples Online!
All code examples can be run online in [mybinder](https://mybinder.org/). You can click `π` -> `Binder` on the top bar to activate the running environment. All dependencies wil be installed and the example can be run immediately.
### Localization
Currently this documentation supports:
* English version
* Chinese version
And welcome to provide translation in [GitLocalize](https://gitlocalize.com/repo/8175).
Raw data
{
"_id": null,
"home_page": "https://github.com/conflux-chain/python-conflux-sdk",
"name": "conflux-web3",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, conflux, blockchain",
"author": "Conflux-Dev",
"author_email": "wenda.zhang@confluxnetwork.org",
"download_url": "https://files.pythonhosted.org/packages/df/e8/eec82983d02e5b772ea9bc4a5bc8bcad92791fb1c76dcd8ac43a1555380e/conflux-web3-1.3.0.tar.gz",
"platform": null,
"description": "# Introduction\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/conflux-chain/python-conflux-sdk/dev?urlpath=tree/docs/en/examples/01-quickstart.ipynb)\n[![Documentation Status](https://readthedocs.org/projects/python-conflux-sdk/badge/?version=latest)](https://python-conflux-sdk.readthedocs.io/en/latest/?badge=latest)\n[![gitlocalized ](https://gitlocalize.com/repo/8175/whole_project/badge.svg)](https://gitlocalize.com/repo/8175/whole_project?utm_source=badge)\n[![codecov](https://codecov.io/github/Conflux-Chain/python-conflux-sdk/branch/dev/graph/badge.svg?token=GZ62V9QW0A)](https://codecov.io/github/Conflux-Chain/python-conflux-sdk)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/conflux-web3)\n\n[README](https://python-conflux-sdk.readthedocs.io/en/latest/README.html) | [\u4e2d\u6587\u6587\u6863](https://python-conflux-sdk.readthedocs.io/zh_CN/latest/README.html)\n\n- [Introduction](#introduction)\n - [Overview](#overview)\n - [Quickstart](#quickstart)\n - [Documentations](#documentations)\n - [Run Code Examples Online!](#run-code-examples-online)\n - [Localization](#localization)\n\n\n## Overview\n\nPython-conflux-sdk helps to interact with Conflux network using python. It is built over [web3.py](https://github.com/ethereum/web3.py) and most of its APIs are consistent with [web3.py](https://github.com/ethereum/web3.py).\n\n## Quickstart\n\nRequirements: python version >= 3.7\n\n```bash\n$ pip3 install conflux-web3\n```\n\n```python\nfrom conflux_web3 import Web3\n\nw3 = Web3(Web3.HTTPProvider(\"https://test.confluxrpc.com\"))\n\nacct = w3.account.from_key(\"0xxxxxxxxxxxxxx\")\nw3.cfx.default_account = acct\nw3.cfx.contract(name=\"Faucet\").claimCfx().transact().executed()\n\nw3.cfx.send_transaction({\n 'to': w3.address.zero_address(),\n 'value': 10**18,\n}).executed()\n```\n\nOr you can also use API as you do in `web3.py`: \n\n``` python\n# modified from https://web3py.readthedocs.io/en/stable/middleware.html#signing\nfrom conflux_web3 import Web3\nw3 = Web3(\"https://test.confluxrpc.com\")\nfrom conflux_web3.middleware import construct_sign_and_send_raw_middleware\nfrom cfx_account import Account\nacct = Account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')\nw3.middleware_onion.add(construct_sign_and_send_raw_middleware(acct))\nw3.cfx.default_account = acct.address\n\ntransaction = {\n 'to': w3.address.zero_address(),\n 'value': 22,\n}\nw3.cfx.send_transaction(transaction)\n```\n\n## Documentations\n\nMore detailed code examples are provided in the [documentation](https://python-conflux-sdk.readthedocs.io/en/latest/README.html).\n\n### Run Code Examples Online!\n\nAll code examples can be run online in [mybinder](https://mybinder.org/). You can click `\ud83d\ude80` -> `Binder` on the top bar to activate the running environment. All dependencies wil be installed and the example can be run immediately.\n\n### Localization\n\nCurrently this documentation supports:\n\n* English version\n* Chinese version\n\nAnd welcome to provide translation in [GitLocalize](https://gitlocalize.com/repo/8175).\n",
"bugtrack_url": null,
"license": null,
"summary": "Python SDK for Conflux network",
"version": "1.3.0",
"project_urls": {
"Homepage": "https://github.com/conflux-chain/python-conflux-sdk"
},
"split_keywords": [
"python",
" conflux",
" blockchain"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8bad18813768038d0b0f0c2f83f26927a977be10ffe743369e91e5bad3fc8858",
"md5": "a3d837e06cebc1a8bb95c28e6436ee18",
"sha256": "f24c284ee8d6adf511c25cfa1366a17a4ea744b5bf1f1ab353a407a549364776"
},
"downloads": -1,
"filename": "conflux_web3-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3d837e06cebc1a8bb95c28e6436ee18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 76605,
"upload_time": "2024-10-30T08:57:12",
"upload_time_iso_8601": "2024-10-30T08:57:12.443528Z",
"url": "https://files.pythonhosted.org/packages/8b/ad/18813768038d0b0f0c2f83f26927a977be10ffe743369e91e5bad3fc8858/conflux_web3-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dfe8eec82983d02e5b772ea9bc4a5bc8bcad92791fb1c76dcd8ac43a1555380e",
"md5": "299dd36dd65561611e728c4111a9f86d",
"sha256": "d0436175eb2e1fb3d8cb124f34d05faa89981cec8cc56efadd49d0e3faab9900"
},
"downloads": -1,
"filename": "conflux-web3-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "299dd36dd65561611e728c4111a9f86d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 61567,
"upload_time": "2024-10-30T08:57:14",
"upload_time_iso_8601": "2024-10-30T08:57:14.373414Z",
"url": "https://files.pythonhosted.org/packages/df/e8/eec82983d02e5b772ea9bc4a5bc8bcad92791fb1c76dcd8ac43a1555380e/conflux-web3-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 08:57:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "conflux-chain",
"github_project": "python-conflux-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "conflux-web3"
}