-
在加密貨幣的世界中,錢包並非儲存加密貨幣的地方。
-
反倒是錢包的主要功能是一個儲存私鑰(Private Key)的工具,私鑰是一串很長的英文字母、數字組成的字串(通常是 64 個 16 進制位元 = 256 Bits = 32 Bytes 所組成),而這條很長的字串讓您有權力把自己的加密貨幣傳送給別人。
-
錢包可在使用者產生交易(Transaction)時使用私鑰將交易簽章(Digital Signature),而簽章的目的除了確認使用者為貨幣擁有者外,還可確保在交易完成後不可否認(Non-Repudiation)此交易;而儲存加密貨幣的地方則是負責維護區塊鏈(Blockchain)的礦工節點內。
-
加密貨幣錢包形式多樣,分為離線的冷錢包(Cold Wallet)、在線的熱錢包(Hot Wallet)、印在紙上的紙錢包(Paper Wallet)… 等。無論何種形式的錢包,錢包的開發商均需要有一個共同遵循的規範(例如:私鑰為多少位元、如何依據一個亂數產生私鑰等)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.25; | |
contract Bank { | |
// 此合約的擁有者。 | |
address private _owner; | |
// 儲存所有會員的 ether 餘額。 | |
mapping (address => uint256) private _balance; | |
// 儲存所有會員的 bank coin 餘額。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >0.3.99 <0.6.0; | |
/** | |
* @title SafeMath | |
* @dev Math operations with safety checks that revert on error | |
*/ | |
library SafeMath { | |
/** | |
* @dev Multiplies two numbers, reverts on overflow. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.24; | |
/** | |
* Utility library of inline functions on addresses | |
*/ | |
library Address { | |
/** | |
* Returns whether the target address is a contract | |
* @dev This function will return false if invoked during the constructor of a contract, | |
* as the code is not actually created until after the constructor finishes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.24; | |
/** | |
* Utility library of inline functions on addresses | |
*/ | |
library Address { | |
/** | |
* Returns whether the target address is a contract | |
* 回傳目標地址是否為合約 | |
* @dev This function will return false if invoked during the constructor of a contract, |
橢圓曲線加密演算法(Elliptic Curve Digital Signature Algorithm,ECDSA)是比特幣、以太坊區塊鏈所使用的非對稱式金鑰加密技術,
可輕易讓貨幣持有者透過私鑰 Private Key(變數:d_A)對資訊進行簽章(Digital Signature),讓所有人使用 Public Key(變數:d, e, p, n, G, Q_A)來進行驗證(或是反向進行秘密傳遞)。
然而,早期的 ECDSA 演算法中,有一個僅產生一次性使用的臨時簽名變數 k(Ephemeral Key)
因不夠隨機,又或是忽略了其重要性(如每次收發訊息都使用相同的 k 值),導致駭客可透過反推方式求得 k 值,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 在 Ubuntu 18 安裝 Tensorflow/Keras 開發環境 | |
## 安裝 nVidia 顯示卡驅動程式 | |
``` | |
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | |
$ sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list' | |
$ sudo add-apt-repository ppa:graphics-drivers/ppa | |
$ sudo apt-get update | |
$ sudo apt-get -y install nvidia-driver-415 htop git |
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
$ sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update
$ sudo apt-get -y install nvidia-driver-415 htop git
Fork from Go 語言開發實戰從入門到進階
-
Go 語言(又稱 Golang)是 Google 推出新一代的強大語言,2019 年 3 月 Google 公佈了去年底統計的問卷結果,發現 65% 用 Go 來寫網站,39% 用來開發系統程式,41% 用來做 DevOps(多重選擇),可想而知 Go 語言可以拿來從底層寫到上層。高效能的 Goroutine(併發)表現優於 Parallelism(並行),語法上簡潔又簡單,這也就是為什麼我們要來嘗試 Go 語言。
-
註:因學院學員的電腦不用被切換畫面,原來的 Homework 的時間可以改成:直接讓學員手把手跟著老師一起操作。
-
原因:學員常在自由的 Homework 的時間跑去做別的事,使得前段上課凝聚的集中力較容易散掉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Run as administrator through CMD.exe | |
@echo off | |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" | |
choco install -y git.install --params "/NoShellIntegration" | |
choco install -y vscode golang vscode-go googlechrome chrome-remote-desktop-host dontsleep.install winrar notepadplusplus.install | |
echo RAR registration data> "C:\Program Files\WinRAR\rarreg.key" | |
echo yaokai.org>> "C:\Program Files\WinRAR\rarreg.key" | |
echo Unlimited Company License>> "C:\Program Files\WinRAR\rarreg.key" | |
echo UID=75ced9c73b51fdd111d1>> "C:\Program Files\WinRAR\rarreg.key" | |
echo 641221225011d14d1c98ba62a152232016b11806608201f0e0460d>> "C:\Program Files\WinRAR\rarreg.key" |
OlderNewer