0% found this document useful (0 votes)
13 views6 pages

Aifba Exp - 1

The document outlines an experiment on setting up a digital money transfer system as part of an AI and Data Science course. It explains the theory behind digital payments, their importance, and the implementation of a blockchain-based system for handling transactions. The program demonstrates key blockchain concepts such as decentralization, proof of work, and transaction validation, emphasizing security and integrity in financial transactions.

Uploaded by

vu5f2122029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Aifba Exp - 1

The document outlines an experiment on setting up a digital money transfer system as part of an AI and Data Science course. It explains the theory behind digital payments, their importance, and the implementation of a blockchain-based system for handling transactions. The program demonstrates key blockchain concepts such as decentralization, proof of work, and transaction validation, emphasizing security and integrity in financial transactions.

Uploaded by

vu5f2122029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF ARTIFICIAL INTELLIGENCE & DATA SCIENCE

Subject: AI for Financial & Banking application Course Code: CSDL 8011
Semester: 8 Course: AI&DS
Laboratory no.:101 Name of subject teacher: Dr. Seema Ladhe
Name of student: Aaditya M.Sharma Roll no: VU2F2122050

Experiment No. 01

Title: Setting up a Digital Money Transfer System

Objectives: Study and setting digital transferring systems.

Theory:
What is a digital money transfer system?
A digital payment is the exchange of money from one payment account to another over a digital channel
of communication, such as mobile wireless data or SWIFT, or a digital device, such as a POS (Point of
Sales). There is no middleman or third-party organization like banks or financial institutions to function
physically as the enabler of these services.
By streamlining the current financial system, digital money transfers facilitate faster and more
affordable financial transactions. They may also make it simpler for central banks to implement
monetary policy effectively.

Importance of Digital Money Transfer system.


1. Instant and Convenient: Payments can be made instantly via modes like BHIM-UPI and IMPS,
allowing for easy transactions using mobile numbers or virtual payment addresses.
2. Financial Inclusion: Digital payments allow anyone with a phone to access banking services, even in
rural areas, including through UPI 123PAY for feature phones.
3. Transparency: Digital payments ensure direct transfers, reducing corruption and fraud in government
schemes (e.g., Direct Benefit Transfer).
4. Speed: Unlike cash, digital payments are almost instantaneous, no matter the location.
5. National Electronic Toll Collection (NETC): Allows toll payments without stopping at toll plazas,
using RFID technology.
6. Bharat Bill Payment System (BBPS): Enables easy and accessible bill payments through various
digital channels.
7. Enhanced Credit Access: Digital transactions build a financial footprint, enabling access to formal
credit for businesses and individuals.
8. Safety and Security: Digital payments require multiple authentications, reducing the risk of theft
compared to cash transactions.
Code:
Explanation:
1. Classes and Methods
Class: Block
• Represents an individual block in the blockchain.
• Attributes:
o index: Position of the block in the chain.
o previous_hash: Hash of the previous block for chain continuity.
o timestamp: Time of block creation.
o data: Contains transaction details (sender, receiver, and amount).
o proof: A proof-of-work value used for consensus.
o hash: Calculated hash for the block based on its content.
• Methods:
o calculate_hash: Generates a SHA-256 hash based on the block's attributes to ensure integrity.
Class: Blockchain
• Represents the entire blockchain.
• Attributes:
o chain: A list of blocks; initialized with a genesis block (the first block).
o balances: A dictionary to track user balances.
• Methods:
o create_genesis_block: Generates the genesis block with fixed data.
o get_latest_block: Retrieves the most recent block in the chain.
o add_block:
▪ Handles a transaction:
▪ Validates the sender's balance.
▪ Updates sender and receiver balances.
▪ Creates a new block and appends it to the chain.
o proof_of_work: Implements a computational puzzle for consensus. The solution is a new_proof
such that the hash of (new_proof² - previous_proof²) starts with "0000".
o is_chain_valid: Ensures the blockchain's integrity:
▪ Checks if each block's hash matches its recalculated hash.
▪ Verifies that each block's previous_hash matches the hash of the preceding block.

2. Main Functionality
• Genesis Block Creation:
o The blockchain starts with a predefined genesis block.
• Transaction Handling:
o The user inputs the sender, receiver, and transaction amount.
o The transaction is validated:
▪ If valid, a new block is added with the transaction details.
▪ If invalid (e.g., insufficient balance), an error is shown.
o The blockchain and user balances are updated accordingly.
• Blockchain Validation:
o At the end, the program verifies the integrity of the entire chain using is_chain_valid.

3. Key Features
1. Proof of Work (PoW):
o Ensures blocks are not added too easily, preventing spamming.
o Requires computational effort to find a suitable new_proof.
2. Balances:
o Tracks user balances to enforce transaction validity.
3. Immutability:
o The hash mechanism ensures that blocks cannot be tampered with without invalidating the chain.
4. Interactive Transactions:
o Allows users to input multiple transactions iteratively.

4. Example Execution
1. Genesis block is created and its hash is displayed.
2. Users input transaction details:
o If valid, the transaction is added to a new block, and the updated hash is displayed.
3. At any point, users can stop adding transactions.
4. The program validates the entire blockchain for integrity.

5. Benefits and Applications


• Demonstrates core blockchain concepts:
o Decentralized ledger
o Proof of Work
o Immutable transactions
• Provides a foundation for understanding real-world blockchain systems like Bitcoin or Ethereum.

Output:
Conclusion:

This program demonstrates the fundamental principles of blockchain technology in a simplified and interactive
manner. By implementing core components such as blocks, hashes, proof-of-work, and transaction validation, it
showcases how a decentralized ledger ensures security, transparency, and integrity.
The proof-of-work mechanism introduces computational difficulty, ensuring that adding new blocks requires
effort, thus protecting against tampering. The program also incorporates a basic balance tracking system,
making it a practical example for simulating cryptocurrency transactions.

R1 R2 R3
DOP DOS Conduction File Record Viva -Voce Total Signature
5 Marks 5 Marks 5 Marks 15 Marks

You might also like