bugdebug_send_shielded_transaction

Send a shielded transaction and return debug information for inspection

Send a shielded transaction with encrypted calldata and return debug information including both the plaintext and encrypted views of the transaction. This is useful for development, testing, and debugging encryption logic.


Overview

This method works exactly like send_shielded_transaction() — it broadcasts a real transaction to the network — but also returns detailed debug information:

  • Plaintext transaction: The transaction before encryption (readable calldata)

  • Encrypted transaction: The full TxSeismic with encrypted calldata

  • Transaction hash: The hash returned by the network

Use this during development to verify:

  • Calldata is encoded correctly

  • Encryption parameters are set as expected

  • Transaction structure matches your expectations


Signatures

Sync
Async

Parameters

All parameters are keyword-only and identical to send_shielded_transaction().

Parameter
Type
Default
Description

to

ChecksumAddress

Required

Recipient contract address

data

HexBytes

Required

Plaintext calldata (will be encrypted)

value

int

0

Wei to transfer with the transaction

gas

int | None

None

Gas limit (auto-estimated if None)

gas_price

int | None

None

Gas price in wei (uses network default if None)

security

None

Custom security parameters (block hash, nonce, expiry)

eip712

bool

False

Use EIP-712 typed data signing instead of raw signing


Returns

Type: DebugWriteResult

A dataclass containing three fields:

Field
Type
Description

tx_hash

HexBytes

Transaction hash from the network

plaintext_tx

PlaintextTx

Transaction parameters with unencrypted calldata

shielded_tx

UnsignedSeismicTx

Full TxSeismic with encrypted calldata

PlaintextTx Structure

UnsignedSeismicTx Structure


Examples

Sync Usage

Async Usage

Verifying Encryption

Inspecting Security Parameters

Comparing Gas Estimates

With Contract Method


Implementation Details

Transaction is Broadcast

Important: This method does broadcast a real transaction to the network. It is not a dry-run or simulation.

The debug information is returned after the transaction is sent. Use this only when you want to actually execute the transaction.

Encryption Process

The method performs the exact same encryption as send_shielded_transaction():

  1. Fetch security parameters (block hash, nonce, expiry)

  2. Encrypt calldata using AES-GCM with ECDH-derived key

  3. Construct TxSeismic transaction

  4. Sign and broadcast

The only difference is that it captures and returns the intermediate states.

Performance

Debug writes have the same performance as regular shielded writes. The only overhead is:

  • Constructing the PlaintextTx and UnsignedSeismicTx objects

  • Storing them in memory

This overhead is negligible for most use cases.


Use Cases

Development

Use during development to:

  • Verify ABI encoding is correct

  • Check encryption parameters match expectations

  • Debug transaction construction issues

  • Inspect nonces, gas prices, and other fields

Testing

Use in tests to:

  • Assert calldata is encoded correctly before encryption

  • Verify security parameters are set as expected

  • Check transaction structure without manual inspection

Debugging Production Issues

Use temporarily in production to:

  • Diagnose encryption-related issues

  • Verify transactions are constructed correctly

  • Compare plaintext vs encrypted data


Security Considerations

Plaintext Exposure

The PlaintextTx contains unencrypted calldata. Be careful when logging or displaying this information:

Production Use

In production:

  • Use send_shielded_transaction() or contract.write for better performance

  • Only use debug writes when actively debugging an issue

  • Remove debug logging before deploying


When to Use

Use debug_send_shielded_transaction() When

  • Developing new contract integrations

  • Writing tests for shielded transactions

  • Debugging encryption or encoding issues

  • Verifying transaction parameters

Use send_shielded_transaction() When

  • In production code

  • When you don't need debug information

  • For better code clarity (less verbose return type)

Use contract.dwrite When

  • Working with contract methods

  • Want automatic ABI encoding + debug info


Notes

Requires Wallet Client

This method is only available on wallet clients created with create_wallet_client(). It requires:

  • A private key for signing

  • Encryption state (derived from TEE public key)

Return Type

The return type is DebugWriteResult, not HexBytes. Access the transaction hash via result.tx_hash.

Contract Namespace

For contract interactions, prefer using contract.dwrite.functionName(...) instead of manually encoding calldata.


See Also

Last updated