Skip to main content

Plugin to monkey patch web3.py to support cfx2eth-bridge

Project description

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.

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

or

conda create -n venv python=3.7
conda activate venv

Then install in the virtual environment

pip install conflux-web3py-signer

How to use

Basic Usage

Import conflux_we3py_signer before import web3.

import conflux_web3py_signer
import web3

Use with Brownie

Firstly, you are supposed to install brownie and add conflux-bridge endpoint to brownie networks

pip install eth-brownie
cfx-brownie networks add Conflux cfx-testnet-bridge host=http://xxx.xxx.xxx chainid=1

Then use with command-line with target network.

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

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

conflux-web3py-signer-1.0.0b2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conflux_web3py_signer-1.0.0b2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file conflux-web3py-signer-1.0.0b2.tar.gz.

File metadata

  • Download URL: conflux-web3py-signer-1.0.0b2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for conflux-web3py-signer-1.0.0b2.tar.gz
Algorithm Hash digest
SHA256 579943a1ad6f6b29c29415fffc9651cf37077a5e3616e055bcd14b040f71fec7
MD5 426c7342dd46070fedafd45153460a9b
BLAKE2b-256 4c801abd3a2f1097a00d2db80ee06c1ef40d37846a33a36f673f69cae8c5869a

See more details on using hashes here.

File details

Details for the file conflux_web3py_signer-1.0.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for conflux_web3py_signer-1.0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e4690fc5ae6a56a4c71be9d9bb6ef7418816bbea28ad7f089eedb5b91272a4
MD5 9116394160ee499f47b64a816ee24c9c
BLAKE2b-256 b87ea7d8207c46d30a77eed9f278c3c4bbd8163795937d30967f6a4c4f8c7b37

See more details on using hashes here.

Supported by

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