Open Consent Protocol implementation in Python with Ethereum smart contracts.
If you are looking for Usage and setup docs, go to
./docs/build/index.html
(open in browser) or follow steps in README_DOCS_BUILD.md to generate new Sphinx docs. Docs may also be found at https://docs.oconsent.io
oconsent/
├── oconsent/ # Main package directory
│ ├── __init__.py # Package initialization
│ ├── core/ # Core functionality
│ │ ├── __init__.py
│ │ ├── consent.py # Consent management
│ │ ├── proofs.py # Proof generation/verification
│ │ └── timestamp.py # Timestamp services
│ │
│ ├── blockchain/ # Blockchain interactions
│ │ ├── __init__.py
│ │ ├── ethereum.py # Ethereum client
│ │ ├── bitcoin.py # Bitcoin timestamping
│ │ └── sidechain.py # Sidechain operations
│ │
│ ├── crypto/ # Cryptographic operations
│ │ ├── __init__.py
│ │ ├── zk_proofs.py # Zero-knowledge proofs
│ │ └── signatures.py # Digital signatures
│ │
│ ├── storage/ # Storage providers
│ │ ├── __init__.py
│ │ └── providers.py # IPFS and other storage
│ │
│ ├── utils/ # Utility functions
│ │ ├── __init__.py
│ │ ├── config.py # Configuration management
│ │ ├── logging.py # Logging setup
│ │ ├── validation.py # Data validation
│ │ └── errors.py # Custom exceptions
│ │
│ └── cli/ # Command-line interface
│ ├── __init__.py
│ └── commands.py # CLI commands
│
├── contracts/ # Smart contracts
│ ├── package.json # npm configuration
│ ├── hardhat.config.js # Hardhat configuration
│ ├── .env # Environment variables
│ ├── .env.template # Template for .env
│ ├── contracts/
│ │ ├── ConsentRegistry.sol
│ │ ├── ConsentVerifier.sol
│ │ └── ConsentBatchOperations.sol
│ ├── test/
│ │ ├── ConsentRegistry.test.js
│ │ ├── ConsentVerifier.test.js
│ │ ├── Integration.test.js
│ │ ├── AdvancedScenarios.test.js
│ │ └── ComplexIntegration.test.js
│ └── scripts/
│ └── deploy.js # Deployment script
│
├── tests/ # Python package tests
│ ├── integration/
│ │ ├── __init__.py
│ │ ├── test_blockchain_integration.py
│ │ └── test_consent_integration.py
│ ├── unit/
│ │ ├── __init__.py
│ │ ├── test_blockchain.py
│ │ ├── test_consent.py
│ │ ├── test_crypto.py
│ │ └── test_storage.py
│ ├── __init__.py
│ ├── .env.test
│ └── confttest.py
│
├── docs/ # Documentation
│ ├── source/
│ │ ├── conf.py # Sphinx configuration
│ │ ├── index.rst # Documentation index
│ │ ├── installation.rst
│ │ ├── usage.rst
│ │ ├── api.rst
│ │ ├── examples.rst
│ │ └── security.rst
│ ├── Makefile # Documentation build
│ └── requirements.txt # Doc dependencies
│
├── docker/ # Docker configuration
│ ├── Dockerfile
│ └── docker-compose.yml
│
├── .github/ # GitHub configurations
│ └── workflows/
│ ├── python-package.yml
│ └── contracts-test.yml
│
├── setup.py # Package setup file
├── setup.cfg # Package configuration
├── pyproject.toml # Build system requirements
├── requirements.txt # Package dependencies
├── requirements_dev.txt # Development dependencies
├── tox.ini # Tox configuration
├── .pre-commit-config.yaml # Pre-commit hooks
├── .gitignore # Git ignore rules
├── README.md # Project README
├── LICENSE # License file
└── CONTRIBUTING.md # Contributing guidelines
Key file purposes:
-
Package Core (
oconsent/
):- Core implementation files
- Module-specific functionality
- Utility functions and helpers
-
Smart Contracts (
contracts/
):- Solidity smart contracts
- Contract tests
- Deployment scripts
- Contract-specific configuration
-
Tests (
tests/
):- Python package unit tests
- Integration tests
- Test utilities and fixtures
-
Documentation (
docs/
):- Sphinx documentation source
- API documentation
- Usage examples
- Security guidelines
-
Configuration Files:
setup.py
: Package installationpyproject.toml
: Build configurationtox.ini
: Test automation.pre-commit-config.yaml
: Code quality checks
-
CI/CD (
.github/
):- GitHub Actions workflows
- Automated testing
- Deployment pipelines
-
Docker (
docker/
):- Container definitions
- Compose configuration
- Build scripts
pip install -e .
cd contracts
npm install
npx hardhat compile
Python tests:
pytest tests/
Smart contract tests:
cd contracts
npx hardhat test
pytest -v -m "not integration"
pytest -v -m integration
pytest -v -m integration --eth-provider="http://localhost:8545"
pytest -v -m integration --contract-address="0x1234..."
pytest -v
./run_integration_tests.sh
Seee CONTRIBUTING.md
Subhadip Mitra, [email protected]