Git Product home page Git Product logo

ethereum's Introduction

Ethreum, Solidity

image

  • Ethereum version
    • 0.4.25
    • 0.5.1
    • 0.6.10(final exam)
      • 컨트랙 결합 사용시 0.5대에서는 작동 안되어서 0.6.10으로 버전 upgrade를 진행하였다.

강의자료


참고사항

  • gas를 줄일수 있으면 줄이는 것이 좋다!
  • 반복문이나 연산을 많이하면 gas 비용이 많이 발생
  • 오류의 절반은 버전 문제인 경우가 많다..

자주 사용하는 명령어

geth 접속하기 (cmd)

_gethNow.bat

geth 콘솔 열기(새로운 cmd), geth 접속한 상태로 해야함

geth attach http://localhost:8445

계정 확인하기 (geth 콘솔)

eth.accounts

계정 확인하기 (jupyter notebook)

!geth -exec eth.accounts attach http://localhost:8445

잔액 확인하기 (geth 콘솔)

eth.getBalance(eth.accounts[0]);

충전하기 (mining) (geth 콘솔)

miner.start()
miner.stop()

트랜잭션 확인 (geth 콘솔)

eth.pendingTransactions

authentication 오류 뜰 때 (geth 콘솔)

personal.unlockAccount(eth.coinbase); #하고 비밀번호 입력

mining 하기(pending 해소) (geth 콘솔)

miner.start(1);admin.sleepBlocks(1);miner.stop();
#sleepBlocks(숫자)를 조절해준다.

가나슈(ganache) 실행하기 (새로운 cmd)

node_modules.bin\ganache-cli.cmd -p 8345

.js 파일 node로 실행하기 (새로운 cmd)

C:\Users\minji\Code\201810808>node src/OrderEventUse.js
# 학번경로 폴더에서

node js파일주소

# 이렇게 입력한다.

겪었던 오류와 해결법


해결한 오류

UnhandledPromiseRejectionWarning

  • Returned error: VM Exception while processing transaction: out of gas
  • The contract code couldn't be stored, please check your gas limit.
  • Returned error: intrinsic gas too low at Object.ErrorResponse
  • Invalid JSON RPC response: "" at Object.InvalidResponse
  • connection not open on send()
  • Returned values aren't valid, did it run Out of Gas?

ParserError

  • Expected identifier but got '(' fallback () external { ^

TypeError

  • Indexed expression has to be a type, mapping or array (is tuple(uint256,uint256))
  • myBank.methods.getBalance(...).call.then is not a function

해결 못한 오류

ParserError

  • Expected primary expression.

기타 Error

  • Provided address "undefined" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

ethereum's People

Contributors

dependabot[bot] avatar minji-o-j avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ethereum's Issues

UnhandledPromiseRejectionWarning: Error: Returned error: intrinsic gas too low at Object.ErrorResponse

(node:38432) UnhandledPromiseRejectionWarning: Error: Returned error: intrinsic gas too low
at Object.ErrorResponse (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:29:16)
at C:\Users\minji\Code\201810808\node_modules\web3-core-requestmanager\src\index.js:166:36
at XMLHttpRequest.request.onreadystatechange (C:\Users\minji\Code\201810808\node_modules\web3-providers-http\src\index.js:110:13)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
at IncomingMessage. (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:38432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38432) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

myBank.methods.getBalance(...).call.then is not a function

myBank.methods.getBalance().call.then(console.log);
^

TypeError: myBank.methods.getBalance(...).call.then is not a function
at Object. (C:\Users\minji\Code\201810808\src\BankUse.js:5:34)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47

UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: "" at Object.InvalidResponse

(node:37468) UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:42:16)
at XMLHttpRequest.request.onreadystatechange (C:\Users\minji\Code\201810808\node_modules\web3-providers-http\src\index.js:106:32)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
at XMLHttpRequest._onHttpRequestError (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:349:14)
at ClientRequest. (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:252:61)
at ClientRequest.emit (events.js:310:20)
at Socket.socketErrorListener (_http_client.js:426:9)
at Socket.emit (events.js:310:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:37468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:37468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

UnhandledPromiseRejectionWarning: Error: Returned values aren't valid, did it run Out of Gas?

(node:14060) UnhandledPromiseRejectionWarning: Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
at ABICoder.decodeParameters (C:\Users\minji\Code\201810808\node_modules\web3-eth-abi\src\index.js:239:15)
at Contract._decodeMethodReturn (C:\Users\minji\Code\201810808\node_modules\web3-eth-contract\src\index.js:568:22)
at Method.outputFormatter (C:\Users\minji\Code\201810808\node_modules\web3-eth-contract\src\index.js:924:42)
at Method.formatOutput (C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:167:54)
at sendTxCallback (C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:622:33)
at C:\Users\minji\Code\201810808\node_modules\web3-core-requestmanager\src\index.js:173:9
at XMLHttpRequest.request.onreadystatechange (C:\Users\minji\Code\201810808\node_modules\web3-providers-http\src\index.js:110:13)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
at IncomingMessage. (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:14060) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14060) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

SyntaxError: Invalid shorthand property initializer

C:\Users\minji\Code\201810808\src\OrderEventUse.js:17
filter: {_from: accounts[0],_value=d},
^^^^^^^^

SyntaxError: Invalid shorthand property initializer
at wrapSafe (internal/modules/cjs/loader.js:1070:16)
at Module._compile (internal/modules/cjs/loader.js:1120:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47

UnhandledPromiseRejectionWarning: Error: connection not open on send()

(node:37016) UnhandledPromiseRejectionWarning: Error: connection not open on send()
at Object.ConnectionError (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:69:23)
at Object.ConnectionNotOpenError (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:48:21)
at C:\Users\minji\Code\201810808\node_modules\web3-providers-ws\src\index.js:181:37
at Map.forEach ()
at WebsocketProvider._onClose (C:\Users\minji\Code\201810808\node_modules\web3-providers-ws\src\index.js:180:27)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (C:\Users\minji\Code\201810808\node_modules\yaeti\lib\EventTarget.js:115:12)
at W3CWebSocket.onConnectFailed (C:\Users\minji\Code\201810808\node_modules@web3-js\websocket\lib\W3CWebSocket.js:219:14)
at WebSocketClient. (C:\Users\minji\Code\201810808\node_modules@web3-js\websocket\lib\W3CWebSocket.js:59:25)
at WebSocketClient.emit (events.js:310:20)
at WebSocketClient.failHandshake (C:\Users\minji\Code\201810808\node_modules@web3-js\websocket\lib\WebSocketClient.js:339:10)
at ClientRequest. (C:\Users\minji\Code\201810808\node_modules@web3-js\websocket\lib\WebSocketClient.js:278:18)
at ClientRequest.emit (events.js:310:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:603:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at Socket.socketOnData (_http_client.js:476:22)
at Socket.emit (events.js:310:20)
(node:37016) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:37016) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error: This looks like an address but has an invalid checksum. Correct checksummed address

src/Bank.sol:12:24: Error: This looks like an address but has an invalid checksum. Correct checksummed address: "0xa84c0e7543f8757226D14e2269298315d288B23a". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
secondAccount= 0xa84c0e7543f8757226d14e2269298315d288b23a;

                   ^----------------------------------------^

Error: Provided address "undefined" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\formatters.js:471
throw new Error('Provided address "' + address + '" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.');
^

Error: Provided address "undefined" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
at Method.inputAddressFormatter (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\formatters.js:471:11)
at C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:148:38
at Array.map ()
at Method.formatInput (C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:146:32)
at Method.toPayload (C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:181:23)
at Eth.send [as getBalance] (C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:599:30)
at Object. (C:\Users\minji\Code\201810808\src\BankUse.js:10:10)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47

UnhandledPromiseRejectionWarning: Error: Returned error: VM Exception while processing transaction: out of gas

(node:37884) UnhandledPromiseRejectionWarning: Error: Returned error: VM Exception while processing transaction: out of gas
at Object.ErrorResponse (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:29:16)
at C:\Users\minji\Code\201810808\node_modules\web3-core-requestmanager\src\index.js:166:36
at XMLHttpRequest.request.onreadystatechange (C:\Users\minji\Code\201810808\node_modules\web3-providers-http\src\index.js:110:13)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
at IncomingMessage. (C:\Users\minji\Code\201810808\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:37884) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:37884) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit.

(node:34588) UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit.
at Object.TransactionError (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:93:21)
at Object.ContractCodeNotStoredError (C:\Users\minji\Code\201810808\node_modules\web3-core-helpers\src\errors.js:102:21)
at C:\Users\minji\Code\201810808\node_modules\web3-core-method\src\index.js:394:40
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:34588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:34588) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.