For the complete documentation index, see llms.txt. This page is also available as Markdown.

SecureOwnable

The SecureOwnable class provides type-safe access to Bloxchain SecureOwnable contracts with built-in security features and multi-phase operations.

🎯 Overview

SecureOwnable is a secure ownership management contract that implements:

  • Time-locked operations for critical administrative functions

  • Multi-phase security with request/approval workflows

  • Meta-transaction support for gasless operations

  • Event forwarding for external monitoring

  • Recovery mechanisms for emergency situations

🚀 Quick Start

import { SecureOwnable } from '@bloxchain/sdk/typescript'
import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet } from 'viem/chains'

// Initialize clients
const publicClient = createPublicClient({
  chain: mainnet,
  transport: http()
})

const walletClient = createWalletClient({
  account: privateKeyToAccount('0x...'),
  chain: mainnet,
  transport: http()
})

// Create SecureOwnable instance
const secureOwnable = new SecureOwnable(
  publicClient,
  walletClient,
  '0x...', // contract address
  mainnet
)

📖 Core Features

1. Ownership Management

Get Current Owner

Request Ownership Transfer

Approve Ownership Transfer

2. Administrative Functions

Broadcaster Management

Recovery Management

Time Lock Management

3. State Queries

Check Initialization Status

Get Time Lock Period

Get Administrative Addresses

🔄 Workflow Patterns

Time-Delay Workflow (Ownership Transfer)

Meta-Transaction Workflow (Recovery Update)

Hybrid Workflow (Broadcaster Update)

📡 Event Monitoring

Contracts emit a unified ComponentEvent(bytes4 functionSelector, bytes data). Decode data according to the emitting function (use functionSelector to identify). See generated contract API and NatSpec for payload layouts.

Listen for ComponentEvent

🛡️ Security Features

1. Time-Locked Operations

Critical operations like ownership transfer require a time delay:

2. Multi-Phase Security

Operations are split into request and approval phases:

Important: The delayed path (transferOwnershipDelayedApproval) enforces releaseTime (timelock). The meta-tx path (transferOwnershipApprovalWithMetaTx) does not enforce timelock — the signed meta-transaction itself is the authorization, enabling time-flexible delegated approval. This applies to all meta-tx approval paths across the protocol. On every meta-tx path, params.handlerContract must equal the account you invoke and params.handlerSelector must equal that function’s selector, or verification fails as above (see also Meta-Transactions).

3. Meta-Transaction Support

Some operations support immediate execution:

4. Ownership transfer vs recovery (role model)

SecureOwnable splits power across owner, broadcaster, and recovery, and uses different timing per lane. These rules are intentional; misreading them causes false expectations during audits or operations.

Topic
Behavior

Who becomes owner

transferOwnershipRequest() stores the recovery address at request time in the pending transaction. Execution calls executeTransferOwnership with that snapshotted address.

Recovery rotated while pending

The pending payload is not updated. A new recovery address does not automatically become the beneficiary of an old pending transfer.

Who may approve (delayed path)

transferOwnershipDelayedApproval allows the current owner or current recovery. The approver may therefore differ from the snapshotted beneficiary—approval means “execute the stored transfer,” not “transfer to current recovery.”

Who may cancel

transferOwnershipCancellation is only callable by current recovery. If recovery is rotated, the previous recovery immediately loses cancel rights.

Broadcaster update vs pending ownership

Starting a broadcaster update requires no pending ownership transfer (and vice versa for the broadcaster lane). Internal pending flags apply only to these delayed lanes; recovery and timelock meta flows do not use them, and flags are cleared in the same transaction as successful approve or cancel.

Recovery update vs pending ownership

updateRecoveryRequestAndApprove does not check for a pending ownership transfer. Owner + broadcaster can still rotate recovery in one meta-tx step while a transfer is pending—fast operational recovery, but prior recovery loses veto via cancel.

Threat model: If owner and broadcaster are both compromised, they can rotate recovery and control cancellation/approval paths regardless of timelocks on ownership transfer. Treat that pair as a high-trust escalation path. If you need a hard on-chain rule such as “no recovery rotation while ownership transfer is pending,” enforce it with a contract extension or off-chain policy; the core SecureOwnable contract does not encode that invariant.

Timelock bounds: SecureOwnable validates timeLockPeriodSec > 0 but enforces no upper bound. An extremely large value (e.g. type(uint256).max) makes delayed operations practically unexecutable for the deployment's lifetime. Operators should validate the timelock range in deployment scripts or governance checks before calling updateTimeLockRequestAndApprove.

Role separation: The contract does not prevent the same EOA from holding OWNER, BROADCASTER, and RECOVERY roles simultaneously. Collapsing roles is a valid deployment choice (e.g. single multisig controls all), but it removes separation-of-duties guarantees that documentation and timelocks otherwise provide. Enforce distinct keys off-chain when separation is required.

🔧 Advanced Usage

Batch Operations

Error Handling

Gas Optimization

🧪 Testing

Unit Testing

Integration Testing

🚨 Common Issues

Issue: "Only owner can call this function"

Solution: Ensure you're calling from the contract owner's account.

Issue: "Time lock not expired"

Solution: Wait for the time lock period to pass before approving.

Issue: "Invalid address"

Solution: Ensure the address is a valid Ethereum address (42 characters, starts with 0x).

Issue: "Transaction reverted"

Solution: Check contract requirements and ensure sufficient gas.


Next: RuntimeRBAC Guide for role-based access control.

Last updated

Was this helpful?