Search this site
Embedded Files
Skip to main content
Skip to navigation
Bing's Tech Notes
Welcome
AWS
General Overview
Computing Overview
Computing
EC2
Lambda
Lambda Middleware Study
Storage
S3
EBS
EFS
Database
DynamoDB
RDS
Aurora
Security & ID
Cognito
IAM
Networking & CDN
Cloud Front
Route 53
VPC
Development Environment
Serverless Web App Study
Javascript Integration
Amplify
SDK
Testing
Serverless Application Model
Tools
AWS CLI
JMESPath
VS-Code Env
SAM CLI
CDK
DevOps Services
Code Build
Code Pipeline
Code Commit
Code Deploy
Application Integration
Step Functions
SQS
AppSync
API Gateway - REST
API Gateway - HTTP
API Gateway - WebSocket
Management
CloudFormation
Cloud Trail
Cloud Watch
CloudWatch Events
Well Architected
Well-Architected Tool
Well Architected Framework
Gotya!!
Trouble Shooting Tips
Random Tech Nodes
Migration
Dev Tools
Monorepo
Thinking about multi-project
MS Rush
Lerna
Scaffolding
Slush (project scaffolding)
Yeoman
Code Generators
Testing
Selenium
AVA
Sinon.js JS test spy/stubs & mocks
Jest.JS
Contract Testing
OpenAPI & Swagger
Building
Gulp
Maven
POM
Quick Marven Howto
Gradle
IDE
VS Code
Extension
Eclipse Quick Ref.
Howto
Create User Library
Document code
Problem and Solutions
Project Properties
IDEA
Version Control
CVS
Git
Submodule & Subtree
subtree
Version Numbering
jq
Natural Language Processing
AI
AI Fundamentals
Landscape
Blockchain
Bitcoin
Ethereum
Base Layer Services
Client/Node
Development
Dapp
Development Environment, Sample App and Tools
Open Zeppelin
Private Dev Network
Remix
Solidity
Call, DelegateCall & Callcode
Truffle Framework
Web3 JS
Web3J - Java API
Tech Issues
Signature and Verification
Log & Events
Tools
Geth - GoLang client
Local wallet
Meta Mask
Official online wallet
Ethereum resources
Raw Transaction
Hyperledger
Risk, Incident Studies
The Satoshi Nakamoto Paper
Wallet Study
BIP32 HD Wallet
Database
MongoDB
Mapping
MongoDB Java Driver
Neo4j
Reading note - Learning neo4j ebook
Oracle XE 11g Notes
PostgreSQL
Data Dictionary
Data Types
Functions and Operators
Howto
Object Hierarchy
Redis
GraphQL
Development
Design Patterns
DAO
GUI Architectures
Hexagonal Architecture
Parse, Don't Validate
Frameworks
Feathers
GWT
Click event, coordination, scroll etc.
JSNI
Study ScrollPanel (or, implement my viewer for MISO project)
Java EE
Bean Validation
Configure Web Application
Development Environment
Eclipse - Wildfly JPA Development Environment
Eclipse project structure
EJB
Injection & Event
3rd Party Resources
CDI Bean Definition
CDI Bean Scope
CDI BeanManager
CDI Decorator
CDI Events
CDI Injecting
CDI Interceptors
CDI Lifecycle Callbacks
CDI Overview
CDI Packaging
CDI Qualifier
CDI SANITY-Check
CDI Stereotypes
Managed Beans and Containers Summary
Predefined CDI Beans
Resource Injection
Interceptor
JavaServer Face
JPA
Additional Helpers
Advanced Mapping Tips
Criteria API
Development environment
Entity Relationships
EntityManager, Transaction and Everything
Inheritence
JPA Entity
Locking
Managing Entities
Persistence Unit and Packaging
Query JPQL
Setting up
Packaging
Resource and JNDI
Security
Securing Enterprise Applications
Servlet
Transactions
Web Service
Java Portlet (JSR 286)
React
OSGI
Spring
Hibernate
Ch1 Tutorial
Ch2 Architecture
Ch3 Configuration
Ch4 Persistent Classes
Hibernate Tools
IoC
Testing
Gotcha
Spring Security
WebSocket
Pet Clinic Study
REST
Vue
Bootstrap Vue
Feathers Chat Example
vue-loader
Component
Vuex - State Management
Reactive Caveats
Vue & Beyond
Nuxt
Typescript Support
ZK
ZK Dev Env Setup
ZK Essentials
Ch1 introduction
Vue3
Routing
Development Experiences
Data Store Study
Pinia
Thinking About UI, Model and Persistence
Java, Various Concerns and Options
ANTLR Parser
Guava Event Bus (google)
MDE
Java Annotation Processors
Java Code Generation
Model Mapper
Scripting (not Javascript)
Bean Shell
Security
Java Authentication and Authorization Service (JAAS)
Serialization
Java Object to XML
Template Engine
Handlebar / Mustache
Word PDF Generation & Handling
PDF, XSL-FO, HTML Paged Media
Apache FOP
Apache FOP 2.2 Test Application
OpenHtmlToPDF
Testing and Mocking
UML Diagram Generation
Misc
Mako Template
MarkDown
Web MS Office Integration
Pebble
Python
Code Style
IDLE
Introspection
Lang Cheatsheet
Main & Getopt
PyCharm
re
Spyder
Vaadin
Architecture Note
Architecture study
Item, FieldGroup and Everything
My Vaadin MVVM attempt
Study of the Notice Board application
Book of Vaadin Notes
Ch1-4 Introduction, getting started, architecture
ch11 Advanced Web App Topics
ch5 UI components
Table
ch5 writing a server-side web application
ch6 Layout
Grid Layout
DEPRECATED ch10 SQL container
DEPRECATED ch19 JPAContainer
DEPRECATED Ch9 Data Binding
Develop New Components
Navigation
Themes
Vaadin CDI
Create Maven vaadin project with Eclipse
DEPRECATED JPA Container
Development Environment
How to logout
Howtos
Insanity Solution
CDIUI Re-entry problem
Javascript Interation
Server Pushing
Vaadin 8 DataProvider
Viritin
XML
XPath
XSL
XSLT
Caching
Test Driven Development
Fitbit
OO & Functional Programming
JSON Schema
Web Development
Web Component
HTML
Web Workers
Chrome Extension
Mobile Friendly Web Design
CSS
Drag and Drop
Observability
OpenTelemetry
Structurizr DSL Language
General
Complexity
Statistics
System Design Topics
UX UI Design
Observability
Languages
Javascript
Debugging
JS on Web
NPM
Promise, async func & await
Same Origin Policy and Relaxations
Tricks
Viewport, web dimention & coordinations
Webpack
Who's Who
Modules
Mocha & Chai
JS for CLI tools
Object constructor & methods
High Level Programming
Function
Symbol
Reflect
Proxy
Class
Private NPM Registry
Java Language
Annotation
Concurrency
Java Logging
Lang Features
Nested Classes
Regular Expression
Tips & Solutions
Typescript
Dependency Injection
Decorator
Interface Checking
Environment & Setup
Types & Type Expression
Triple-Slash (Compiler Directives)
Generic
Functions
Class
Module
Namespace
Plugin System
'declare', '.d.ts' and configurations
Basic Syntax
Data Validation
typescript-eslint
Typescript DOM Manipulation
As Const
Linux
Basic Networking
Network Manager
Bridge
CentOS 6 Notes
Deep Freeze
LVM
Package Mgmt.
Privilege
Process
Samba Client
Samba Server
Storage
Tools
awk
Bash
Cryptkeeper
Diff & Meld
Expect
Firefox Plugins
grep
hexdump
LibreOffice
lsof
Netem : Simulate Slow Network Connection
Performance / Activity monitoring
Screen
sed
strace
tcpdump
USB Boot Disk Preparation
Wget
while read loop
xargs
Ubuntu Desktop
13.10 notes
18.04 notes
Install Checklist
Managing iPhone
Migration
Process Nikon Raw Photo
Hardware / Driver Tips
Get Broadcom BCM43142 Bluetooth 4.0 work under Ubuntu
Share Keyboard and Mouse Between Two Ubuntu
Freeze during bootup
Use another tab as second display
UPS Settings
Upstart
Protocol & Service
Act as CA
LDAP
Openssh
OpenVPN
RESTful Web Service
Single Sign On - SAML & OAuth2
VPN & IPSEC
IPSEC VPN between Ubuntu and Juniper SSG5
WebSocket
X509 Certificate
ISO 8583
Server & System
Apache
Client Certificate Authentication
Reverse Proxy
Bacula
Backup Strategies
Director
Install Bacula under Ubuntu 12.04
Messages
Bind (Named)
Doc Management
iRedMail
JBoss EAP
Application Server Management
Datasource Management
Hot deployment
Installation Guide (6.2)
Introduction (EAP6)
Management Interfaces
User Management
MySQL
Nuxeo
Deployment & Administration
Backup & Restoration
Desktop Integration Test
Move Data Directory
Nuxeo Installation & Debug & Apache Reverse Proxy Setup with Client Certificate Authentication
Development
Bundle, Extension, Service and Contribution
Development Choices
Development Environment
Document and Document UI
Document Misc
Logging
Misc
Operation, Automation and Chain
Remaining Questions
Workflow
Issues and Fixs
Postfix
Qmail
Server Monitoring
Video Streaming & Editing
Wildfly (JBOSS community version)
Google Sheet
Honeycomb
Softwares & Service Catalog
VM & Container
Architecture
Container & State
Docker
KVM Virtualization
Backup and Restore
Configuration
Directories & Refs
Disk Image
Display
Guest Installation
Guest USB
Host Setting Up
Kubernets
Bing's Tech Notes
Ethereum
Basics
Permission-less
Distributed storage (like bitcoin)
Computing power (node execute code distributed by participants, which bitcoin has very limited support)
Value token (Ether ETH)
Block time: ~14 seconds (vs Bitcoin 10min)
maintained by the Ethereum network (protocol) by adjusting the difficulty level for the hash/POW
block size depends on number of transactions received during the average duration (block time?). miner takes the transactions and add to block.
Block size: Depends, typical 2k (Bitcoin maximum 1M)
Scripting: smart contract
History
"scripting feature on bitcoin"
2015/05 Olympic (test net)
2015/07 Frontier (beta)
2016/03 Homestead (current)
Usage
Wallet
connect to the network via the
local
Ethereum node (is it a node? peer?)
manages Ether(s) and Smart Contracts
suitable for simple application
not suitable for user-friendly or complex application - which requires specific client
DAPP (Decentralized Apps)
connect via the local node
interact with contracts on network
execution is not free (needs Ethers to execute)
Get Ethers
mining (use wallet to mine for Ethers)
trade
Ether faucets (free, google them)
from friends ...
Smart Contract
computer
code
lives
on the network
Application Binary
Interface
(ABI)
enforces agreed
rules
decided by contracting parties
on certain event performs negotiated
actions
contain contract
states
which changes
expose
functions
(API) to DAPPs
generate
events
received by the frontends (DAPPs)
Dapp sends transaction
Local node propagate the transaction to Ethereum network
Transaction get mined
state of contract get changed
event get emitted, data for the event get
logged
on all nodes in network (all event logs on all nodes)
Dapp that is watching event (by subscription) receives events (if watching dapp get notified)
normal contracts & library contracts
normal contracts can do anything
can call another deployed contract
library contracts
it's code is executed in the context of the calling contract
if library accesses storage
calling contract should have the storage defined correctly : library will be writing to caller's storage
http://solidity.readthedocs.io/en/develop/contracts.html#libraries
event usage pattern:
receive data for transaction (event has return value for invoked method)
asynchronous trigger (serialized steps)
cheap data storage (dapp can access the logs and process the events in the logs, for example to report)
log data storage: not free but much cheaper (8Gas/byte) than contract storage (20,000 Gas/32 byte)
contract code cannot access logs data
transactions recorded in the chain
Implementation
Solidity a most common language
Serpent
Lisp like language
Ether (ETH)
Front end always uses wei denomination (among others), 1 wei = 0.000000000000000001 ETH
Where comes those ETH?
first 60M - presale 2014
12M created to fund the development
5 Eth = reward for every block
sometimes 2-3 Eth for non-winning miners (uncle rewards)
Be used to pay "gas"
Gas
Paid by user who is invoking a transaction for execution
fee = "Gas use in Gas" X "Gas price"
"Gas" is the unit to measure EVM resource usage
depends on transaction (type / number of op-code executed, fee schedule based) & storage used by the contract
Gas price
specified by user in transaction
miner decide acceptable or not
Process
User specify, in transaction:
Start Gas (units), or gas limit : max units of gas originator willing to spend
difficult, or even impossible to estimate
https://ethstats.net/ - check usual gas limit
Gas Price : per unit gas price originator willing to pay
Escrow: startGas * gasPrice, taken from user
Transaction executed
Result
Sufficient escrow:
Fee = gasUsed * gasPricenumber
Refund if applicable
Insufficient escrow:
Fee paid: startGas * gasPrice (escrow)
Out of gas exception!
No change made (failed transaction)
EVM - Ethereum virtual machine
Run on Ethereum network node
Execute Ethereum bytecode follows the EVM specifications (part of Ethereum protocol)
Decentralized Apps
Frontend app connects to Ethereum network
Implementation
Commonly implemented as Single page application (HTML+CSS+JS)
Can use any other (Java, Python, C++, .NET)
interface with backend (smart contract on network) via Web3 API
Backend for application implemented as Smart Contract (deployed on Ethereum blockchain)
Data resides in contract instance
All transactions visible to everyone on network
Working
User invoke contract
user needs to pay the "gas" or transaction fee for invoking the contract
miner collects the transaction fee
transactions validated / mined by miner
then recorded in ledger
Dapp invokes contract functions (API)
Examples
Ethereum Wallet
Example - DAPP bidding
buyer app
seller app
contract
rules & actions
bid()
Event: BidReceived
withdrawFunds()
state data (item, bidding price, etc.)
Ethereum Networks
Live network (real things happen here) ID=1
Test-Net
Ether has no real value
Morden (ID=2) retired
Ropsten (ID=3) current
KOVAN (not supported by all clients)
PINKEBY (not supported by all clients)
Private network (ID = assigned)
data privacy
as a distributed database without complicated configuration
consortium
industry verticals
permissioned
to carry out internal transactions & contracts
Clients (wallet, Dapp) can connect to any network (they are of same specification and expected to behave the same way)
Chain Explorers (Block explorer) Applications
Tools for developer to debug what's happening on network
See flow of transactions and creation of block
Public list
https://etherscan.io/
https://testnet.etherscan.io/
https://live.ether.camp/
https://etherchaion.org/
Private network
install an opensource explorer
Consensus Models
Is process by which blocks get created
a node validate the transactions, create the block using pre-defined process defined by blockchain protocol
other nodes reach consensus to include / reject the block
Common models for consensus
Proof-of-Work (bitcoin, Ethereum for now 2017.12)
Computationally intensive (expensive)
Validate and group transactions
Then solve a
PUZZLE
(that can only be solved by brutal force)
Protocol dictate the puzzle (rule, structure, data used to solve the puzzle)
Difficulty (amount of computation) of puzzle changes for every block, to make sure blocks are generated at a uniform rate (regulation)
Example puzzle (very simplified)
Data + X? -> one way hash -> 000...000 (N zeros leading) hash, N decides difficulty
Ethereum puzzle
Protocol: GHOST
Algorithm: ETHash (very memory intensive)
Difficulty : network adjusted; block created ~12 seconds
Incentive: 5 Ether + fee + uncles
Uncles: valid blocks created by non-winning miner not included by network lag
Solution included in block as proof of work
Multiple miners compete to solve the puzzle and first one solved the puzzle publishes to the network
All the nodes validate the block and eventually the block be added
Proof-of-Stake (Ethereum expected to switch to)
Ethereum expected to switch to protocol (CASPER) , reason (comparing to PoW)
lower energy consumption
lower incentive (lower costs)
promote good behavior
punishment as part of the protocol as deterrent
No competition validators (not referred to as miner in this model) - node selected by network based on protocol dictated strategy
chance related to stake of node, and hence chance of reward
stake - wealth that user holds on the network
Process
network selection
if validator did not validate, select next validator, until validates
complete validation, add block
Incentive driven model (mining)
validator get rewarded
fixed reward in tokens
transaction fee
Google Sites
Report abuse
Google Sites
Report abuse