일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- 솔리디티
- 시퀄라이즈
- npm
- wsl
- 블록체인
- MariaDB
- 환경변수
- 전역설치
- 벨로포터
- 이더리움
- 리액트
- 머클트리
- 변수
- Sequelize
- 리액트를 다루는 기술
- 리눅스
- 라우터
- 일반유저
- 설치
- 우분투
- Docker
- node.js 교과서 따라하기
- 노드
- immer
- 머클루트
- 자바스크립트
- 쉘스크립트
- 깃허브
- wget
- centos
- Today
- Total
코드코코
[솔리디티][디앱] lottery - truffle를 활용한 스마트 컨트랙트 상호작용 본문
truffle를 활용한 스마트 컨트랙트 상호작용
contracts/Lottery.sol 작성
pragma solidity >=0.4.22 <0.9.0;
contract Lottery {
//주소를 오너로 설정
//public : 자동으로 getter를 만들어 준다, 스마트 컨트랙트 외부에서 바로 오너의 값을 알 수 있다.
address public owner;
//스마트 컨트랙트가 생성될 때,, 배포가 될때, 가장 먼저 실행되는 함수.
constructor() public {
//배포가 될 때, 보낸사람을 오너로 저장하겠다.
// msg.sender : 스마트 컨트랙트에서 사용하는 전역변수
owner = msg.sender;
}
function getSomeValue() public pure returns (uint256 value){
return 5;
}
}
truffle migrate
처음 마이그레이트 했을 때 가스양
truffle migrate --reset
- Lottey.sol 내용 추가 후 가스양
- ganache-cli 에 기록되는 내용과도 일치.
- 아래와 같은 경고문이 뜨기는 하나 결과 확인에는 문제가 없다.
truffle 에서도 확인
truffle console
- 블록체인으로 접근가능
- geth console을 통해 접근하는 것과 같음
- web3 object 사용가능
C:\Users\coco\Desktop\coco\studying_solidity\lotteryDapp>truffle console
truffle(development)>
truffle(development)> web3
- web3 객체확인
truffle(development)> web3
Web3Shim {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
[Symbol(kCapture)]: false
},
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: {
inputDefaultBlockNumberFormatter: [Function: inputDefaultBlockNumberFormatter],
inputBlockNumberFormatter: [Function: inputBlockNumberFormatter],
inputCallFormatter: [Function: inputCallFormatter],
inputTransactionFormatter: [Function: inputTransactionFormatter],
inputAddressFormatter: [Function: inputAddressFormatter],
inputPostFormatter: [Function: inputPostFormatter],
inputLogFormatter: [Function: inputLogFormatter],
inputSignFormatter: [Function: inputSignFormatter],
inputStorageKeysFormatter: [Function: inputStorageKeysFormatter],
outputProofFormatter: [Function: outputProofFormatter],
outputBigNumberFormatter: [Function: outputBigNumberFormatter],
outputTransactionFormatter: [Function: outputTransactionFormatter],
outputTransactionReceiptFormatter: [Function: outputTransactionReceiptFormatter],
outputBlockFormatter: [Function: outputBlockFormatter],
outputLogFormatter: [Function: outputLogFormatter],
outputPostFormatter: [Function: outputPostFormatter],
outputSyncingFormatter: [Function: outputSyncingFormatter]
},
utils: {
_fireError: [Function: _fireError],
_jsonInterfaceMethodToString: [Function: _jsonInterfaceMethodToString],
_flattenTypes: [Function: _flattenTypes],
randomHex: [Function: randomHex],
BN: [Function],
isBN: [Function: isBN],
isBigNumber: [Function: isBigNumber],
isHex: [Function: isHex],
isHexStrict: [Function: isHexStrict],
sha3: [Function],
sha3Raw: [Function: sha3Raw],
keccak256: [Function],
soliditySha3: [Function: soliditySha3],
soliditySha3Raw: [Function: soliditySha3Raw],
encodePacked: [Function: encodePacked],
isAddress: [Function: isAddress],
checkAddressChecksum: [Function: checkAddressChecksum],
toChecksumAddress: [Function: toChecksumAddress],
toHex: [Function: toHex],
toBN: [Function: toBN],
bytesToHex: [Function: bytesToHex],
hexToBytes: [Function: hexToBytes],
hexToNumberString: [Function: hexToNumberString],
hexToNumber: [Function: hexToNumber],
toDecimal: [Function: hexToNumber],
numberToHex: [Function: numberToHex],
fromDecimal: [Function: numberToHex],
hexToUtf8: [Function: hexToUtf8],
hexToString: [Function: hexToUtf8],
toUtf8: [Function: hexToUtf8],
stripHexPrefix: [Function: stripHexPrefix],
utf8ToHex: [Function: utf8ToHex],
stringToHex: [Function: utf8ToHex],
fromUtf8: [Function: utf8ToHex],
hexToAscii: [Function: hexToAscii],
toAscii: [Function: hexToAscii],
asciiToHex: [Function: asciiToHex],
fromAscii: [Function: asciiToHex],
unitMap: [Object],
toWei: [Function: toWei],
fromWei: [Function: fromWei],
padLeft: [Function: leftPad],
leftPad: [Function: leftPad],
padRight: [Function: rightPad],
rightPad: [Function: rightPad],
toTwosComplement: [Function: toTwosComplement],
isBloom: [Function: isBloom],
isUserEthereumAddressInBloom: [Function: isUserEthereumAddressInBloom],
isContractAddressInBloom: [Function: isContractAddressInBloom],
isTopic: [Function: isTopic],
isTopicInBloom: [Function: isTopicInBloom],
isInBloom: [Function: isInBloom],
compareBlockNumbers: [Function: compareBlockNumbers],
toNumber: [Function: toNumber]
},
Method: [Function: Method]
},
version: '1.5.3',
utils: {
_fireError: [Function: _fireError],
_jsonInterfaceMethodToString: [Function: _jsonInterfaceMethodToString],
_flattenTypes: [Function: _flattenTypes],
randomHex: [Function: randomHex],
BN: <ref *1> [Function: BN] {
BN: [Circular *1],
wordSize: 26,
isBN: [Function: isBN],
max: [Function: max],
min: [Function: min],
red: [Function: red],
_prime: [Function: prime],
mont: [Function: mont]
},
isBN: [Function: isBN],
isBigNumber: [Function: isBigNumber],
isHex: [Function: isHex],
isHexStrict: [Function: isHexStrict],
sha3: [Function: sha3] { _Hash: [Object] },
sha3Raw: [Function: sha3Raw],
keccak256: [Function: sha3] { _Hash: [Object] },
soliditySha3: [Function: soliditySha3],
soliditySha3Raw: [Function: soliditySha3Raw],
encodePacked: [Function: encodePacked],
isAddress: [Function: isAddress],
checkAddressChecksum: [Function: checkAddressChecksum],
toChecksumAddress: [Function: toChecksumAddress],
toHex: [Function: toHex],
toBN: [Function: toBN],
bytesToHex: [Function: bytesToHex],
hexToBytes: [Function: hexToBytes],
hexToNumberString: [Function: hexToNumberString],
hexToNumber: [Function: hexToNumber],
toDecimal: [Function: hexToNumber],
numberToHex: [Function: numberToHex],
fromDecimal: [Function: numberToHex],
hexToUtf8: [Function: hexToUtf8],
hexToString: [Function: hexToUtf8],
toUtf8: [Function: hexToUtf8],
stripHexPrefix: [Function: stripHexPrefix],
utf8ToHex: [Function: utf8ToHex],
stringToHex: [Function: utf8ToHex],
fromUtf8: [Function: utf8ToHex],
hexToAscii: [Function: hexToAscii],
toAscii: [Function: hexToAscii],
asciiToHex: [Function: asciiToHex],
fromAscii: [Function: asciiToHex],
unitMap: {
noether: '0',
wei: '1',
kwei: '1000',
Kwei: '1000',
babbage: '1000',
femtoether: '1000',
mwei: '1000000',
Mwei: '1000000',
lovelace: '1000000',
picoether: '1000000',
gwei: '1000000000',
Gwei: '1000000000',
shannon: '1000000000',
nanoether: '1000000000',
nano: '1000000000',
szabo: '1000000000000',
microether: '1000000000000',
micro: '1000000000000',
finney: '1000000000000000',
milliether: '1000000000000000',
milli: '1000000000000000',
ether: '1000000000000000000',
kether: '1000000000000000000000',
grand: '1000000000000000000000',
mether: '1000000000000000000000000',
gether: '1000000000000000000000000000',
tether: '1000000000000000000000000000000'
},
toWei: [Function: toWei],
fromWei: [Function: fromWei],
padLeft: [Function: leftPad],
leftPad: [Function: leftPad],
padRight: [Function: rightPad],
rightPad: [Function: rightPad],
toTwosComplement: [Function: toTwosComplement],
isBloom: [Function: isBloom],
isUserEthereumAddressInBloom: [Function: isUserEthereumAddressInBloom],
isContractAddressInBloom: [Function: isContractAddressInBloom],
isTopic: [Function: isTopic],
isTopicInBloom: [Function: isTopicInBloom],
isInBloom: [Function: isInBloom],
compareBlockNumbers: [Function: compareBlockNumbers],
toNumber: [Function: toNumber]
},
eth: <ref *2> Eth {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
handleRevert: [Getter/Setter],
defaultCommon: [Getter/Setter],
defaultHardfork: [Getter/Setter],
defaultChain: [Getter/Setter],
transactionPollingTimeout: [Getter/Setter],
transactionConfirmationBlocks: [Getter/Setter],
transactionBlockTimeout: [Getter/Setter],
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
maxListenersWarningThreshold: [Getter/Setter],
clearSubscriptions: [Function: bound ],
removeSubscriptionById: [Function: bound ],
net: Net {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function],
getId: [Function],
isListening: [Function],
getPeerCount: [Function],
getNetworkType: [Function: bound getNetworkType]
},
accounts: Accounts {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
_ethereumCall: [Object],
wallet: [Wallet]
},
personal: Personal {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function],
net: [Net],
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
getAccounts: [Function],
newAccount: [Function],
unlockAccount: [Function],
lockAccount: [Function],
importRawKey: [Function],
sendTransaction: [Function],
signTransaction: [Function],
sign: [Function],
ecRecover: [Function]
},
Contract: [Function: Contract] {
setProvider: [Function (anonymous)],
defaultAccount: null,
defaultBlock: 'latest',
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
handleRevert: false,
_requestManager: [RequestManager],
_ethAccounts: [Accounts],
currentProvider: [HttpProvider]
},
Iban: [class Iban],
abi: ABICoder {},
ens: ENS {
eth: [Circular *2],
_detectedAddress: null,
_lastSyncCheck: null,
registry: [Getter],
resolverMethodHandler: [Getter],
registryAddress: [Getter/Setter]
},
getNodeInfo: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'web3_clientVersion'
},
getProtocolVersion: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_protocolVersion'
},
getCoinbase: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_coinbase'
},
isMining: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_mining'
},
getHashrate: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_hashrate'
},
isSyncing: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_syncing'
},
getGasPrice: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_gasPrice'
},
getFeeHistory: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_feeHistory'
},
getAccounts: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_accounts'
},
getBlockNumber: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_blockNumber'
},
getBalance: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getBalance'
},
getStorageAt: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getStorageAt'
},
getCode: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getCode'
},
getBlock: [Function: send] {
method: [Method],
request: [Function: bound ],
call: [Function: blockCall]
},
getUncle: [Function: send] {
method: [Method],
request: [Function: bound ],
call: [Function: uncleCall]
},
getBlockTransactionCount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: [Function: getBlockTransactionCountCall]
},
getBlockUncleCount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: [Function: uncleCountCall]
},
getTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getTransactionByHash'
},
getTransactionFromBlock: [Function: send] {
method: [Method],
request: [Function: bound ],
call: [Function: transactionFromBlockCall]
},
getTransactionReceipt: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getTransactionReceipt'
},
getTransactionCount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getTransactionCount'
},
sendSignedTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_sendRawTransaction'
},
signTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_signTransaction'
},
sendTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_sendTransaction'
},
sign: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_sign'
},
call: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_call'
},
estimateGas: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_estimateGas'
},
submitWork: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_submitWork'
},
getWork: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getWork'
},
getPastLogs: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getLogs'
},
getChainId: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_chainId'
},
requestAccounts: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_requestAccounts'
},
getProof: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_getProof'
},
getPendingTransactions: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'eth_pendingTransactions'
},
subscribe: [Function (anonymous)]
},
shh: Shh {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
net: Net {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function],
getId: [Function],
isListening: [Function],
getPeerCount: [Function]
},
subscribe: [Function (anonymous)],
getVersion: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_version'
},
getInfo: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_info'
},
setMaxMessageSize: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_setMaxMessageSize'
},
setMinPoW: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_setMinPoW'
},
markTrustedPeer: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_markTrustedPeer'
},
newKeyPair: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_newKeyPair'
},
addPrivateKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_addPrivateKey'
},
deleteKeyPair: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_deleteKeyPair'
},
hasKeyPair: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_hasKeyPair'
},
getPublicKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_getPublicKey'
},
getPrivateKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_getPrivateKey'
},
newSymKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_newSymKey'
},
addSymKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_addSymKey'
},
generateSymKeyFromPassword: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_generateSymKeyFromPassword'
},
hasSymKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_hasSymKey'
},
getSymKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_getSymKey'
},
deleteSymKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_deleteSymKey'
},
newMessageFilter: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_newMessageFilter'
},
getFilterMessages: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_getFilterMessages'
},
deleteMessageFilter: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_deleteMessageFilter'
},
post: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_post'
},
unsubscribe: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'shh_unsubscribe'
}
},
bzz: Bzz {
givenProvider: null,
currentProvider: null,
isAvailable: [Function (anonymous)],
upload: [Function (anonymous)],
download: [Function (anonymous)]
},
networkType: 'ethereum'
}
- web3. 입력 후 tab 하면 사용할 수 있는 함수들을 확인할 수 있음.
truffle(development)> eth = web3.eth
- web3의 eth를 eth에 할당.
truffle(development)> eth = web3.eth
<ref *2> Eth {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
[Symbol(kCapture)]: false
},
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: {
inputDefaultBlockNumberFormatter: [Function: inputDefaultBlockNumberFormatter],
inputBlockNumberFormatter: [Function: inputBlockNumberFormatter],
inputCallFormatter: [Function: inputCallFormatter],
inputTransactionFormatter: [Function: inputTransactionFormatter],
inputAddressFormatter: [Function: inputAddressFormatter],
inputPostFormatter: [Function: inputPostFormatter],
inputLogFormatter: [Function: inputLogFormatter],
inputSignFormatter: [Function: inputSignFormatter],
inputStorageKeysFormatter: [Function: inputStorageKeysFormatter],
outputProofFormatter: [Function: outputProofFormatter],
outputBigNumberFormatter: [Function: outputBigNumberFormatter],
outputTransactionFormatter: [Function: outputTransactionFormatter],
outputTransactionReceiptFormatter: [Function: outputTransactionReceiptFormatter],
outputBlockFormatter: [Function: outputBlockFormatter],
outputLogFormatter: [Function: outputLogFormatter],
outputPostFormatter: [Function: outputPostFormatter],
outputSyncingFormatter: [Function: outputSyncingFormatter]
},
utils: {
_fireError: [Function: _fireError],
_jsonInterfaceMethodToString: [Function: _jsonInterfaceMethodToString],
_flattenTypes: [Function: _flattenTypes],
randomHex: [Function: randomHex],
BN: [Function],
isBN: [Function: isBN],
isBigNumber: [Function: isBigNumber],
isHex: [Function: isHex],
isHexStrict: [Function: isHexStrict],
sha3: [Function],
sha3Raw: [Function: sha3Raw],
keccak256: [Function],
soliditySha3: [Function: soliditySha3],
soliditySha3Raw: [Function: soliditySha3Raw],
encodePacked: [Function: encodePacked],
isAddress: [Function: isAddress],
checkAddressChecksum: [Function: checkAddressChecksum],
toChecksumAddress: [Function: toChecksumAddress],
toHex: [Function: toHex],
toBN: [Function: toBN],
bytesToHex: [Function: bytesToHex],
hexToBytes: [Function: hexToBytes],
hexToNumberString: [Function: hexToNumberString],
hexToNumber: [Function: hexToNumber],
toDecimal: [Function: hexToNumber],
numberToHex: [Function: numberToHex],
fromDecimal: [Function: numberToHex],
hexToUtf8: [Function: hexToUtf8],
hexToString: [Function: hexToUtf8],
toUtf8: [Function: hexToUtf8],
stripHexPrefix: [Function: stripHexPrefix],
utf8ToHex: [Function: utf8ToHex],
stringToHex: [Function: utf8ToHex],
fromUtf8: [Function: utf8ToHex],
hexToAscii: [Function: hexToAscii],
toAscii: [Function: hexToAscii],
asciiToHex: [Function: asciiToHex],
fromAscii: [Function: asciiToHex],
unitMap: [Object],
toWei: [Function: toWei],
fromWei: [Function: fromWei],
padLeft: [Function: leftPad],
leftPad: [Function: leftPad],
padRight: [Function: rightPad],
rightPad: [Function: rightPad],
toTwosComplement: [Function: toTwosComplement],
isBloom: [Function: isBloom],
isUserEthereumAddressInBloom: [Function: isUserEthereumAddressInBloom],
isContractAddressInBloom: [Function: isContractAddressInBloom],
isTopic: [Function: isTopic],
isTopicInBloom: [Function: isTopicInBloom],
isInBloom: [Function: isInBloom],
compareBlockNumbers: [Function: compareBlockNumbers],
toNumber: [Function: toNumber]
},
Method: [Function: Method]
},
handleRevert: [Getter/Setter],
defaultCommon: [Getter/Setter],
defaultHardfork: [Getter/Setter],
defaultChain: [Getter/Setter],
transactionPollingTimeout: [Getter/Setter],
transactionConfirmationBlocks: [Getter/Setter],
transactionBlockTimeout: [Getter/Setter],
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
maxListenersWarningThreshold: [Getter/Setter],
clearSubscriptions: [Function: bound ],
removeSubscriptionById: [Function: bound ],
net: Net {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
getId: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'net_version'
},
isListening: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'net_listening'
},
getPeerCount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'net_peerCount'
},
getNetworkType: [Function: bound getNetworkType]
},
accounts: <ref *1> Accounts {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
_ethereumCall: {
getNetworkId: [Function],
getChainId: [Function],
getGasPrice: [Function],
getTransactionCount: [Function],
getBlockByNumber: [Function]
},
wallet: Wallet {
_accounts: [Circular *1],
length: 0,
defaultKeyName: 'web3js_wallet'
}
},
personal: Personal {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
net: Net {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: null,
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function],
getId: [Function],
isListening: [Function],
getPeerCount: [Function]
},
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
getAccounts: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_listAccounts'
},
newAccount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_newAccount'
},
unlockAccount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_unlockAccount'
},
lockAccount: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_lockAccount'
},
importRawKey: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_importRawKey'
},
sendTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_sendTransaction'
},
signTransaction: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_signTransaction'
},
sign: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_sign'
},
ecRecover: [Function: send] {
method: [Method],
request: [Function: bound ],
call: 'personal_ecRecover'
}
},
Contract: [Function: Contract] {
setProvider: [Function (anonymous)],
defaultAccount: null,
defaultBlock: 'latest',
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
handleRevert: false,
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
_ethAccounts: <ref *1> Accounts {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
_ethereumCall: [Object],
wallet: [Wallet]
},
currentProvider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
}
},
Iban: [class Iban],
abi: ABICoder {},
ens: ENS {
eth: [Circular *2],
_detectedAddress: null,
_lastSyncCheck: null,
registry: [Getter],
resolverMethodHandler: [Getter],
registryAddress: [Getter/Setter]
},
getNodeInfo: [Function: send] {
method: Method {
name: 'getNodeInfo',
call: 'web3_clientVersion',
params: 0,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'web3_clientVersion'
},
getProtocolVersion: [Function: send] {
method: Method {
name: 'getProtocolVersion',
call: 'eth_protocolVersion',
params: 0,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_protocolVersion'
},
getCoinbase: [Function: send] {
method: Method {
name: 'getCoinbase',
call: 'eth_coinbase',
params: 0,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_coinbase'
},
isMining: [Function: send] {
method: Method {
name: 'isMining',
call: 'eth_mining',
params: 0,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_mining'
},
getHashrate: [Function: send] {
method: Method {
name: 'getHashrate',
call: 'eth_hashrate',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_hashrate'
},
isSyncing: [Function: send] {
method: Method {
name: 'isSyncing',
call: 'eth_syncing',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: outputSyncingFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_syncing'
},
getGasPrice: [Function: send] {
method: Method {
name: 'getGasPrice',
call: 'eth_gasPrice',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: outputBigNumberFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_gasPrice'
},
getFeeHistory: [Function: send] {
method: Method {
name: 'getFeeHistory',
call: 'eth_feeHistory',
params: 3,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_feeHistory'
},
getAccounts: [Function: send] {
method: Method {
name: 'getAccounts',
call: 'eth_accounts',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: toChecksumAddress],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_accounts'
},
getBlockNumber: [Function: send] {
method: Method {
name: 'getBlockNumber',
call: 'eth_blockNumber',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_blockNumber'
},
getBalance: [Function: send] {
method: Method {
name: 'getBalance',
call: 'eth_getBalance',
params: 2,
inputFormatter: [Array],
outputFormatter: [Function: outputBigNumberFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getBalance'
},
getStorageAt: [Function: send] {
method: Method {
name: 'getStorageAt',
call: 'eth_getStorageAt',
params: 3,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getStorageAt'
},
getCode: [Function: send] {
method: Method {
name: 'getCode',
call: 'eth_getCode',
params: 2,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getCode'
},
getBlock: [Function: send] {
method: Method {
name: 'getBlock',
call: [Function: blockCall],
params: 2,
inputFormatter: [Array],
outputFormatter: [Function (anonymous)],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: [Function: blockCall]
},
getUncle: [Function: send] {
method: Method {
name: 'getUncle',
call: [Function: uncleCall],
params: 2,
inputFormatter: [Array],
outputFormatter: [Function: outputBlockFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: [Function: uncleCall]
},
getBlockTransactionCount: [Function: send] {
method: Method {
name: 'getBlockTransactionCount',
call: [Function: getBlockTransactionCountCall],
params: 1,
inputFormatter: [Array],
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: [Function: getBlockTransactionCountCall]
},
getBlockUncleCount: [Function: send] {
method: Method {
name: 'getBlockUncleCount',
call: [Function: uncleCountCall],
params: 1,
inputFormatter: [Array],
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: [Function: uncleCountCall]
},
getTransaction: [Function: send] {
method: Method {
name: 'getTransaction',
call: 'eth_getTransactionByHash',
params: 1,
inputFormatter: [Array],
outputFormatter: [Function (anonymous)],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getTransactionByHash'
},
getTransactionFromBlock: [Function: send] {
method: Method {
name: 'getTransactionFromBlock',
call: [Function: transactionFromBlockCall],
params: 2,
inputFormatter: [Array],
outputFormatter: [Function: outputTransactionFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: [Function: transactionFromBlockCall]
},
getTransactionReceipt: [Function: send] {
method: Method {
name: 'getTransactionReceipt',
call: 'eth_getTransactionReceipt',
params: 1,
inputFormatter: [Array],
outputFormatter: [Function (anonymous)],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getTransactionReceipt'
},
getTransactionCount: [Function: send] {
method: Method {
name: 'getTransactionCount',
call: 'eth_getTransactionCount',
params: 2,
inputFormatter: [Array],
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getTransactionCount'
},
sendSignedTransaction: [Function: send] {
method: Method {
name: 'sendSignedTransaction',
call: 'eth_sendRawTransaction',
params: 1,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: ABICoder {},
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_sendRawTransaction'
},
signTransaction: [Function: send] {
method: Method {
name: 'signTransaction',
call: 'eth_signTransaction',
params: 1,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_signTransaction'
},
sendTransaction: [Function: send] {
method: Method {
name: 'sendTransaction',
call: 'eth_sendTransaction',
params: 1,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: ABICoder {},
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_sendTransaction'
},
sign: [Function: send] {
method: Method {
name: 'sign',
call: 'eth_sign',
params: 2,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: [Function: transformPayload],
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_sign'
},
call: [Function: send] {
method: Method {
name: 'call',
call: 'eth_call',
params: 2,
inputFormatter: [Array],
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: ABICoder {},
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_call'
},
estimateGas: [Function: send] {
method: Method {
name: 'estimateGas',
call: 'eth_estimateGas',
params: 1,
inputFormatter: [Array],
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_estimateGas'
},
submitWork: [Function: send] {
method: Method {
name: 'submitWork',
call: 'eth_submitWork',
params: 3,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_submitWork'
},
getWork: [Function: send] {
method: Method {
name: 'getWork',
call: 'eth_getWork',
params: 0,
inputFormatter: undefined,
outputFormatter: undefined,
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getWork'
},
getPastLogs: [Function: send] {
method: Method {
name: 'getPastLogs',
call: 'eth_getLogs',
params: 1,
inputFormatter: [Array],
outputFormatter: [Function: outputLogFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getLogs'
},
getChainId: [Function: send] {
method: Method {
name: 'getChainId',
call: 'eth_chainId',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: hexToNumber],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_chainId'
},
requestAccounts: [Function: send] {
method: Method {
name: 'requestAccounts',
call: 'eth_requestAccounts',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: toChecksumAddress],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_requestAccounts'
},
getProof: [Function: send] {
method: Method {
name: 'getProof',
call: 'eth_getProof',
params: 3,
inputFormatter: [Array],
outputFormatter: [Function: outputProofFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_getProof'
},
getPendingTransactions: [Function: send] {
method: Method {
name: 'getPendingTransactions',
call: 'eth_pendingTransactions',
params: 0,
inputFormatter: undefined,
outputFormatter: [Function: outputTransactionFormatter],
transformPayload: undefined,
extraFormatters: undefined,
abiCoder: undefined,
requestManager: [RequestManager],
accounts: [Accounts],
defaultBlock: 'latest',
defaultAccount: null,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 750,
defaultCommon: undefined,
defaultChain: undefined,
defaultHardfork: undefined,
handleRevert: false
},
request: [Function: bound ],
call: 'eth_pendingTransactions'
},
subscribe: [Function (anonymous)]
}
- eth.get 입력후 tab 하면 사용할 수 있는 함수들을 확인 할 수 있음.
truffle(development)> eth.getAccounts()
-ganache-cli 시작시의 주소와 일치
truffle(development)> eth.getBalance('0x84F43c88Dc56510D043D5EE922D57549959c4C3C')
- 두번째 계정의 잔액이 확인됨
truffle(development)> eth.getBalance('0x84F43c88Dc56510D043D5EE922D57549959c4C3C')
'100000000000000000000'
truffle를 활용한 스마트 컨트랙트 상호작용
ruffle(development)> Lottery. 입력 후 tab 하면 사용할 수 있는 변수들 확인 가능.
truffle(development)> Lottery.address
truffle(development)> Lottery.address
'0xED43Bcf94743F0248d896D52A9693F775FE3642C'
- 위의 주소 정보를 가져오는 곳 : buid/contracts/Lottery.json에서 확인 할 수 있음.
truffle(development)> Lottery.deployed().then(function(instance){lt=instance})
- lt 변수에 할당
truffle(development)> lt
truffle(development)> lt
TruffleContract {
constructor: [Function: TruffleContract] {
_constructorMethods: {
configureNetwork: [Function: configureNetwork],
setProvider: [Function: setProvider],
new: [Function: new],
at: [AsyncFunction: at],
deployed: [AsyncFunction: deployed],
defaults: [Function: defaults],
hasNetwork: [Function: hasNetwork],
isDeployed: [Function: isDeployed],
detectNetwork: [AsyncFunction: detectNetwork],
setNetwork: [Function: setNetwork],
setNetworkType: [Function: setNetworkType],
setWallet: [Function: setWallet],
resetAddress: [Function: resetAddress],
link: [Function: link],
clone: [Function: clone],
addProp: [Function: addProp],
toJSON: [Function: toJSON],
decodeLogs: [Function: decodeLogs]
},
_properties: {
contract_name: [Object],
contractName: [Object],
gasMultiplier: [Object],
timeoutBlocks: [Object],
autoGas: [Object],
numberFormat: [Object],
abi: [Object],
metadata: [Function: metadata],
network: [Function: network],
networks: [Function: networks],
address: [Object],
transactionHash: [Object],
links: [Function: links],
events: [Function: events],
binary: [Function: binary],
deployedBinary: [Function: deployedBinary],
unlinked_binary: [Object],
bytecode: [Object],
deployedBytecode: [Object],
sourceMap: [Object],
deployedSourceMap: [Object],
source: [Object],
sourcePath: [Object],
legacyAST: [Object],
ast: [Object],
compiler: [Object],
schema_version: [Function: schema_version],
schemaVersion: [Function: schemaVersion],
updated_at: [Function: updated_at],
updatedAt: [Function: updatedAt],
userdoc: [Function: userdoc],
devdoc: [Function: devdoc],
networkType: [Object],
immutableReferences: [Object],
generatedSources: [Object],
deployedGeneratedSources: [Object],
db: [Object]
},
_property_values: {},
_json: {
contractName: 'Lottery',
abi: [Array],
metadata: '{"compiler":{"version":"0.8.11+commit.d7f03943"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getSomeValue","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"project:/contracts/Lottery.sol":"Lottery"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"project:/contracts/Lottery.sol":{"keccak256":"0x32a618b7d01a651fa8bf8a2f5ee76dfe9cb1ee7be3d1749339c743d76188d595","urls":["bzz-raw://100e2b597949b8a21b67ef233ec781f96b6dd7cbb43aabafd49b01f602067443","dweb:/ipfs/QmNs6oPix8Lokk9TLQKaYDurbMHHEbpPr2GV9P2WRSnDsT"]}},"version":1}',
bytecode: '0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061016a806100606000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063a40674b714610059575b600080fd5b610043610077565b60405161005091906100e5565b60405180910390f35b61006161009b565b60405161006e9190610119565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006005905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100cf826100a4565b9050919050565b6100df816100c4565b82525050565b60006020820190506100fa60008301846100d6565b92915050565b6000819050919050565b61011381610100565b82525050565b600060208201905061012e600083018461010a565b9291505056fea2646970667358221220d1996e99d89587abafcef6e1a6d7ae6355a70abb45e155e9c119eb83b1e961ab64736f6c634300080b0033',
deployedBytecode: '0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063a40674b714610059575b600080fd5b610043610077565b60405161005091906100e5565b60405180910390f35b61006161009b565b60405161006e9190610119565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006005905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100cf826100a4565b9050919050565b6100df816100c4565b82525050565b60006020820190506100fa60008301846100d6565b92915050565b6000819050919050565b61011381610100565b82525050565b600060208201905061012e600083018461010a565b9291505056fea2646970667358221220d1996e99d89587abafcef6e1a6d7ae6355a70abb45e155e9c119eb83b1e961ab64736f6c634300080b0033',
immutableReferences: {},
generatedSources: [],
deployedGeneratedSources: [Array],
sourceMap: '36:598:0:-:0;;;346:199;;;;;;;;;;382:10;374:5;;:18;;;;;;;;;;;;;;;;;;36:598;;;;;;',
deployedSourceMap: '36:598:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;221:20;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;551:80;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;221:20;;;;;;;;;;;;:::o;551:80::-;596:13;624:1;617:8;;551:80;:::o;7:126:2:-;44:7;84:42;77:5;73:54;62:65;;7:126;;;:::o;139:96::-;176:7;205:24;223:5;205:24;:::i;:::-;194:35;;139:96;;;:::o;241:118::-;328:24;346:5;328:24;:::i;:::-;323:3;316:37;241:118;;:::o;365:222::-;458:4;496:2;485:9;481:18;473:26;;509:71;577:1;566:9;562:17;553:6;509:71;:::i;:::-;365:222;;;;:::o;593:77::-;630:7;659:5;648:16;;593:77;;;:::o;676:118::-;763:24;781:5;763:24;:::i;:::-;758:3;751:37;676:118;;:::o;800:222::-;893:4;931:2;920:9;916:18;908:26;;944:71;1012:1;1001:9;997:17;988:6;944:71;:::i;:::-;800:222;;;;:::o',
source: 'pragma solidity >=0.4.22 <0.9.0;\r\n' +
'\r\n' +
'contract Lottery {\r\n' +
' //주소를 오너로 설정\r\n' +
' //public : 자동으로 getter를 만들어 준다, 스마트 컨트랙트 외부에서 바로 오너의 값을 알 수 있다.\r\n' +
' address public owner;\r\n' +
'\r\n' +
'//스마트 컨트랙트가 생성될 때,, 배포가 될때, 가장 먼저 실행되는 함수.\r\n' +
' constructor() public {\r\n' +
' owner = msg.sender;\r\n' +
' // 배포가 될 때, 보낸사람을 오너로 저장하겠다.\r\n' +
' // msg.sender : 스마트 컨트랙트에서 사용하는 전역변수 \r\n' +
' }\r\n' +
'\r\n' +
' function getSomeValue() public pure returns (uint256 value){\r\n' +
' return 5;\r\n' +
' }\r\n' +
'}',
sourcePath: 'C:\\Users\\coco\\Desktop\\coco\\studying_solidity\\lotteryDapp\\contracts\\Lottery.sol',
ast: [Object],
legacyAST: [Object],
compiler: [Object],
networks: [Object],
schemaVersion: '3.4.4',
updatedAt: '2022-02-13T10:40:52.826Z',
networkType: 'ethereum',
devdoc: [Object],
userdoc: [Object],
db: undefined
},
configureNetwork: [Function: bound configureNetwork],
setProvider: [Function: bound setProvider],
new: [Function: bound new] {
estimateGas: [Function: bound estimateDeployment],
request: [Function: bound requestDeployment]
},
at: [Function: bound at] AsyncFunction,
deployed: [Function: bound deployed] AsyncFunction,
defaults: [Function: bound defaults],
hasNetwork: [Function: bound hasNetwork],
isDeployed: [Function: bound isDeployed],
detectNetwork: [Function: bound detectNetwork] AsyncFunction,
setNetwork: [Function: bound setNetwork],
setNetworkType: [Function: bound setNetworkType],
setWallet: [Function: bound setWallet],
resetAddress: [Function: bound resetAddress],
link: [Function: bound link],
clone: [Function: bound clone],
addProp: [Function: bound addProp],
toJSON: [Function: bound toJSON],
decodeLogs: [Function: bound decodeLogs],
enums: {},
class_defaults: { from: '0xF76c9B7012c0A3870801eaAddB93B6352c8893DB' },
interfaceAdapter: Web3InterfaceAdapter { web3: [Web3Shim] },
web3: Web3Shim {
currentProvider: [Getter/Setter],
_requestManager: [RequestManager],
givenProvider: null,
providers: [Object],
_provider: [HttpProvider],
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function],
version: '1.5.3',
utils: [Object],
eth: [Eth],
shh: [Shh],
bzz: [Bzz],
networkType: 'ethereum'
},
currentProvider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
network_id: '1644748750946',
disableConfirmationListener: undefined,
ens: { enabled: false, registryAddress: null }
},
methods: {
'owner()': [Function (anonymous)] {
call: [Function (anonymous)],
sendTransaction: [Function (anonymous)],
estimateGas: [Function (anonymous)],
request: [Function (anonymous)]
},
'getSomeValue()': [Function (anonymous)] {
call: [Function (anonymous)],
sendTransaction: [Function (anonymous)],
estimateGas: [Function (anonymous)],
request: [Function (anonymous)]
}
},
abi: [
{
inputs: [],
stateMutability: 'nonpayable',
type: 'constructor',
constant: undefined,
payable: undefined
},
{
inputs: [],
name: 'owner',
outputs: [Array],
stateMutability: 'view',
type: 'function',
constant: true,
payable: undefined,
signature: '0x8da5cb5b'
},
{
inputs: [],
name: 'getSomeValue',
outputs: [Array],
stateMutability: 'pure',
type: 'function',
constant: true,
payable: undefined,
signature: '0xa40674b7'
}
],
address: '0xED43Bcf94743F0248d896D52A9693F775FE3642C',
transactionHash: undefined,
contract: Contract {
setProvider: [Function (anonymous)],
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: true,
host: 'http://127.0.0.1:8545',
httpAgent: [Agent],
send: [Function (anonymous)],
_alreadyWrapped: true
},
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
clearSubscriptions: [Function (anonymous)],
options: { address: [Getter/Setter], jsonInterface: [Getter/Setter] },
handleRevert: [Getter/Setter],
defaultCommon: [Getter/Setter],
defaultHardfork: [Getter/Setter],
defaultChain: [Getter/Setter],
transactionPollingTimeout: [Getter/Setter],
transactionConfirmationBlocks: [Getter/Setter],
transactionBlockTimeout: [Getter/Setter],
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
methods: {
owner: [Function: bound _createTxObject],
'0x8da5cb5b': [Function: bound _createTxObject],
'owner()': [Function: bound _createTxObject],
getSomeValue: [Function: bound _createTxObject],
'0xa40674b7': [Function: bound _createTxObject],
'getSomeValue()': [Function: bound _createTxObject]
},
events: { allEvents: [Function: bound ] },
_address: '0xED43Bcf94743F0248d896D52A9693F775FE3642C',
_jsonInterface: [ [Object], [Object], [Object] ]
},
owner: [Function (anonymous)] {
call: [Function (anonymous)],
sendTransaction: [Function (anonymous)],
estimateGas: [Function (anonymous)],
request: [Function (anonymous)]
},
getSomeValue: [Function (anonymous)] {
call: [Function (anonymous)],
sendTransaction: [Function (anonymous)],
estimateGas: [Function (anonymous)],
request: [Function (anonymous)]
},
sendTransaction: [Function (anonymous)],
send: [Function (anonymous)],
allEvents: [Function (anonymous)],
getPastEvents: [Function (anonymous)]
}
truffle(development)> lt. 작성 후 tab tab
사용할 수 있는 변수들을 확인할 수 있음.
truffle(development)> lt.abi
-abi
: 일반적인 랭귀지에서 볼 수 있는 인터페이스.
: 외부에서 접근할 때, 이 스마트 컨트랙트에서는 어떤 함수에 접근할 수 있고, 해당 함수의 파라미터는 무엇인지, 리턴 값은 무엇인지 확인할 수 있음.
truffle(development)> lt.owner()
- getter function 이므로 괄호를 사용해야 값을 볼 수 있음.
truffle(development)> eth.getAccounts()
- 첫 번째 계정을 오너로
truffle(development)> lt.getSomeValue()
- BN : big number
- 이더리움에서는 다루는 숫자가 엄청 크기 때문에, BN를 사용하여 숫자처리를 많이함.
- BN 라이브러리를 사용하거나, 파라미터로 넣어줄때는 스트링값으로 넣어주면 geth단에서 스트링을 BN로 넘겨 사용할 수 있음.
truffle(development)> lt.getSomeValue()
BN { negative: 0, words: [ 5, <1 empty item> ], length: 1, red: null }
'블록체인 > 솔리디티' 카테고리의 다른 글
[솔리디티][디앱] lottery - Dapp 서비스 설계 및 Lottery 규칙 (0) | 2022.02.13 |
---|---|
[솔리디티][디앱] lottery - truffle을 활용한 테스트 (0) | 2022.02.13 |
[솔리디티][디앱] lottery - 환경설정 (0) | 2022.02.13 |
[솔리디티] 데이터 타입, 변수, 함수 (0) | 2022.02.12 |
[솔리디티] [이더리움] 디앱의 핵심 기능 및 관련 주요개념 (0) | 2022.02.10 |