Thank you for your interest in contributing to Bloxchain Protocol! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Contributing Process
- Code Standards
- Testing Requirements
- Documentation
- Security Considerations
- Pull Request Process
- Issue Reporting
- Community
This project follows our Code of Conduct. By participating, you agree to uphold this code. Please report unacceptable behavior to conduct@particlecs.com.
Before contributing, ensure you have:
- Node.js (v16 or higher)
- npm (v8 or higher)
- Truffle (v5.15 or higher)
- Git (latest version)
- Solidity knowledge (^0.8.25)
- TypeScript knowledge (for SDK contributions)
# Clone the repository
git clone https://github.com/PracticalParticle/Bloxchain-Protocol.git
cd Bloxchain-Protocol
# Install dependencies
npm install
# Install Truffle globally (if not already installed)
npm install -g truffle
# Start local blockchain (Ganache)
ganache --deterministic --networkId 1337
# Compile contracts
npm run compile:truffle
# Run tests
npm run test:truffleBloxchain-Protocol/
├── contracts/ # Smart contracts
│ ├── core/ # Core framework contracts
│ ├── examples/ # Example implementations
│ ├── interfaces/ # Interface definitions
│ ├── lib/ # Library contracts
│ └── utils/ # Utility contracts
├── docs/ # Generated documentation
├── sdk/ # TypeScript SDK
├── test/ # Test files
├── scripts/ # Deployment and utility scripts
└── migrations/ # Truffle migrations
- StateAbstraction Library: Core state machine engine
- BaseStateMachine: Foundation contract for all implementations
- SecureOwnable: Multi-role security implementation
- DynamicRBAC: Role-based access control system
- TypeScript SDK: Client library for contract interaction
# Fork the repository on GitHub
# Clone your fork
git clone https://github.com/YOUR_USERNAME/Bloxchain-Protocol.git
cd Bloxchain-Protocol
# Add upstream remote
git remote add upstream https://github.com/PracticalParticle/Bloxchain-Protocol.git# Create a feature branch
git checkout -b feature/your-feature-name
# Or for bug fixes
git checkout -b fix/issue-descriptionFollow our Code Standards and Testing Requirements.
# Run all tests
npm run test:truffle
npm run test:hardhat
# Run specific test suites
npm run test:sanity:secure-ownable
npm run test:sanity:simple-vault
# Check contract sizes
npm run compile:truffle:sizeSee Pull Request Process for detailed guidelines.
- Follow Checks-Effects-Interactions pattern
- Use OpenZeppelin's ReentrancyGuard for state-changing functions
- Implement proper input validation with custom errors
- Use SafeMath operations for arithmetic
- Follow visibility modifiers (private/internal for sensitive functions)
// Use custom errors instead of string messages
error InvalidAddress(address provided);
error InsufficientBalance(uint256 required, uint256 available);
// Use explicit visibility modifiers
contract ExampleContract {
address private _owner;
uint256 public totalSupply;
function internalFunction() internal {
// Implementation
}
}
// Use NatSpec documentation
/**
* @title Example Contract
* @dev Brief description of the contract
* @notice User-facing description
* @author Your Name
*/- Keep contracts under 24KB (Ethereum mainnet limit)
- Use libraries for reusable code
- Pack structs efficiently
- Use events instead of storage for historical data
// Use proper type definitions
export interface TransactionOptions {
from: Address;
gasLimit?: bigint;
gasPrice?: bigint;
}
// Implement comprehensive error handling
export class SecureOwnableError extends Error {
constructor(message: string, public code: string) {
super(message);
this.name = 'SecureOwnableError';
}
}
// Use JSDoc for documentation
/**
* Creates a new secure operation request
* @param operationType The type of operation to request
* @param options Transaction options
* @returns Promise resolving to transaction result
*/
async requestOperation(
operationType: string,
options: TransactionOptions
): Promise<TransactionResult> {
// Implementation
}- 100% test coverage required (immutable contracts require complete coverage)
- All new features must include comprehensive tests
- Edge cases must be tested
- Integration tests for complex workflows
// Test individual functions
contract('SecureOwnable', (accounts) => {
it('should create ownership transfer request', async () => {
const instance = await SecureOwnable.deployed();
const tx = await instance.transferOwnershipRequest({ from: accounts[0] });
assert.equal(tx.logs[0].event, 'OperationRequested');
});
});// Test complete workflows
contract('MetaTransaction Workflow', (accounts) => {
it('should execute meta-transaction workflow', async () => {
// Test complete meta-transaction flow
// 1. Create request
// 2. Sign meta-transaction
// 3. Execute meta-transaction
// 4. Verify state changes
});
});// Test with random inputs
contract('Transfer Fuzzing', (accounts) => {
it('should handle various transfer amounts', async () => {
for (let i = 0; i < 100; i++) {
const amount = Math.floor(Math.random() * 1000000);
// Test with random amount
}
});
});# Run all Truffle tests
npm run test:truffle
# Run Hardhat tests
npm run test:hardhat
# Run specific test files
truffle test test/SecureOwnable.test.js
# Run with coverage
npm run test:coverage- NatSpec comments for all public functions
- Security annotations for sensitive operations
- Usage examples in comments
- Parameter descriptions for all inputs/outputs
- JSDoc comments for all public methods
- Type definitions for all interfaces
- Usage examples in documentation
- Error handling documentation
- Update README.md for new features
- Add examples for new functionality
- Update installation instructions if needed
- Document breaking changes
- All smart contract changes require security review
- Critical functions need additional scrutiny
- External dependencies must be audited
- Gas optimization changes need verification
- Never commit private keys or sensitive data
- Use test networks for development
- Follow secure coding practices
- Report security issues privately (see Security Policy)
Report security issues to: security@particlecs.com
- Ensure all tests pass
- Update documentation as needed
- Follow code standards
- Check contract sizes
- Update CHANGELOG.md (if applicable)
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] All tests pass
- [ ] Contract size check passed
## Security
- [ ] Security review completed
- [ ] No sensitive data exposed
- [ ] Follows security best practices
## Documentation
- [ ] README updated
- [ ] Code comments added
- [ ] NatSpec documentation updated- Automated checks must pass
- Code review by maintainers
- Security review for smart contract changes
- Testing verification
- Documentation review
Use the bug report template and include:
- Description of the issue
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment details
- Screenshots (if applicable)
Use the feature request template and include:
- Problem description
- Proposed solution
- Alternatives considered
- Additional context
bug: Something isn't workingenhancement: New feature or requestdocumentation: Improvements to documentationgood first issue: Good for newcomershelp wanted: Extra attention neededsecurity: Security-related issues
The applications/ directory contains community and proprietary applications built on the Bloxchain Protocol framework. These applications are NOT part of the core framework and are NOT covered by the main repository's Mozilla Public License 2.0.
We recommend a fork-first development approach for applications to ensure quality and long-term maintainability:
- Fork the repository to your own GitHub account
- Develop your application in your fork
- Maintain long-term in your fork
- Iterate and improve based on real-world usage
- Real-world usage - Deploy and use in production
- Community feedback - Gather user feedback and bug reports
- Security audits - Complete professional audits
- Documentation - Comprehensive docs and examples
- Testing - Extensive test coverage and validation
- Only when truly ready - Production-ready applications only
- Submit PR to official repository
- Include audit reports and documentation
- Demonstrate real-world usage and success
- Long-term maintenance by application teams
- Independent development cycles and timelines
- Quality control - only mature, battle-tested applications
- Team autonomy and ownership of their applications
- Professional workflow suitable for enterprises
- Reduced risk of premature inclusion in official repo
applications/
├── community/ # Open source applications
│ ├── defi-vault/ # MIT License
│ ├── supply-chain/ # Apache 2.0 License
│ └── governance-dao/ # GPL v3 License
└── proprietary/ # Commercial/Enterprise applications
├── corporate-treasury/ # Proprietary License
├── enterprise-vault/ # Enterprise License
└── custom-solution/ # Custom License
Each application must include:
- LICENSE file - Clear license terms
- README.md - Application documentation
- Audit report - Security audit (if applicable)
- Documentation - Usage instructions and examples
- Tests - Comprehensive test suite
- Disclaimers - Clear statements about unofficial support
All applications must meet our audit requirements to be included in this directory.
To add an application to the official repository:
- Fork the repository and develop your application
- Complete Phase 1 & 2 (Fork Development & Maturity & Validation)
- Choose appropriate subfolder (
community/orproprietary/) - Create application directory with descriptive name
- Include LICENSE file with clear terms
- Provide comprehensive documentation
- Include audit report (if applicable)
- Follow audit requirements
- Submit pull request for review
For working with applications in your fork:
# Fork the repository first
git clone https://github.com/YOUR_USERNAME/Bloxchain-Protocol.git
cd Bloxchain-Protocol
# Create your application
mkdir applications/community/your-app
# or
mkdir applications/proprietary/your-app
# Develop your application
# ... your development work ...
# Compile with Truffle
npm run compile:truffle
# Run tests
npm run test:truffle
# Commit and push to your fork
git add .
git commit -m "feat: add your-application v1.0"
git push origin main- MIT License - Maximum flexibility, commercial use allowed
- Apache 2.0 License - Patent protection, commercial friendly
- Mozilla Public License 2.0 (MPL 2.0) - Weak copyleft, allows proprietary integration
- GPL v3 License - Copyleft, requires open source derivatives
- LGPL v3 License - Lesser copyleft, allows proprietary linking
- BSD 3-Clause License - Permissive, minimal restrictions
- BSD 2-Clause License - Simplified BSD, very permissive
- Eclipse Public License 2.0 (EPL 2.0) - Weak copyleft, commercial friendly
- Common Development and Distribution License (CDDL) - Weak copyleft, Sun Microsystems
- Proprietary License - Closed source, commercial use only
- Enterprise License - Custom terms for enterprise use
- Dual License - Open source + commercial options
- Custom License - Tailored terms for specific needs
IMPORTANT: Applications are:
- ❌ NOT officially supported by Bloxchain Protocol
- ❌ NOT part of the core framework
- ❌ NOT covered by Bloxchain Protocol's security audits
- ❌ NOT subject to MPL-2.0 license terms
- ✅ Used at your own risk
- ✅ Licensed separately from the core framework
- GitHub Discussions: For questions and ideas
- GitHub Issues: For bug reports and feature requests
- Documentation: Comprehensive guides in the repository
- Contact: https://particlecs.com/contact
- Be respectful and constructive
- Help others learn and grow
- Follow the code of conduct
- Ask questions when unsure
- Contributors will be recognized in release notes
- Significant contributions may be highlighted
- Security researchers will be acknowledged in advisories
# Start development session
git checkout main
git pull upstream main
git checkout -b feature/new-feature
# Make changes and test
npm run compile:truffle:size
npm run test:truffle
# Commit changes
git add .
git commit -m "feat: add new feature"
# Push and create PR
git push origin feature/new-feature- Feature freeze period
- Comprehensive testing
- Security review
- Documentation updates
- Version bump
- Release notes
- Deployment
By contributing to Bloxchain Protocol, you agree that your contributions will be licensed under the Mozilla Public License 2.0 (MPL-2.0).
Particle Crypto Security
- Website: https://particlecs.com
- Email: contact@particlecs.com
- GitHub: https://github.com/PracticalParticle/Bloxchain-Protocol
Thank you for contributing to Bloxchain Protocol! Your contributions help make blockchain security more accessible and robust.
Last Updated: October 2025