⚠️ EXPERIMENTAL SOFTWARE WARNING
This repository contains experimental smart contract code. While the framework is feature-complete and tested, it is not yet audited for production use. Use at your own risk and do not deploy with real assets without proper security review.
After foundation and CopyBlox are deployed on a network (e.g. Sepolia), you can create your own secure wallet (AccountBlox clone) in a few steps:
npm run create-walletThe script is interactive: choose the network, basic wallet (AccountBlox) or a custom blox, then set owner / broadcaster / recovery and time-lock. It uses your .env.deployment deployer key and writes the new clone address (and Sepolia explorer link) when done.
Non-interactive (all defaults): CREATE_WALLET_USE_DEFAULTS=1 node scripts/deployment/create-wallet-copyblox.js
Enterprise-grade security through multi-phase workflows: time-locked operations and meta-transactions with role separation, so contracts control storage and operations require at least two signatures. EngineBlox powers time-locks, gasless execution, and dynamic RBAC via modular composition.
SandBlox – contract operations
graph TB
A[EngineBlox Library] --> B[BaseStateMachine]
B --> C[SecureOwnable]
B --> D[RuntimeRBAC]
B --> E[GuardController]
C --> I[AccountBlox]
D --> I
E --> I
L[TypeScript SDK] --> M[SecureOwnable Client]
L --> N[RuntimeRBAC Client]
L --> O[Definitions Client]
C --> P1[SimpleVault]
C --> P2[SimpleRWA20]
C --> P3[PayBlox]
C --> P4[GuardianSafe]
B --> P5[CopyBlox]
C --> P6[BasicERC20]
style A fill:#e1f5ff
style B fill:#b3e5fc
style C fill:#81d4fa
style D fill:#81d4fa
style E fill:#81d4fa
style L fill:#fff9c4
style P1 fill:#c8e6c9
style P2 fill:#c8e6c9
style P3 fill:#c8e6c9
style P4 fill:#c8e6c9
style P5 fill:#c8e6c9
style P6 fill:#c8e6c9
- BaseStateMachine → SecureOwnable, RuntimeRBAC, GuardController (and optional HookManager)
- Template: AccountBlox (see
contracts/examples/templates/) - Examples: SimpleVault, SimpleRWA20, PayBlox, CopyBlox (clone factory), GuardianSafe, BasicERC20
- Time-delay: Request → wait → Approve (2 signatures). Meta-tx: Sign → Execute (role separation).
- Roles: Owner (admin, approve), Broadcaster (execute meta-tx, gas), Recovery (emergency).
Prerequisites: Node.js v18+
git clone https://github.com/PracticalParticle/Bloxchain-Protocol.git
cd Bloxchain-Protocol
npm install
npm run compile:foundry
npm run test:foundrySDK / contracts: npm install @bloxchain/sdk @bloxchain/contracts
Networks: Local (Hardhat), Sepolia, SandBlox
- Copy
env.deployment.exampleto.env.deploymentand setDEPLOY_RPC_URL,DEPLOY_PRIVATE_KEY; optionallyDEPLOY_CHAIN_ID(Sepolia:11155111) andDEPLOY_NETWORK_NAME. - Foundation (libraries + AccountBlox):
npm run deploy:hardhat:foundation
Or:npx hardhat run scripts/deployment/deploy-foundation-libraries.js --network sepolia - Example (CopyBlox):
npx hardhat run scripts/deployment/deploy-example-copyblox.js --network sepolia
Addresses are written to deployed-addresses.json.
Ethereum Sepolia (testnet)
| Contract | Address |
|---|---|
| EngineBlox | 0xd0db4bcfac215e86371c55ba9d91030082fe7adb |
| SecureOwnableDefinitions | 0xd21e88564377cbbed7885416cf0462b1a7e424aa |
| RuntimeRBACDefinitions | 0x03156b0dcbd104c397aa3463705964b933ed4d3f |
| GuardControllerDefinitions | 0x4b828c8575fcb375158d0926fd2ca01e5f41ca1f |
| Contract | Address |
|---|---|
| AccountBlox | 0x5886d5760551fae5f826ebb71d5b8a125da57a15 |
| Contract | Address |
|---|---|
| CopyBlox | 0xc380cb5a483f32614365619ef9bbcf360f62836e |
import { SecureOwnable } from '@bloxchain/sdk';
const secureOwnable = new SecureOwnable(publicClient, walletClient, contractAddress, chain);
// Time-locked ownership transfer
await secureOwnable.transferOwnershipRequest({ from: ownerAddress });
await secureOwnable.transferOwnershipDelayedApproval(txId, { from: ownerAddress });Meta-transactions (gasless) and Runtime RBAC examples: see @bloxchain/sdk and the repo sdk/ and test/ directories.
- Runtime RBAC: Dynamic roles via
roleConfigBatch; function-level permissions (action bitmaps), protected system roles. UseRuntimeRBACfrom@bloxchain/sdkfor role creation and queries. - GuardController: Controlled external calls: per-function target whitelist, time-lock/meta-tx workflows. Register schemas, whitelist targets, then execute via EngineBlox workflows. See
AccountBloxand example contracts.
IDefinition supplies function schemas and role permissions as pure functions; definitions live in separate libraries to keep contract size down. See contracts/.../lib/definitions/ and SDK for discovery.
37 suites, 309 tests (state machine, meta-tx, RBAC, GuardController, payments, hooks, definitions, gas limits, composite attacks). See test/foundry/docs for the Attack Vectors Codex.
npm run test:foundry:fuzz
# Or: forge test --match-path "test/foundry/fuzz/ComprehensiveStateMachineFuzz.t.sol" --fuzz-runs 10000SandBlox – Live contract interaction, multi-sig and meta-tx workflows, Sepolia support.
npm run compile:foundry # compile; add :size for 24KB check
npm run test:foundry # tests
npm run test:foundry:fuzz # fuzz
npm run test:sanity:secure-ownable # sanity (optional)
npm run docgen && npm run format # docs & format- Protocol Architecture · State Machine · Getting Started · API Reference · SecureOwnable · RuntimeRBAC · Best Practices · Examples
- Time-delay: Request → (wait) → Approve → Execute. Meta-tx: Sign → Execute (signer ≠ executor).
- EIP-712 structured data, per-signer nonces, time-lock enforcement. Function-level permissions: Request/Approve/Cancel, Sign/Execute, plus dynamic RBAC.
Developers: No single-point failure; gasless meta-tx; runtime RBAC; type-safe SDK. Enterprises: Time-locks, audit trails, under-24KB contracts. Users: Recovery options, transparency.
Stack: Solidity 0.8.34, OpenZeppelin ^5.4.0 (upgradeable). Libraries: EngineBlox → BaseStateMachine → SecureOwnable, RuntimeRBAC, GuardController, HookManager. Contract size under 24KB; EIP-712; Viem-based TypeScript SDK. Testing: Foundry (fuzz + invariant), Hardhat, sanity scripts. All core components, template (AccountBlox), example apps, and Sepolia deployment are implemented and covered by tests.
Planned: Formal verification; third-party security audit.
See Contributing Guidelines (setup, code standards, testing, security, PR process). Key requirements: Code of Conduct, 100% test coverage, contracts under 24KB, npm run format. Deploy: npm run deploy:hardhat (local) or npm run deploy:hardhat -- --network sepolia.
MPL-2.0 – see LICENSE. Covers core contracts (contracts/core/), SDK (sdk/typescript/), docs, tests, tooling. Excluded: contracts/examples/ and applications/ have their own licenses (see per-directory LICENSE files). Contributions under MPL-2.0; see CONTRIBUTING.md.
Particle CS, OpenZeppelin, Viem, Hardhat, Foundry.
Docs: sdk/typescript/docs/. Examples: contracts/examples/. Testing: SandBlox. Issues · Discussions.
Created by Particle Crypto Security · Copyright © 2025 Particle Crypto Security.