Danh sách các boot nodes của ethereum
Danh sách các boot nodes của ethereum
web3 js sử dụng hàm sign và hàm ecRecover làm chức năng đăng nhập
Những anh em nào yêu thích hoặc đã quen với lập trình javascript có thể sử dụng thư viện <a href="https://www.npmjs.com/package/web3" target="_blank">web3 js</a> để làm cơ chế đăng nhập thông qua hàm <code>sign</code> và <code>ecRecover</code>, ví dụ:
<p>
</p>
<pre>
const Web3 = require('web3');
const fs = require('fs');
const Strings = require('./stri
Sử dụng tài khoản ethereum để login cho các ứng dụng khác
Ethereum nói riêng hay blockchain nói chung đều sử dụng <strong>chữ ký số</strong> để ký và xác thực giao dịch, vậy nên chúng ta cũng có thể tận dụng cơ chế này cho phép người dùng có địa chí tài khoản etherum tạo được tài khoản trên hệ thông của chúng ta, các bước bao gồm:
<p>
</p>
<ol start="1">
<li>Người dùng tạo một mật khẩu bất kỳ, chuyển mật khẩu này
Ethereum gas limit và gas price dùng để làm gì?
Trong ethereum thì gas limit và gas price dùng để tính ra tiền phí (eth) mà một giao dịch phải trả. Từ tháng 8 2021 thì cách tính phí giao dịch sẽ kiểu này:
<p>
</p>
<ul>
<li>Giả sử Alice gửi cho Bob 1 ETH với gas limit <code>21,000</code> units và gas price là <code>200 gwei </code>, thì tổng tiền phí sẽ là: <code>Gas units (limit) <h1>Gas price per unit
Tạo một giao dịch chuyển tiền trong mạng ethereum private
Để tạo một giao dịch chuyển tiền trong mạng ethereum private, chúng ta có thể thực hiện các bước sau:
<p>
</p>
<ol start="1">
<li>Tạo sẵn 1 tài khoản với mật khẩu tuỳ ý, ví dụ <code>123</code>
</li>
<li>Khởi tạo 1 mạng private với genesis block và tài khoản vừa tạo kiểu thế này:
</li>
</ol>
<pre>
{
"config": {
"chainID" : 10,
"homestea
Deploy ERC20 (smart contract cho ICO) lên mạng private
Dể deploy ERC20 (smart contract cho ICO) lên mạng private, chúng ta cần trải qua các bước sau:
<p>
</p>
<ol start="1">
<li>Tải ERC20 contract <a href="https://github.com/ethereum-optimism/Truffle-ERC20-Example/tree/master/contracts" target="_blank">tại đây</a>
</li>
</ol>
<p>
</p>
<ol start="2">
<li>Sửa file <code>truffle-config.js</code> thế này:
</li>
Sử dụng smart contract trong mạng etherum với web3js
Giả sử contract của chúng ta có nội dung thế này:
<p>
</p>
<pre>
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Migrations {
string public _message;
uint public _last_completed_migration;
function Hello() public{
_message = "Hello World!";
}
function setComplet
Deploy contract lên mạng Ropsten test net
Để deploy contract lên mạng Ropsten test net, chúng ta cần thực hiện các bước sau:
<p>
</p>
<ol start="1">
<li>Tạo project truffle
</li>
<li>
<ol start="1">
<li>tạo thư mục truffle: <code>mkdir truffle</code>
</li></ol></li>
<li>
<ol start="2">
<li><code>cd truffle</code>
</li></ol></li>
<li>
<ol start="3">
<li><code>truffle init</code>
</li></ol></li>
</o
Tạo ethereum smart contract đơn giản trong mạng private
<ol start="1">
<li>tạo file genesis.json
</li>
</ol>
<p>
</p>
<pre>
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0
},
"difficulty": "400000",
"gasLimit": "2100000",
Tạo một ethereum chain mới
<ol start="1">
<li>Chạy geth thông tường
</li>
<li>Tạo sẵn 2 tài khoản
</li>
<li>Tắt geth đi
</li>
<li>Tạo một thư mục mới ví dụ <code>/Users/monkey/geth</code>
</li>
<li>Tạo 1 genesis block trong thư mục <code>/Users/monkey/geth</code> kiểu:
</li>
</ol>
<p>
</p>
<pre>
{
"config": {
"chainId": 15,
"homesteadBlock": 0
},
"difficulty": "
Tạo tài khoản ethereum cho dev
<ol start="1">
<li>Để tạo tài khoản ethereum qua HTTP bạn có thể dùng câu lệnh này:
</li>
</ol>
<p>
</p>
<pre>
curl --location --request POST 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc":"2.0",
"method":"personal_newAccount",
"params":["password"],
"id":1
}'
</pre>
<p>
</p>
<p>
Bắt đầu làm quen với ethereum từ đâu
<ol start="1">
<li>Pull <a href="https://github.com/ethereum/go-ethereum" target="_blank">geth</a> về và làm theo hướng dẫn tại README.md để build
</li>
<li>Chạy câu lệnh này sau khi build xong để enable http api:
</li>
</ol>
<code>./build/bin/geth --http --http.api personal,eth,net,web3</code>
<ol start="3">
<li>Gọi thử 1 vài <a href="https://documenter.ge