Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Nov 22, 2024
1 parent 0768db5 commit 389eff4
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions blockchain_integration/pi_network/tokenization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Tokenization Service

This directory contains the implementation of a smart contract for tokenizing assets and a Python script for managing tokenized assets.

## Directory Structure

- `asset_token.sol`: Smart contract for managing tokenized assets.
- `tokenization_service.py`: Python script for interacting with the tokenization contract.
- `README.md`: Documentation for the tokenization service.

## Asset Token Contract (`asset_token.sol`)

The Asset Token contract allows users to create assets, mint tokens for those assets, and burn tokens as needed. It tracks asset details and emits events for asset creation, token minting, and token burning.

### Functions

- `createAsset(string memory _name, string memory _description, uint256 _value)`: Creates a new asset.
- `mintTokens(uint256 _assetId, address _to, uint256 _amount)`: Mints tokens for a specific asset.
- `burnTokens(uint256 _assetId, uint256 _amount)`: Burns tokens for a specific asset.
- `getAssetDetails(uint256 _assetId)`: Retrieves the details of a specific asset.

### Events

- `AssetCreated(uint256 indexed assetId, string name, string description, uint256 value)`: Emitted when a new asset is created.
- `TokensMinted(uint256 indexed assetId, address indexed to, uint256 amount)`: Emitted when tokens are minted for an asset.
- `TokensBurned(uint256 indexed assetId, address indexed from, uint256 amount)`: Emitted when tokens are burned for an asset.

## Tokenization Service (`tokenization_service.py`)

The Tokenization Service is a Python application that interacts with the Asset Token contract. It allows users to create assets, mint tokens, burn tokens, and retrieve asset details.

### Installation

1. Install the required packages:
```bash
1 pip install web3
```

## Usage

1. **Initialize the Tokenization Service**: Update the provider_url, contract_address, and abi in the tokenization_service.py file.

2. **Create an Asset**: Call the create_asset method with the owner's account, private key, asset name, description, and value.

3. **Mint Tokens**: Call the mint_tokens method with the owner's account, private key, asset ID, recipient address, and amount of tokens to mint.

4. **Burn Tokens**: Call the burn_tokens method with the owner's account, private key, asset ID, and amount of tokens to burn.

5. **Get Asset Details**: Call the get_asset_details method with the asset ID to retrieve its details.

## License
This project is licensed under the MIT License.

0 comments on commit 389eff4

Please sign in to comment.