conflux-web3py-signer


Nameconflux-web3py-signer JSON
Version 1.0.0b3 PyPI version JSON
download
home_pagehttps://github.com/conflux-fans/conflux-web3py-signer
SummaryPlugin to monkey patch web3.py to support cfx2eth-bridge
upload_time2022-12-20 01:30:09
maintainer
docs_urlNone
authorConflux-Dev
requires_python
license
keywords python conflux blockchain
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Introduction

This is a library used to use `web3.py` on conflux-bridge(?). This library hacks the signing machanism of `web3.py`.

## Install

This library requires python >= 3.7

It is recommended to use this library in a virtual environment.

``` bash
python -m venv venv
source ./venv/bin/activate
```

or 

``` bash
conda create -n venv python=3.7
conda activate venv
```

Then install in the virtual environment

``` bash
pip install conflux-web3py-signer
```

## How to use

### Basic Usage

Import `conflux_we3py_signer` before import `web3`.

```python
import conflux_web3py_signer
import web3
```

### Use with Brownie

Firstly, you are supposed to install brownie and add [conflux-bridge endpoints](https://docs.nftrainbow.xyz/products/rpc-bridge) to brownie networks

``` bash
pip install conflux_web3py_signer[brownie]
cfx-brownie networks add Conflux cfx-testnet-bridge host=https://cfx2ethtest.nftrainbow.cn chainid=1
```

Then use with command-line with target network.

``` bash
cfx-brownie --network cfx-testnet-bridge
```

## What is Done

### Transaction Cast

When the modified `construct_sign_and_send_raw_middleware` is going to sign a transaction, it will convert an EIP-1559 transaction to conflux transaction following the rule:

* If `gasPrice` is missing, use `maxFeePerGas` as gas price.
* Fill `epochHeight` with `w3.eth.block_number`, which correspondes to `epoch_number` in conflux.
* Estimate the transaction and fill `storageLimit` from estimate result.

### Address Cast

EOA account addresses are all converted to begin with `0x1` and is encoded in checksum format

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/conflux-fans/conflux-web3py-signer",
    "name": "conflux-web3py-signer",
    "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/19/be/903c226809c6863318432967e72b2b53f227d30456744b60a4a5d438565f/conflux-web3py-signer-1.0.0b3.tar.gz",
    "platform": null,
    "description": "# Introduction\n\nThis is a library used to use `web3.py` on conflux-bridge(?). This library hacks the signing machanism of `web3.py`.\n\n## Install\n\nThis library requires python >= 3.7\n\nIt is recommended to use this library in a virtual environment.\n\n``` bash\npython -m venv venv\nsource ./venv/bin/activate\n```\n\nor \n\n``` bash\nconda create -n venv python=3.7\nconda activate venv\n```\n\nThen install in the virtual environment\n\n``` bash\npip install conflux-web3py-signer\n```\n\n## How to use\n\n### Basic Usage\n\nImport `conflux_we3py_signer` before import `web3`.\n\n```python\nimport conflux_web3py_signer\nimport web3\n```\n\n### Use with Brownie\n\nFirstly, you are supposed to install brownie and add [conflux-bridge endpoints](https://docs.nftrainbow.xyz/products/rpc-bridge) to brownie networks\n\n``` bash\npip install conflux_web3py_signer[brownie]\ncfx-brownie networks add Conflux cfx-testnet-bridge host=https://cfx2ethtest.nftrainbow.cn chainid=1\n```\n\nThen use with command-line with target network.\n\n``` bash\ncfx-brownie --network cfx-testnet-bridge\n```\n\n## What is Done\n\n### Transaction Cast\n\nWhen the modified `construct_sign_and_send_raw_middleware` is going to sign a transaction, it will convert an EIP-1559 transaction to conflux transaction following the rule:\n\n* If `gasPrice` is missing, use `maxFeePerGas` as gas price.\n* Fill `epochHeight` with `w3.eth.block_number`, which correspondes to `epoch_number` in conflux.\n* Estimate the transaction and fill `storageLimit` from estimate result.\n\n### Address Cast\n\nEOA account addresses are all converted to begin with `0x1` and is encoded in checksum format\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Plugin to monkey patch web3.py to support cfx2eth-bridge",
    "version": "1.0.0b3",
    "split_keywords": [
        "python",
        "conflux",
        "blockchain"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d3e29423c4e3e4afafd899918084d735",
                "sha256": "8da0a3b96eade2e9425f9435ed4618f482f4e6b4fb14384212a7e0e0997a2270"
            },
            "downloads": -1,
            "filename": "conflux_web3py_signer-1.0.0b3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d3e29423c4e3e4afafd899918084d735",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7235,
            "upload_time": "2022-12-20T01:30:07",
            "upload_time_iso_8601": "2022-12-20T01:30:07.757874Z",
            "url": "https://files.pythonhosted.org/packages/d4/d9/70c47692a1fd10b0531155f3a30bbe9244a7317d64f90c0213d9c41607fe/conflux_web3py_signer-1.0.0b3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "b98b70ba28afc55e4bd8905eb4472052",
                "sha256": "b62587c46222e53d2ea394953214ebfb618d653fc27f1c011c762aab30e29dcb"
            },
            "downloads": -1,
            "filename": "conflux-web3py-signer-1.0.0b3.tar.gz",
            "has_sig": false,
            "md5_digest": "b98b70ba28afc55e4bd8905eb4472052",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5928,
            "upload_time": "2022-12-20T01:30:09",
            "upload_time_iso_8601": "2022-12-20T01:30:09.259305Z",
            "url": "https://files.pythonhosted.org/packages/19/be/903c226809c6863318432967e72b2b53f227d30456744b60a4a5d438565f/conflux-web3py-signer-1.0.0b3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-20 01:30:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "conflux-fans",
    "github_project": "conflux-web3py-signer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "conflux-web3py-signer"
}
        
Elapsed time: 0.23673s