Developer quickstart
Read a smart account and submit a governed request from TypeScript with @bloxchain/sdk.
Where: your own project · You need: Node.js 18+, a Sepolia RPC endpoint, a funded key that holds a role on an existing smart account
Deploy the account first from the Platform quickstart, or with your own script as described in Deployment. The SDK talks to the same contract; the rules you configured there apply unchanged here.
1. Install
Install @bloxchain/sdk, @bloxchain/contracts and viem as shown in SDK setup and authentication. viem is a peer dependency. Pin the two Bloxchain packages to the same Protocol release as the contracts you talk to. See Releases.
2. Environment
Never hardcode a private key. Put these in .env (and in .gitignore):
RPC_URL=https://sepolia.example-rpc.org # your Sepolia RPC endpoint
PRIVATE_KEY=0x... # a key that holds a role on the account
ACCOUNT_ADDRESS=0x... # the smart account (from Account details)3. Create clients
Build a viem publicClient and walletClient from RPC_URL and PRIVATE_KEY exactly as shown in SDK setup and authentication. The public client reads; the wallet client signs and sends. For a read-only integration you can omit the wallet client and pass undefined to the SDK constructors.
The snippets below call the signing account signer and expect publicClient and walletClient in scope.
4. Read the account
A smart account combines three components behind one address. Each has an SDK wrapper, and all three point at the same ACCOUNT_ADDRESS.
getTimeLockPeriodSec() returns the wait in seconds as a bigint. getWalletRoles() is the SDK equivalent of the My access page.
5. Submit a governed request
Requests go through the same lifecycle the Platform shows: request, wait, approve, execute, record. On the delayed path that is two calls, separated by the time lock.
The contract enforces every rule on both calls: the requester's role must be permitted at the Request step, the target must be allowlisted, the time lock must have elapsed, and the approver's role must be permitted at the Approval step. If any check fails the transaction reverts, exactly as it would from the Platform.
The signed paths (Signed approval and One signature) use EIP-712 meta-transactions that a broadcaster submits; they follow the same pattern with requestAndApproveExecution. See Meta-transactions.
Where to look next
Client configuration, keys and environment patterns
Request, approve, cancel and meta-transaction patterns, with worked examples
Exact constructor and method signatures
Full setup, including definition library addresses
Registering actions, allowlists and gates from code
Choosing between the Platform, the SDK and the Protocol
A checklist before real value moves
Giving an AI agent the context to draft a request you approve
Last updated
Was this helpful?