Blockchains, DApps and smart contracts
What is blockchain?
Block structure
Block time
Transaction
Ethereum
What are DApps?
Why DApps
Decentralized Vs Federated
What is a smart contract?
Structure
Environment
Solidity
Create your first Smart contract!
A block is a Node in a blockchain where information is stored and encrypted.
Mining is the process where we try to fit the 'nonce' to get a signed block.
A blockchain is a series of blocks, where prev refers to the block# of previous node.
Replace Data with transactions
Add Coinbase to keep track of transaction amount in the account
The amount of time that it takes to check the hash and find a nonce which is less than the target value
signed message = message + private key
verify = message + public key + signed message
A record that describes one account sending money to another.
private key => v+r+s
v+r+s => sender's address
We create a transaction object and submit to a network
The ultimate smart contract and decentralized application platform
Its white paper introduces the idea of 'smart contracts' as an entity that can send and receive money beyond just humans
When we interact with a node in Ethereum network for a transaction, our transaction along with other transactions happening in the network are put together as a "block" in the block chain
Digital applications or programs that exist and run on a blockchain or peer-to-peer (P2P) network of computers instead of a single computer.
They are outside the control of a single authority. DApps—which are often built on the Ethereum platform—can be developed for a variety of purposes including gaming, finance, and social media.
Rinkeby
Contract Instance
Contract Instance
Contract Instance
deployment
Contract Source
Contract definition
|
solidity compiler
|
Byte code for deployment | Application Binary Interface(ABI)
JS -> ABI -> Byte code preview
pragma solidity ^0.4.12
contract Inbox{
string public message;
function Inbox(string initialMessage) public{
message = initial message;
}
function setMessage(string newMessage) public{
message = newMessage;
}
function getMessage() public view returns(string){
return message;
}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;
contract Message {
string message;
constructor(string memory initialMessage) {
message = initialMessage;
}
function setMessage (string memory newMessage) public{
message = newMessage;
}
function getMessage() public view returns(string memory){
return message;
}
}