# 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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,conflux,blockchain",
"author": "Conflux-Dev",
"author_email": "wenda.zhang@confluxnetwork.org",
"download_url": "https://files.pythonhosted.org/packages/b3/33/c7d44ebcca3a00e2d7b7b6a76c2ce382b2221a00cf04e8659739f7e3e546/conflux-web3-1.2.2.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": "",
"summary": "Python SDK for Conflux network",
"version": "1.2.2",
"project_urls": {
"Homepage": "https://github.com/conflux-chain/python-conflux-sdk"
},
"split_keywords": [
"python",
"conflux",
"blockchain"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a15272ba5b2dcb5e5670a505821141c6cc9047ec8d7ad90afbbd299e180e8b15",
"md5": "8e03165df452957db40db6d2424005b1",
"sha256": "a255ef4d9c6ae811c4ec4aa6263e663a4992e9bffd3bfa02e0c05371d759c907"
},
"downloads": -1,
"filename": "conflux_web3-1.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e03165df452957db40db6d2424005b1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 74210,
"upload_time": "2024-01-15T08:37:41",
"upload_time_iso_8601": "2024-01-15T08:37:41.858097Z",
"url": "https://files.pythonhosted.org/packages/a1/52/72ba5b2dcb5e5670a505821141c6cc9047ec8d7ad90afbbd299e180e8b15/conflux_web3-1.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b333c7d44ebcca3a00e2d7b7b6a76c2ce382b2221a00cf04e8659739f7e3e546",
"md5": "66aaaaf38635057ae8d02361e8c6657e",
"sha256": "3397cad9b48edfff95ec81e76c231c27450eea9d4b088b80f02df409f58cd82a"
},
"downloads": -1,
"filename": "conflux-web3-1.2.2.tar.gz",
"has_sig": false,
"md5_digest": "66aaaaf38635057ae8d02361e8c6657e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 59820,
"upload_time": "2024-01-15T08:37:43",
"upload_time_iso_8601": "2024-01-15T08:37:43.551149Z",
"url": "https://files.pythonhosted.org/packages/b3/33/c7d44ebcca3a00e2d7b7b6a76c2ce382b2221a00cf04e8659739f7e3e546/conflux-web3-1.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-15 08:37:43",
"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"
}