file-lockContract

Instantiating contracts and interacting through shielded and transparent namespaces


Instantiation

contract = w3.seismic.contract(address="0x...", abi=ABI)

The ABI works the same as in web3.py. If your contract uses shielded types (suint256, sbool, saddress), the SDK remaps them to their standard counterparts for parameter encoding while keeping the original shielded names for function selector computation.


Namespaces

ShieldedContract gives you five namespaces:

Namespace
What it does
On-chain visibility

.write

Encrypted transaction (TxSeismic type 0x4a)

Calldata encrypted

.read

Encrypted signed eth_call

Calldata + result encrypted

.twrite

Standard eth_sendTransaction

Calldata plaintext

.tread

Standard eth_call

Calldata plaintext

.dwrite

Debug write — like .write but returns plaintext + encrypted views

Calldata encrypted

# Shielded write — encrypted calldata, returns tx hash
tx_hash = contract.write.setNumber(42)

# Shielded read — encrypted signed call, auto-decoded
number = contract.read.getNumber()       # int
is_odd = contract.read.isOdd()           # bool

# Transparent write — standard send_transaction
tx_hash = contract.twrite.setNumber(42)

# Transparent read — standard eth_call, auto-decoded
number = contract.tread.getNumber()      # int

# Debug write — returns plaintext + encrypted views + tx hash
debug = contract.dwrite.setNumber(42)
debug.plaintext_tx.data  # unencrypted calldata
debug.shielded_tx.data   # encrypted calldata
debug.tx_hash            # transaction hash

Write namespaces accept optional keyword arguments for transaction parameters:


Example Contract

All code snippets in the Python SDK docs reference the interface below.

Token examples use the real SRC20arrow-up-right / ERC20 specs (balanceOf, transfer, approve, allowance, totalSupply, etc.).


Encoding calldata manually

If you need to encode calldata outside of a contract call — for example, to pass it to the low-level API — you can use encode_shielded_calldataarrow-up-right. This computes the function selector using the original shielded type names (like suint256) but encodes the parameters using standard types (like uint256):

Last updated