BCT 4-6
BCT 4-6
Experiment No. 4
Theory:
Smart Contract
A smart contract is a self-executing digital contract with the terms of the agreement directly written into code.
It automatically enforces and executes the contract once the predefined conditions are met. Smart contracts
run on decentralized blockchain networks like Ethereum, ensuring transparency, security, and immutability.
These contracts can handle transactions, agreements, or any automated workflow without needing
intermediaries, reducing costs and increasing efficiency.
contract Transactions {
R1 R2 R3
DOP DOS Conduction File Record Viva -Voce Total Signature
5 Marks 5 Marks 5 Marks 15 Marks
DEPARTMENT OF ARTIFICIAL INTELLIGENCE
&
DATA SCIENCE
Experiment No. 5
Theory:
Ethereum is run by different clients on different peoples’ computers. Whether you’re using a C++, Rust,
Golang, or some other implementation doesn’t matter so long as your client implements the protocol properly.
Installing
Geth brew update brew upgrade brew tap ethereum/ethereum brew install ethereum Now you have Geth
available to you on the command-line.
Creating an Account
You need to create a private/public keypair first so you can write transactions to the blockchain. You do this in
Geth with the following command (note: do not forget the passphrase you choose).
R1 R2 R3
DOP DOS Conduction File Record Viva -Voce Total Signature
5 Marks 5 Marks 5 Marks 15 Marks
DEPARTMENT OF ARTIFICIAL INTELLIGENCE
&
DATA SCIENCE
Experiment No. 6
Theory:
Ganache
Ganache is a personal blockchain for Ethereum development that allows you to deploy contracts, develop
applications, and run tests on a local blockchain environment. It is part of the Truffle Suite and is available as
both a GUI and CLI tool. Here's what Ganache provides:
1. Local Ethereum Blockchain: Ganache creates a local Ethereum network on your machine. This allows
you to quickly test your DApp without relying on public testnets or spending real Ether. You can control
the environment, including block times and gas limits.
2. Pre-configured Accounts: Upon starting Ganache, you receive several pre-configured accounts loaded
with fake Ether. These accounts are useful for testing the sending of transactions and deploying
contracts without needing to worry about funds.
3. Blockchain Simulation: Ganache simulates Ethereum’s mainnet, but since it runs locally, it's much
faster. It provides detailed logs of all transactions, including gas costs, making it easy to debug and
optimize your contracts.
4. Time Travel Feature: You can manipulate the blockchain time to test how your smart contract behaves
in the future or past, which is useful for contracts that depend on time-based logic.
Installation:
Download Ganache:
Go to the Ganache releases page on the Truffle Suite website.
Run the downloaded installer and follow the prompts.
Open Ganache:
After installation, launch Ganache from the Start Menu or desktop shortcut.
R1 R2 R3
DOP DOS Conduction File Record Viva -Voce Total Signature
5 Marks 5 Marks 5 Marks 15 Marks