การสร้าง Wallet
การสร้าง Wallet Address + Private key

ก่อนใช้งาน iWallet
เราจะต้องสร้าง Wallet (Address + Private Key) เพื่อเอาไว้ใช้สำหรับเก็บ/เข้าถึง Token บน Blockchain ขึ้นมาก่อน โดยให้ Create Directory เปล่า ๆ ขึ้นมาดังนี้
$ mkdir iwallet
$ cd iwallet
จากนั้นให้ Run Command wallet-gen
เพื่อสร้าง Wallet File + Configuration File ดังต่อไปนี้
$ docker run --rm -v $PWD:/iwallet ghcr.io/jittagornp/iwallet wallet-gen -p <YOUR_WALLET_PASSWORD> -n <NETWORK>
หมายเหตุ
เวอร์ชัน Free เปลี่ยน Repository จาก
ghcr.io/jittagornp/iwallet
เป็นjittagornp/iwallet
คำอธิบาย
-p
<YOUR_WALLET_PASSWORD> คือ รหัสผ่านที่ใช้สำหรับเข้าถึง Wallet นี้ (อย่าลืมตั้งให้ปลอดภัย)-n
<NETWORK> คือ Blockchain Network ที่เราจะใช้กับ Wallet นี้
-n
ตอนนี้ระบบรองรับ 3 Networks ได้แก่
BSC_MAINNET (Default) - Binance Smart Chain
POLYGON_ MAINNET - Polygon (PoS) Chain
BITKUB_ MAINNET - Bitkub Chain
ตัวอย่าง
แบบไม่กำหนด Network (Default Network เป็น BSC)
$ docker run --rm -v $PWD:/iwallet ghcr.io/jittagornp/iwallet wallet-gen -p 123456
Generating wallet and config...
Output wallet file "0x144625b77d8e2d09a11c8a4729acc9bab5c89dc9.wallet.json"
Output config file "0x144625b77d8e2d09a11c8a4729acc9bab5c89dc9.config.json"
$ ls -l
-rw------- 1 root root 626 Jul 26 15:19 0x144625b77d8e2d09a11c8a4729acc9bab5c89dc9.config.json
-r-------- 1 root root 491 Jul 26 15:19 0x144625b77d8e2d09a11c8a4729acc9bab5c89dc9.wallet.json
$ cat 0x144625b77d8e2d09a11c8a4729acc9bab5c89dc9.config.json
{
"walletFile" : "0x779fba7799adf15c8476bdbf4dac3770945a2cd4.wallet.json",
"walletPassword" : "123456",
"network" : "BSC_MAINNET",
"tokenA" : "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //BTCB
"tokenB" : "0xe9e7cea3dedca5984780bafc599bd69add087d56", //BUSD
"minimumGasBalance" : 0.005,
"fillGasTokenBAmount" : 3,
"swapRouter" : "0x10ED43C718714eb63d5aA57B78B54704E256024E", //PancakeSwap Router
"gasSwapRouter" : "0x10ED43C718714eb63d5aA57B78B54704E256024E", //PancakeSwap Router
"defaultSwapSlippage" : 0.5,
"defaultSwapDeadlineMinutes" : 10,
"tokenAutoApproveMultiplier" : 3.0,
"differenceAtLeastPercent" : 9.0,
"swapPercent" : 50.0,
"swapAtLeastValue" : 1,
"recipientWhitelist" : []
}
แบบกำหนด Network
$ docker run --rm -v $PWD:/iwallet ghcr.io/jittagornp/iwallet wallet-gen -p 123456 -n POLYGON_MAINNET
Generating wallet and config...
Output wallet file "0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.wallet.json"
Output config file "0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json"
$ cat 0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json
{
"walletFile" : "0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.wallet.json",
"walletPassword" : "123456",
"network" : "POLYGON_MAINNET",
"tokenA" : "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", //WMATIC
"tokenB" : "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", //USDC
"minimumGasBalance" : 0.005,
"fillGasTokenBAmount" : 3,
"swapRouter" : "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff", //Quickswap Router
"gasSwapRouter" : "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff", //Quickswap Router
"defaultSwapSlippage" : 0.5,
"defaultSwapDeadlineMinutes" : 10,
"tokenAutoApproveMultiplier" : 3.0,
"differenceAtLeastPercent" : 9.0,
"swapPercent" : 50.0,
"swapAtLeastValue" : 1,
"recipientWhitelist" : []
}
ระบบจะสร้างไฟล์ขึ้นมาได้ 2 ไฟล์ ได้แก่
Wallet File (.wallet.json) และ
Configuration File (.config.json) ใช้คู่กันกับ Wallet File
คำแนะนำ
อย่าลืม Backup Wallet File (.wallet.json) และ Configuration File (.config.json) ก่อนเริ่มใช้งานจริง
สำหรับ Configuration File (.config.json) เพื่อให้จำได้ง่าย อาจจะเปลี่ยนชื่อไฟล์จาก
0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json
ไปเป็นคู่ Token ที่จะใช้ก็ได้ เช่น
WMATIC_USDC_0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json
โดยใช้คำสั่ง
$ mv 0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json WMATIC_USDC_0x7fe5999fd513deae43d19dd0ab3cce8491ed6440.config.json
เป็นต้น
Configuration File อื่น ๆ ก็เช่นกัน
Last updated
Was this helpful?