This project implements a decentralized compute and storage platform using smart contracts on the Stacks blockchain. It allows users to register as storage or compute providers, lease resources from these providers, and manage their leases.
- Registration and management of storage nodes
- Registration and management of compute nodes
- Leasing of storage space
- Leasing of compute resources
- Payment system for leases
- Lease extension functionality
register-storage-node: Register a new storage nodeupdate-storage-node: Update an existing storage node's details
register-compute-node: Register a new compute nodeupdate-compute-node: Update an existing compute node's details
lease-storage: Lease storage space from a nodelease-compute: Lease compute resources from a node
pay-storage-lease: Pay for a storage leasepay-compute-lease: Pay for a compute lease
extend-storage-lease: Extend the duration of a storage leaseextend-compute-lease: Extend the duration of a compute lease
- Input validation for all user-provided data
- Maximum limits on resource quantities and prices
- Ownership checks for node updates
- Lease duration limits
- Clarinet: A Clarity runtime packaged as a command line tool
- Stacks Wallet: For interacting with the Stacks blockchain
-
Clone this repository:
git clone https://github.com/yourusername/decentralized-compute-storage.git cd decentralized-compute-storage -
Install dependencies:
clarinet requirements -
Test the smart contract:
clarinet test
-
Configure your Stacks wallet with sufficient STX for deployment.
-
Deploy the contract to the Stacks blockchain:
clarinet deploy
Interact with the deployed contract using the Stacks CLI or integrate it into your dApp using the Stacks.js library.
Example of registering a storage node:
const contractAddress = 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9';
const contractName = 'decentralized-compute-storage';
const txOptions = {
contractAddress,
contractName,
functionName: 'register-storage-node',
functionArgs: [uintCV(1000000), uintCV(10)],
senderKey: 'your-private-key',
validateWithAbi: true,
network: 'mainnet',
};
const transaction = await makeContractCall(txOptions);
const result = await broadcastTransaction(transaction, network);
console.log(result);Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This smart contract is a prototype and has not been audited. Use at your own risk in production environments.
This README provides a comprehensive overview of the decentralized compute and storage project. It includes:
- A brief introduction to the project
- Key features
- Detailed list of smart contract functions
- Security features implemented
- Getting started guide, including prerequisites and installation steps
- Deployment instructions
- Usage example with JavaScript code
- Sections for contributing and license information
- A disclaimer about the project's current state
This README should give potential users and contributors a good understanding of what the project does, how to set it up, and how to use it. It also provides a solid foundation for further documentation as the project evolves.