hiero-ledger / hiero-ledger/hiero-sdk-python

feat(tck): implement executeContract JSON-RPC method

Open
#2,602 9 comments 0 reactions 0 assignees View on GitHub
approved lang: python scope: TCK skill: intermediate
Dominant language
Python
Stars
63
Forks
298
Avg merge
3d 18h
Merged PRs (30d)
38

Description

**Problem**

The TCK server does not implement `executeContract`, so the TCK driver's `ContractExecuteTransaction` suite cannot run against the Python SDK. The SDK transaction already exists: `src/hiero_sdk_python/contract/contract_execute_transaction.py` (`ContractExecuteTransaction`), along with `ContractFunctionParameters` for call encoding.

**Blocked by #2594 (`createContract`)** — it creates the contract-service TCK modules, and this suite needs a deployed contract to call.

**Before you start — required reading**

TCK handlers are contract work: the TCK driver validates exact parameter names, optionality, defaults, and error semantics against the published spec. Please do not code from this issue title alone (or paste it into an AI tool and ship the first thing that runs) — read these first:

1. **The spec page linked below**, in full — especially the parameter table, the expected response shape, and the error/edge-case tests. If your handler's behavior differs from the spec table, the TCK suite will fail even if the happy path works.
2. [`tck/README.md`](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/tck/README.md) — how the JSON-RPC server, param dataclasses, handler registry, and responses fit together, and how to run the TCK driver locally against your handler. Run the actual TCK suite before opening a PR; unit tests alone are not enough.
3. **An existing handler as your pattern** — pick the closest one in `tck/handlers/` with its matching `tck/param/` dataclass and follow its structure, naming, and error handling exactly. Do not invent a new style, and do not re-implement SDK logic in the handler — handlers only wire validated params onto the existing SDK transaction/query.
4. **The SDK class you are wrapping** (path in the Problem section) — read its setters and defaults so you know what the SDK already handles for you.
5. [`CONTRIBUTING.md`](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/CONTRIBUTING.md) — test and PR conventions.

**Solution**

- [ ] Add an `ExecuteContractParams` dataclass to `tck/param/contract.py` per the spec table (`contractId`, gas, payable amount, function parameters — check exactly how the spec encodes them, likely a hex string of the ABI-encoded call, not a structured object).
- [ ] Add an `executeContract` handler registered via `@rpc_method("executeContract")`, wrapping `ContractExecuteTransaction`. Wire the encoded call data through `set_function_parameters()` — do not attempt your own ABI encoding beyond what the spec requires.
- [ ] Add unit tests under `tests/tck/`, then run the TCK driver's ContractExecuteTransaction suite locally.

**Acceptance criteria**

- [ ] `executeContract` registered and dispatchable
- [ ] Function calls with parameters and payable calls succeed per the spec
- [ ] Spec error cases behave as specified (insufficient gas, reverts, invalid `contractId`, invalid call data)
- [ ] Unit tests added and the TCK `ContractExecuteTransaction` suite passes

Spec: https://github.com/hiero-ledger/hiero-sdk-tck/blob/main/docs/test-specifications/contract-service/ContractExecuteTransaction.md
JS reference: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/tck/methods/contract.ts (`executeContract`)

Contributor guide

Open the contributing guide

Research direction

Start with the linked ContractExecuteTransaction spec and tck/README.md, then inspect an existing handler in tck/handlers/ with its matching tck/param/ dataclass. Read src/hiero_sdk_python/contract/contract_execute_transaction.py and the JS reference before adding tests under tests/tck/. Done means executeContract is dispatchable, the specified success and error cases work, and the TCK ContractExecuteTransaction suite passes after #2594 is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, blockchain, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.