Sahcoin is a decentralized blockchain platform built using Python and Flask, designed to allow users to mine blocks, validate the blockchain, and conduct transactions securely. Additionally, Sahcoin includes a smart contract for an Initial Coin Offering (ICO) written in Solidity, enabling investors to buy and sell Sahcoins using Truffle Suite and Ganache.
- Blockchain Implementation (sahcoin.py):
- Create and validate a blockchain.
- Proof-of-Work consensus mechanism.
- Transaction handling and node communication.
- Multi-Node Setup (sahcoin_node_5001.py, sahcoin_node_5002.py, sahcoin_node_5003.py):
- Support for decentralized network setup with multiple nodes.
- Node interaction and chain synchronization.
- API Testing with Postman:
- Interact with the blockchain implementation using Postman.
- Test various endpoints for GET and POST requests to mine blocks, add transactions, and check the blockchain state.
- ICO Smart Contract (sahcoins_ico.sol):
- Smart contract for Sahcoin ICO.
- Equity management in both Sahcoins and USD.
- Buy and sell Sahcoins using Ethereum-based tools.
- Blockchain Operations: Use the Flask-based API to mine new blocks, add transactions, and manage nodes.
- ICO Operations: Deploy the sahcoins_ico.sol contract using Truffle and interact with it through Ganache.
- API Testing: Use Postman to test the endpoints for blockchain operations, including '/mine_block', '/get_chain', '/is_valid', '/add_transaction', '/connect_node', and '/replace_chain'.
- Python: Blockchain and Flask API.
- Solidity: Smart contract for ICO.
- Flask: Web application framework.
- Postman: API testing and interaction.
- Truffle Suite and Ganache: Ethereum development environment.
- Install nvm
- Install node v16
- Install flask
A) Blockchain Implementation
- run python app_name.py
- Interact with the blockchain using Postman
B) Smart contract for ICO
- Install truffle
- Install truffle suite ganache gui
- Ensure the ganache gui is up and running
- If you want to create your own smart contract:
- create a new directory
- run truffle init
- ensure you are using the required version of solidity
- run truffle migrate after creating the smart contract and migrate files
- Run node interact.js
- You can also test the smart contract before running truffle migrate by running the test file