This file contains 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
/** | |
* "@ethereumjs/tx": "^5.1.0", | |
* "@ethereumjs/util": "^9.0.1", | |
*/ | |
const { hexToBytes, bytesToHex } = require('@ethereumjs/util'); | |
const { ecrecover } = require('@ethereumjs/util'); | |
const { TransactionFactory } = require('@ethereumjs/tx'); | |
// https://etherscan.io/tx/0x5ad6831e50960ffda005fc59c1970ce8fafaa3cff8b9d6695cd1f65cb3c2acf9 |
This file contains 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
mapping 타입의 스토리지 해시 | |
저장되는 슬롯 번호 = keccak256(key || slot No.) | |
(예) | |
mapping(address => uint256) public m; | |
m[0x5B38Da6a701c568545dCfcB03FcB875f56beddC4] = 100; | |
슬롯번호는 | |
ethers.utils.keccak256("0x0000000000000000000000005B38Da6a701c568545dCfcB03FcB875f56beddC40000000000000000000000000000000000000000000000000000000000000000") |
This file contains 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
const abi = [ | |
"function get()", | |
"function set(uint256)" | |
]; | |
const interface = new ethers.utils.Interface(abi); | |
const calldata = interface.encodeFunctionData("set", [10]); | |
const from = "0xAd36301E8C66bB2Af80c63DA5a99BdF2c202c9a1"; | |
const to = "0x35F61C2b5815426cBA1b1B0385624118391B9C49"; |
This file contains 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
const prefix = "0xff"; | |
const address = "0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2"; | |
const salt = "Kate"; | |
const bytecode = "0x608060405260405161031d38038061031d833981810160405281019061002591906100cf565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100fc565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061009c82610071565b9050919050565b6100ac81610091565b81146100b757600080fd5b50565b6000815190506100c9816100a3565b92915050565b6000602082840312156100e5576100e461006c565b5b60006100f3848285016100ba565b91505092915050565b6102128061010b6000396000f3fe60806040526004361061002d5760003560e01c80638da5cb5b146100e0578063928012301461010b57610034565b3661003457005b34801561004057600080fd5b506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006127109050600080368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050 |
This file contains 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
const abi = [ | |
"function withdraw(address,uint256)" | |
]; | |
const iface = new ethers.utils.Interface(abi); | |
const calldata = iface.encodeFunctionData("withdraw", ["0x0000000000000000000000000000000000000000", ethers.BigNumber.from("10000000000000000")]); | |
console.log(calldata) | |
// Solidity | |
address _addr = 0x0000000000000000000000000000000000000000; | |
uint256 _val = 100; |
This file contains 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
const ethers = require("ethers"); | |
const jsonRpcProvider = new ethers.providers.JsonRpcProvider("https://goerli.infura.io/v3/"); | |
const privateKey = "5de6..."; | |
const to = "0x547d73355A851079E0395aDB2C647821b74C7eAF"; // Kate | |
const value = ethers.utils.parseEther("0.003"); | |
const gasLimit = 21000 | |
const maxFeePerGas = 20000000000 //20 gwei | |
const maxPriorityFeePerGas = 1000000000 //1 gwei |
This file contains 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
FROM ubuntu:focal | |
ENV HOME /root | |
ENV TZ Asia/Seoul | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections | |
RUN apt-get update \ | |
&& apt-get install openjdk-11-jdk -y \ |
This file contains 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
// ether를 wei 단위로 변경하기 | |
ethers.utils.parseEther("0.000001").toString(); | |
// 임의의 단위를 wei 단위로 변경하기 | |
ethers.utils.parseUnits("0.000001", "ether").toString(); | |
ethers.utils.parseUnits("1", "gwei").toString(); | |
ethers.utils.parseUnits("1", "mwei").toString(); | |
ethers.utils.parseUnits("1", "kwei").toString(); | |
// wei를 임의의 단위로 변경하기 |
This file contains 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
// 엉클 블록 포함 | |
https://etherscan.io/block/15489644 | |
// 트랜잭션이 하나도 없는 블록 | |
https://etherscan.io/block/12987627 | |
https://www.blockchain.com/btc/block/492972 | |
// 트랜잭션이 하나 뿐인 블록 | |
https://etherscan.io/block/14401440 |
This file contains 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
const timer = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
(async () => { | |
await timer(5000); | |
})(); | |
NewerOlder