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
//SPDX-License-Identifier:MIT | |
pragma solidity 0.7.6; | |
interface ERC721 /* is ERC165 */ { | |
/// @dev This emits when ownership of any NFT changes by any mechanism. | |
/// This event emits when NFTs are created (`from` == 0) and destroyed | |
/// (`to` == 0). Exception: during contract creation, any number of NFTs | |
/// may be created and assigned without emitting Transfer. At the time of | |
/// any transfer, the approved address for that NFT (if any) is reset to none. |
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
import hashlib | |
# block info | |
v = "20000000" | |
pHash = "0000000000000000001113e97e93bd818554382f16d089a81371c6873a0b92b6" | |
mroot = "f765e73e351ef8ed6c0f09c2b2c48b87fee449ac41582193f757f0327a1d65e3" | |
ts = 1558398995 # convert human readable time to timestamp in https://www.epochconverter.com/ | |
bits = 388627269 | |
n = 3231819810 |
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 ethTx = require('ethereumjs-tx').Transaction; | |
const Web3 = require('web3'); | |
const { GANACHE_WS, GANACHE_NETWORK_ID } = require('./eth.config'); | |
const Common = require('ethereumjs-common').default; | |
let NETWORK_ID; | |
let PROVIDER; | |
if (process.env.NODE_ENV === "development") { | |
//PROVIDER = GANACHE_WS; | |
//NETWORK_ID = GANACHE_NETWORK_ID; |
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 ethTx = require('@ethereumjs/tx').Transaction; | |
const Common = require('@ethereumjs/common').default; | |
const {bufferToHex} = require('ethereumjs-util'); | |
const Web3 = require('web3'); | |
const { GANACHE_WS, GANACHE_NETWORK_ID } = require('./eth.config'); | |
let NETWORK_ID; | |
let PROVIDER; | |
if (process.env.NODE_ENV === "development") { | |
PROVIDER = GANACHE_WS; |
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 Web3 = require('web3'); | |
const HDWalletProvider = require("@truffle/hdwallet-provider"); | |
const fs = require('fs'); | |
const key = fs.readFileSync("private.key").toString().trim(); | |
const privateKeys = [key]; | |
//const mnemonic = "crash ... twice"; | |
// 지갑을 쓰는 것과 동일 | |
const provider = new HDWalletProvider({ |
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
//SPDX-License-Identifier:MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
contract TokenRecipient { | |
address owner; | |
event ReceivedEther(address indexed sender, uint256 value); |
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
//SPDX-License-Identifier:MIT | |
pragma solidity ^0.8.0; | |
contract Greeter { | |
struct Member { | |
uint256 id; | |
string name; | |
} |
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
// 모두 동일한 해시 | |
console.log(web3.utils.keccak256("Kate")); | |
console.log(web3.utils.sha3("Kate")); | |
console.log(web3.utils.soliditySha3("Kate")); | |
console.log(ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Kate"))); | |
// 솔리디티 | |
// 0.5.0 이후부터는 sha3()가 없어짐 | |
keccak256("Kate"); |
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
// SPDX-License-Identifier: MIT | |
//pragma solidity ^0.8.0; | |
pragma solidity ^0.6.0; | |
contract MyContract { | |
function f() public pure { | |
int8 x = -2**7; | |
assert(x == -x); | |
} |
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
//SPDX-License-Identifier:MIT | |
pragma solidity ^0.8.0; | |
contract MyContract { | |
struct Member { | |
uint256 age; | |
string name; | |
} |
OlderNewer