A Solidity smart contract for managing AI model versioning with granular access control, designed for EVM-compatible blockchains (Scroll, Ethereum, Polygon, BSC, etc).
- β AI model versioning with timestamp tracking
- π Granular access control per ID (owner + authorized wallets)
- π Advanced query methods:
- Version pagination
- Index-based version retrieval
- Latest version per ID
- User-specific model IDs
- π‘οΈ Security modifiers for all operations
- π‘ EVM-compatible architecture
- π Change tracking through events
- EternacodeAI.sol
βββ Structures:
β βββ ModelVersion (dataHash, timestamp, author)
β
βββ Mappings:
β βββ idToVersions (ID => versions)
β βββ permissions (ID => wallet => bool)
β βββ idToLatestAuthor (ID => last editor)
β
βββ Functions:
β βββ addVersion() # Add new model version
β βββ getVersions() # Get all versions
β βββ getLatestVersion() # Latest model version
β βββ getUserLatestIds() # IDs edited by user
β
βββ Events:
βββ VersionAdded
βββ PermissionGranted
βββ PermissionRevoked
Method | Description | Example |
---|---|---|
getVersionsPaginated(id, N) |
Get last N model versions | getVersionsPaginated(1, 3) |
getVersion(id, index) |
Get specific version by index | getVersion(1, 0) |
getLatestVersion(id) |
Get latest model version | getLatestVersion(1) |
getUserLatestIds(wallet) |
Get IDs where wallet last edited | getUserLatestIds(0x123...) |
- π Owner-exclusive permission management
- β½ Gas optimization using numeric IDs
- π΅οΈ Third-party audits recommended for mainnet
- π§© Dedicated admin wallets advised
- π Regular dependency updates
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Follow coding standards
- Submit a Pull Request
- Web3.js/React demo interface
- Model training metadata support
MIT License - See LICENSE for details.