Blockchain: Difference between revisions
No edit summary |
No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Blockchain and Smart Contract State of the art | == Research Output == | ||
Download: https://goo.gl/ | <b>Conference Papers </b><br> | ||
Blockchain and Internet of Things Opportunities and challenges. Download: https://goo.gl/woidKu <br> | |||
<b>Technical Reports </b><br> | |||
Blockchain and Smart Contract State of the art. Download: https://goo.gl/ksWUtk <br> | |||
Decentralized Risk-aware Access Control. Download: https://goo.gl/egPDgm <br> | |||
== Useful link to learn and install Bitcoin Blockchain == | == Useful link to learn and install Bitcoin Blockchain == | ||
Line 12: | Line 17: | ||
== Ethereum Blockchain and Smart Contract == | == Ethereum Blockchain and Smart Contract == | ||
Development Environment | Development Environment<br> | ||
Virtual Box | Virtual Box<br> | ||
Install Ubuntu 16.04.3 (64bits) | Install Ubuntu 16.04.3 (64bits)<br> | ||
Curl: sudo apt-get install curl | Curl: sudo apt-get install curl<br> | ||
Npm: sudo apt-get install -y npm | Npm: sudo apt-get install -y npm<br> | ||
Nvm: | Nvm: <br> | ||
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh | curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh<br> | ||
bash install_nvm.sh | bash install_nvm.sh<br> | ||
source ~/.profile | source ~/.profile<br> | ||
nvm ls-remote | nvm ls-remote<br> | ||
nvm install 8.5.0 | nvm install 8.5.0<br> | ||
nvm use 8.5.0 | nvm use 8.5.0<br> | ||
node -v | node -v<br> | ||
Chrome | Chrome<br> | ||
Wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | Wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb<br> | ||
Sudo dpkg -i google-chrome-stable_current_amd6.deb | Sudo dpkg -i google-chrome-stable_current_amd6.deb<br> | ||
Sudo apt-get -fy install | Sudo apt-get -fy install<br> | ||
Atom IDE | Atom IDE<br> | ||
Download from atom.io | Download from atom.io<br> | ||
Sudo apt-get install -f | Sudo apt-get install -f <br> | ||
Sudo dpkg -i atom-amd64.deb | Sudo dpkg -i atom-amd64.deb<br> | ||
Apm install language-ethereum | Apm install language-ethereum<br> | ||
Metamask Chrome Plug-in: Search in google and add to chrome | Metamask Chrome Plug-in: Search in google and add to chrome<br> | ||
Ethereum | Ethereum<br> | ||
Sudo apt-get install software-properties-common | Sudo apt-get install software-properties-common<br> | ||
Sudo add-apt-repository -y ppa:ethereum/ethereum | Sudo add-apt-repository -y ppa:ethereum/ethereum<br> | ||
Sudo apt-get update | Sudo apt-get update<br> | ||
Sudo apt-get install -y ethereum | Sudo apt-get install -y ethereum<br> | ||
Truffle | Truffle<br> | ||
Npm init -y -> package.json | Npm init -y -> package.json<br> | ||
Npm install -g truffle | Npm install -g truffle<br> | ||
Npm install -g ethereumjs-testrpc | Npm install -g ethereumjs-testrpc<br> | ||
Not support OS Ubuntu (fsevents 1.1.2) | Not support OS Ubuntu (fsevents 1.1.2)<br> | ||
Require OS: Arch or Darwin | Require OS: Arch or Darwin<br><br> | ||
Build Smart Contract<br> | |||
PET SHOP<br> | |||
npm install -g truffle<br> | |||
npm install -g ethereumjs-testrpc<br> | |||
truffle unbox pet-shop<br> | |||
truffle compile<br> | |||
Testrpc -p 8545<br> | |||
Geth attach http://127.0.0.1:8545<br> | |||
truffle migrate<br> | |||
npm run dev<br> | |||
<br> | |||
Ref:<br> | |||
http://truffleframework.com/docs/getting_started/installation<br> | |||
http://truffleframework.com/boxes/<br> | |||
http://truffleframework.com/tutorials/pet-shop<br><br> | |||
Demo:<br> | |||
https://www.youtube.com/watch?v=lULuJt8Crdo<br> | |||
== Get Bitcoin Blocks & Transactions == | |||
<pre> | |||
#!/bin/bash | |||
#Get block json data from block id, ex: Block #300000 | |||
##for block_id in {START_ID..END_ID} | |||
##do | |||
block_id=300000 | |||
blockHash=`bitcoin-cli getblockhash $block_id` | |||
##echo "Block $block_id: $blockHash" >> blockHash.txt | |||
echo "$blockHash" >> blockHash.txt | |||
echo "Block $block_id: $blockHash" >> txn.txt | |||
echo "`bitcoin-cli getblock $blockHash`" >>txn.txt | |||
echo "" >> txn.txt | |||
echo "Block $block_id" >> allTxn.txt | |||
echo "`bitcoin-cli getblock $blockHash | jq '.tx'`" >> allTxn.txt | |||
##done | |||
cat allTxn.txt | tr -d ']''['',''"' >> listTxn.txt | |||
#Get transaction confirmation time | |||
block_hex_id=`cat blockHash.txt` | |||
echo "`curl -s https://blockchain.info/rawblock/$block_hex_id`" >> blockJSON.txt | |||
echo "`cat blockJSON.txt | grep '\"time\"'`" >> epoch_tmp.txt | |||
cat epoch_tmp.txt | tr -d '"time":'','' ' > epoch.txt | |||
block_time=0 | |||
cat epoch.txt | while read epoch | |||
do | |||
second=`echo $epoch | awk '{print strftime("%c",$1)}' | awk '{print $3 ":" $4}' | awk -F: '{print ($1*86400)+($2*3600)+($3*60)+$4}'` | |||
#The first time value is the block creation time, the rest are transaction creation time | |||
if [ $block_time -eq 0 ] | |||
then | |||
time=$second | |||
block_time=1 | |||
fi | |||
dif=$(($time-$second)) | |||
printf '%02dh:%02dmin:%02ds\n' $(($dif/3600)) $(($dif%3600/60)) $(($dif%60)) >> Result.txt | |||
done | |||
rm allTxn.txt epoch_tmp.txt | |||
exit 0 | |||
</pre> | |||
== HyperLedger == | |||
https://hyperledger.github.io/composer/ <br> | |||
== Internet of Things == | |||
https:// | https://nodered.org/<br> |
Latest revision as of 14:08, 22 February 2019
Research Output
Conference Papers
Blockchain and Internet of Things Opportunities and challenges. Download: https://goo.gl/woidKu
Technical Reports
Blockchain and Smart Contract State of the art. Download: https://goo.gl/ksWUtk
Decentralized Risk-aware Access Control. Download: https://goo.gl/egPDgm
Useful link to learn and install Bitcoin Blockchain
https://bitcore.io/guides/fullnode
https://en.bitcoin.it/wiki/Main_Page
https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md
https://dev.visucore.com/bitcoin/doxygen/
https://github.com/bitcoin-blockexplorer/insight_ui
https://github.com/bitpay/insight
Ethereum Blockchain and Smart Contract
Development Environment
Virtual Box
Install Ubuntu 16.04.3 (64bits)
Curl: sudo apt-get install curl
Npm: sudo apt-get install -y npm
Nvm:
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm ls-remote
nvm install 8.5.0
nvm use 8.5.0
node -v
Chrome
Wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Sudo dpkg -i google-chrome-stable_current_amd6.deb
Sudo apt-get -fy install
Atom IDE
Download from atom.io
Sudo apt-get install -f
Sudo dpkg -i atom-amd64.deb
Apm install language-ethereum
Metamask Chrome Plug-in: Search in google and add to chrome
Ethereum
Sudo apt-get install software-properties-common
Sudo add-apt-repository -y ppa:ethereum/ethereum
Sudo apt-get update
Sudo apt-get install -y ethereum
Truffle
Npm init -y -> package.json
Npm install -g truffle
Npm install -g ethereumjs-testrpc
Not support OS Ubuntu (fsevents 1.1.2)
Require OS: Arch or Darwin
Build Smart Contract
PET SHOP
npm install -g truffle
npm install -g ethereumjs-testrpc
truffle unbox pet-shop
truffle compile
Testrpc -p 8545
Geth attach http://127.0.0.1:8545
truffle migrate
npm run dev
Ref:
http://truffleframework.com/docs/getting_started/installation
http://truffleframework.com/boxes/
http://truffleframework.com/tutorials/pet-shop
Demo:
https://www.youtube.com/watch?v=lULuJt8Crdo
Get Bitcoin Blocks & Transactions
#!/bin/bash #Get block json data from block id, ex: Block #300000 ##for block_id in {START_ID..END_ID} ##do block_id=300000 blockHash=`bitcoin-cli getblockhash $block_id` ##echo "Block $block_id: $blockHash" >> blockHash.txt echo "$blockHash" >> blockHash.txt echo "Block $block_id: $blockHash" >> txn.txt echo "`bitcoin-cli getblock $blockHash`" >>txn.txt echo "" >> txn.txt echo "Block $block_id" >> allTxn.txt echo "`bitcoin-cli getblock $blockHash | jq '.tx'`" >> allTxn.txt ##done cat allTxn.txt | tr -d ']''['',''"' >> listTxn.txt #Get transaction confirmation time block_hex_id=`cat blockHash.txt` echo "`curl -s https://blockchain.info/rawblock/$block_hex_id`" >> blockJSON.txt echo "`cat blockJSON.txt | grep '\"time\"'`" >> epoch_tmp.txt cat epoch_tmp.txt | tr -d '"time":'','' ' > epoch.txt block_time=0 cat epoch.txt | while read epoch do second=`echo $epoch | awk '{print strftime("%c",$1)}' | awk '{print $3 ":" $4}' | awk -F: '{print ($1*86400)+($2*3600)+($3*60)+$4}'` #The first time value is the block creation time, the rest are transaction creation time if [ $block_time -eq 0 ] then time=$second block_time=1 fi dif=$(($time-$second)) printf '%02dh:%02dmin:%02ds\n' $(($dif/3600)) $(($dif%3600/60)) $(($dif%60)) >> Result.txt done rm allTxn.txt epoch_tmp.txt exit 0
HyperLedger
https://hyperledger.github.io/composer/