Klaytn 문서 아카이브
시작하기스마트 컨트랙트노드 운영dApp 개발자
  • Klaytn 문서
  • -
    • Klaytn Overview
      • 왜 클레이튼일까요?
      • 클레이튼 디자인
        • 합의 메커니즘
        • 계정
        • 트랜잭션
          • 기본
          • 수수료 위임 트랜잭션
          • 수수료 부분 위임 트랜잭션
          • Ethereum
        • 연산
          • 클레이튼 스마트 컨트랙트
          • 실행 모델(Execution Model)
          • Computation Cost
            • 연산 비용 (구 버전 문서)
          • Klaytn 가상머신
            • 클레이튼 가상머신 (구 버전 문서)
        • 스토리지
        • 트랜잭션 비용
          • 트랜잭션 비용 (구 버전 문서)
        • 클레이튼의 네이티브 코인 - KLAY
        • 토큰 이코노미
        • 거버넌스
        • 다중 채널
        • KNI
      • 확장성 솔루션
    • Getting Started
      • Deploying Smart Contract Using Foundry
      • Deploying Smart Contract Using Hardhat
      • Deploying Smart Contract Using KEN
        • Launch an Endpoint Node
        • Top up your Account
        • Install Development Tools
        • Deploy a Smart Contract
        • Check the Deployment
        • Account Management
          • Creating Accounts
          • Managing Accounts
      • Development Environment
      • Getting KLAY
    • 스마트 컨트랙트
      • 솔리디티 - 스마트 컨트랙트 언어
      • 미리 컴파일된 컨트랙트
        • 미리 컴파일된 컨트랙트 (구 버전 문서)
      • IDE 및 도구
        • Truffle
      • 샘플 컨트랙트
        • KlaytnGreeter
        • ERC-20
          • 1. ERC-20 스마트 컨트랙트 작성
          • 2. 스마트 컨트랙트 배포
          • 3. 클레이튼 월렛에서 ERC-20 토큰 사용
        • ERC-721
          • 1. ERC-721 스마트 컨트랙트 작성
          • 2. Deploying Smart Contract
      • 테스트 가이드
      • 배포 가이드
      • 클레이튼 호환 토큰
      • 이더리움 컨트랙트 이식
    • Run a Node
      • 배포
        • Endpoint Node
          • 시스템 요구사항
          • 설치 가이드
            • 다운로드
            • Installation Guide
            • 환경설정
            • EN 실행하기
            • 설치 테스트하기
          • ken CLI 명령어
          • JSON-RPC API
        • 코어 셀
          • System Requirements
          • 네트워크 설정
          • Installation Guide
            • Download
            • 설치하기 전에
            • 컨센서스 노드 설정
              • Installation Guide
              • Configuration
              • CN 실행하기
            • 프록시 노드 설정
              • Installation Guide
              • Configuration
              • PN 실행하기
            • 코어 셀 테스트하기
          • 모니터링 설정
          • H/A 설정
        • Service Chain
          • Getting Started
            • 4개 노드 서비스 체인 설정하기
            • Connecting to Baobab
            • 크로스체인 토큰 전송
            • HA(High Availability) for ServiceChain
            • Nested ServiceChain
            • Value Transfer between Sibling ServiceChains
          • 참조 매뉴얼
            • System Requirements
            • Download
            • SCN User Guide
              • Installation
              • Configuration
              • SCN 실행 및 중지하기
              • 노드 상태 확인하기
              • kscn commands
              • homi commands
            • SPN/SEN User Guide
              • Installation
              • Configuration
              • 노드 실행 및 중지
              • Checking Node Status
            • Bridge Configuration
            • 앵커링
            • KAS 앵커링
            • 토큰 전송
            • Configuration Files
            • 로그 파일
            • Genesis JSON
            • 업그레이드 및 하드포크
          • How-To Guides
        • Download Node Packages
          • v1.11.1
          • v1.11.0
          • v1.10.2
          • v1.10.1
          • v1.10.0
          • v1.9.1
          • v1.9.0
          • v1.8.4
          • v1.8.3
          • v1.8.2
          • v1.8.1
          • v1.8.0
          • v1.7.3
          • v1.7.2
          • v1.7.1
          • v1.7.0
          • v1.6.4
          • v1.6.3
          • v1.6.2
          • v1.6.1
          • v1.6.0
          • v1.5.3
          • v1.5.2
          • v1.5.1
          • v1.5.0
          • v1.4.2
          • v1.4.1
          • v1.4.0
          • v1.3.0
          • v1.2.0
          • v1.1.1
          • v1.0.0
          • v0.9.6
          • v0.8.2
    • 운영 가이드
      • Configuration
      • 노드 로그
      • Log operation
      • 에러 및 문제 해결
      • Klaytn Command
      • Chaindata Change
      • Chaindata Migration
    • dApp Developers
      • JSON-RPC APIs
        • API references
          • eth
            • Caution
            • Account
            • Block
            • Transaction
            • Config
            • Filter
            • Gas
            • Miscellaneous
          • klay
            • Account
            • Block
            • Transaction
              • Working with Klaytn Transaction Types
            • Configuration
            • Filter
            • Gas
            • Miscellaneous
          • net
          • debug
            • Logging
            • Profiling
            • Runtime Tracing
            • Runtime Debugging
            • VM Tracing
            • VM Standard Tracing
            • Blockchain Inspection
          • admin
          • personal
          • txpool
          • governance
        • Service Chain API references
          • mainbridge
          • subbridge
        • Transaction Error Codes
      • RPC Service Providers
        • Public Endpoints
      • SDK & Libraries for interacting with Klaytn Node
        • caver-js
          • Getting Started
          • Sending a sample transaction
          • API references
            • caver.account
            • caver.wallet
              • caver.wallet.keyring
            • caver.transaction
              • Basic
              • Fee Delegation
              • Partial Fee Delegation
            • caver.rpc
              • caver.rpc.klay
              • caver.rpc.net
              • caver.rpc.governance
            • caver.contract
            • caver.abi
            • caver.kct
              • caver.kct.kip7
              • caver.kct.kip17
              • caver.kct.kip37
            • caver.validator
            • caver.utils
            • caver.ipfs
          • caver-js ~v1.4.1
            • Getting Started (~v1.4.1)
            • API references
              • caver.klay
                • Account
                • Block
                • Transaction
                  • Legacy
                  • Value Transfer
                  • Value Transfer Memo
                  • Account Update
                  • Smart Contract Deploy
                  • Smart Contract Execution
                  • Cancel
                • Configuration
                • Filter
                • Miscellaneous
              • caver.klay.net
              • caver.klay.accounts
              • caver.klay.Contract
              • caver.klay.KIP7
              • caver.klay.KIP17
              • caver.klay.abi
              • caver.utils (~v1.4.1)
            • Porting from web3.js
        • caver-java
          • Getting Started
          • API references
          • caver-java ~v1.4.0
            • Getting Started (~v1.4.0)
            • Porting from web3j
        • ethers.js
        • web3.js
      • Tutorials
        • Klaytn Online Toolkit
        • Fee Delegation Example
        • Count DApp
          • 1. Environment Setup
          • 2. Clone Count DApp
          • 3. Directory Structure
          • 4. Write Smart Contract
          • 5. Frontend Code Overview
            • 5-1. Blocknumber Component
            • 5-2. Auth Component
            • 5-3. Count Component
          • 6. Deploy Contract
          • 7. Run App
        • Klaystagram
          • 1. Environment Setup
          • 2. Clone Klaystagram DApp
          • 3. Directory Structure
          • 4. Write Klaystagram Smart Contract
          • 5. Deploy Contract
          • 6. Frontend Code Overview
          • 7. FeedPage
            • 7-1. Connect Contract to Frontend
            • 7-2. UploadPhoto Component
            • 7-3. Feed Component
            • 7-4. TransferOwnership Component
          • 8. Run App
        • Building a Buy Me a Coffee dApp
          • 1. Project Setup
          • 2. Creating a BMC Smart Contract
          • 3. Testing the contract using scripts
          • 4. Deploying BMC Smart contract
          • 5. Building the BMC Frontend with React and Web3Onboard
          • 6. Deploying Frontend code on IPFS using Fleek
          • 7. Conclusion
        • Migrating Ethereum App to Klaytn
        • Connecting MetaMask
        • Connecting Remix
        • Verifying Smart Contracts Using Block Explorers
      • Developer Tools
        • Wallets
          • Kaikas
          • Klaytn Wallet
          • Klaytn Safe
            • Klaytn Safe Design
            • Create a Safe
            • Add assets
            • Send assets
            • Contract Interaction
            • Transaction Builder
            • Points to Note
            • Frequently Asked Questions
          • Wallet Libraries
            • Web3Auth
            • Web3Modal
            • Web3-Onboard
        • Oracles
          • Orakl Network
          • Witnet
          • SupraOracles
        • Block Explorers
          • Klaytnscope
          • Klaytnfinder
        • Klaytn Contracts Wizard
    • Glossary
  • ---
    • Klaytn 하드포크
    • 클레이튼 2.0
      • 메타버스 패키지
      • 완결성과 개선 사항들
      • 이더리움 호환성
      • 거버넌스 탈중앙화
      • 대규모 에코 펀드
    • FAQ
    • 오픈 소스
    • 이용약관
    • 지원 언어
  • ℹ️최신 Klaytn 문서
Powered by GitBook
On this page
  • debug_freeOSMemory
  • debug_gcStats
  • debug_memStats
  • debug_metrics
  • debug_setGCPercent
  • debug_stacks

Was this helpful?

  1. -
  2. dApp Developers
  3. JSON-RPC APIs
  4. API references
  5. debug

Runtime Debugging

PreviousRuntime TracingNextVM Tracing

Last updated 1 year ago

Was this helpful?

NOTE All other debug namespace APIs EXCEPT FOR the following APIs are restricted with rpc.unsafe-debug.disable flag:

  • APIs, however with limited functionality (only are allowed)

  • debug_dumpBlock, debug_dumpStateTrie, debug_getBlockRlp, debug_getModifiedAccountsByHash, debug_getModifiedAccountsByNumber, debug_getBadBlocks, debug_getModifiedStorageNodesByNumber

  • debug_metrics

debug_freeOSMemory

Returns unused memory to the OS.

Client
Method Invocation

Console

debug.freeOSMemory()

RPC

{"method": "debug_freeOSMemory"}

Parameters

None

Return Value

None

Example

Console

> debug.freeOSMemory()
null

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_freeOSMemory","id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":null}

debug_gcStats

Returns GC statistics.

Client
Method Invocation

Console

debug.gcStats()

RPC

{"method": "debug_gcStats", "params": []}

Parameters

None

Return Value

Example

Console

> debug.gcStats()
{
  LastGC: "2018-10-08T14:27:34.030659164Z",
  NumGC: 40,
  Pause: [4582691, 2863122, 1578188, 459447, 197699, 1688008, 678298, 117924, 6871625, 298523, 1281135, 616022, 2513029, 265029, 704801, 685752, 383625, 677657, 1135878, 1730593, 603201, 2667691, 1901266, 1035406, 1624233, 1112526, 397637, 158158, 596931, 2675197, 4421722, 745039, 847417, 4423680, 653433, 281915, 605418, 8127664, 138283, 1810200],
  PauseEnd: ["2018-10-08T14:27:34.030659164Z", "2018-10-08T14:25:34.032422737Z", "2018-10-08T14:23:34.015065773Z", "2018-10-08T14:21:34.031893519Z", "2018-10-08T14:19:33.791324489Z", "2018-10-08T14:19:01.028883257Z", "2018-10-08T14:17:01.054270356Z", "2018-10-08T14:15:01.032846304Z", "2018-10-08T14:13:01.07313761Z", "2018-10-08T14:11:01.042653342Z", "2018-10-08T14:09:01.034458873Z", "2018-10-08T14:07:01.022701083Z", "2018-10-08T14:05:01.046456415Z", "2018-10-08T14:03:01.030075376Z", "2018-10-08T14:01:01.027838941Z", "2018-10-08T13:59:01.033363592Z", "2018-10-08T13:57:01.032853252Z", "2018-10-08T13:55:01.06825876Z", "2018-10-08T13:53:01.071426346Z", "2018-10-08T13:51:01.099618831Z", "2018-10-08T13:49:01.016314071Z", "2018-10-08T13:47:01.031721975Z", "2018-10-08T13:45:01.029069094Z", "2018-10-08T13:43:01.026156953Z", "2018-10-08T13:41:01.019240344Z", "2018-10-08T13:39:01.026699743Z", "2018-10-08T13:37:01.02642045Z", "2018-10-08T13:35:00.997556262Z", "2018-10-08T13:33:01.023605742Z", "2018-10-08T13:31:01.025436347Z", "2018-10-08T13:29:01.024808072Z", "2018-10-08T13:27:01.01508169Z", "2018-10-08T13:25:01.023461518Z", "2018-10-08T13:23:01.0144789Z", "2018-10-08T13:21:01.022121597Z", "2018-10-08T13:19:30.748905748Z", "2018-10-08T13:19:29.588457028Z", "2018-10-08T13:19:29.461820065Z", "2018-10-08T13:19:29.436792038Z", "2018-10-08T13:19:29.408990947Z"],
  PauseQuantiles: null,
  PauseTotal: 64156063
}

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_gcStats","params":[],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":{"LastGC":"2018-10-15T00:42:08.2787037Z","NumGC":14,"PauseTotal":292805500,"Pause":[3384700,60164200,259500,354600,62331200,241700,29701500,4868200,8242800,35177700,27621100,12647400,38250100,9560800],"PauseEnd":["2018-10-15T00:42:08.2787037Z","2018-10-15T00:40:19.3302813Z","2018-10-15T00:38:41.2202755Z","2018-10-15T00:36:41.2785669Z","2018-10-15T00:36:18.3196569Z","2018-10-15T00:34:48.2073609Z","2018-10-15T00:33:01.3309817Z","2018-10-15T00:31:28.3465898Z","2018-10-15T00:30:05.4245261Z","2018-10-15T00:28:58.6377593Z","2018-10-15T00:27:55.315809Z","2018-10-15T00:27:45.075085Z","2018-10-15T00:27:44.9164574Z","2018-10-15T00:27:44.8406572Z"],"PauseQuantiles":null}}

debug_memStats

Returns detailed runtime memory statistics.

Client
Method Invocation

Console

debug.memStats()

RPC

{"method": "debug_memStats", "params": []}

Parameters

None

Return Value

Example

Console

> debug.memStats()
{
  Alloc: 132244280,
  BuckHashSys: 1922010,
  BySize: [{
      Frees: 0,
      Mallocs: 0,
      Size: 0
  }, {
      Frees: 496599,
      Mallocs: 499580,
      Size: 8
  },
  ...
  StackSys: 1195456,
  Sys: 107909880,
  TotalAlloc: 2105944960
}

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_memStats","params":[],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":{"Alloc":265525152,"TotalAlloc":3548997112,"Sys":756177144,"Lookups":2165,"Mallocs":25572268,"Frees":24933943,
...
"Frees":36},{"Size":16384,"Mallocs":123,"Frees":122},{"Size":18432,"Mallocs":11,"Frees":3},{"Size":19072,"Mallocs":2,"Frees":1}]}}

debug_metrics

Retrieves all the known system metrics collected by the node.

Client
Method Invocation

Console

debug.metrics(raw)

RPC

{"method": "debug_metrics", "params": [raw]}

Parameters

Name
Type
Description

raw

bool

raw 데이터 자체로 출력하면 true를 반환하고, 그렇지 않으면 false를 반환합니다.

Return Value

Type
Description

JSON string

노드가 수집한, 구조화된 측정 수치입니다.

Example

Console

> debug.metrics(true)
debug.metrics(true)
{
...
chain: {
  inserts: {
    AvgRate01Min: 0.9999999999999988,
    AvgRate05Min: 0.9999950225324217,
    AvgRate15Min: 0.9963720514881304,
    MeanRate: 0.9936029165254054,
    Overall: 5122,
    Percentiles: {
      20: 6266950,
      5: 5950439.75,
      50: 6682947,
      80: 7255046,
      95: 9365905.249999994
    }
  }
},
...
system: {
  disk: {
    readcount: {
      AvgRate01Min: 56.44435697476854,
      AvgRate05Min: 55.584662531212246,
      AvgRate15Min: 55.34119664885956,
      MeanRate: 47.632311872105376,
      Overall: 245543
    },
    readdata: {
      AvgRate01Min: 12317.25061664709,
      AvgRate05Min: 12166.068673100728,
      AvgRate15Min: 12672.361505927352,
      MeanRate: 15647.98456421136,
      Overall: 80664847
    },
    writecount: {
      AvgRate01Min: 181.87825585990814,
      AvgRate05Min: 179.42841085089034,
      AvgRate15Min: 177.29930723824663,
      MeanRate: 145.6261462083422,
      Overall: 750698
    },
    writedata: {
      AvgRate01Min: 24683.661802447285,
      AvgRate05Min: 24302.28523786675,
      AvgRate15Min: 24142.37073674183,
      MeanRate: 25207.081062276873,
      Overall: 129941675
    }
  }
}

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_metrics","params":[true],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":{"blockchain":{"block":{"tx":{"counter":{"Overall":98307},"rate":{"AvgRate01Min":19.99999999999893,"AvgRate05Min":19.999669059400787,"AvgRate15Min":19.91097896398045,"MeanRate":16.321034565305364,"Overall":98307}}},"head":{"blocknumber":"Unknown metric type"}},"bridgeTxpool":{"refuse":{"Overall":0}}, ...{"AvgRate01Min":0.9999999999999988,"AvgRate05Min":0.9999997215208508,"AvgRate15Min":0.9986124269288207,"MeanRate":0.9946322927570416,"Overall":5991,"Percentiles":{"20":6229668,"5":5986862.3,"50":6585653,"80":6864326.2,"95":7486187.249999999}}}}

debug_setGCPercent

Sets the garbage collection target percentage. It returns the previous setting. A negative value disables GC.

Parameters

Name
Type
Description

Percent

integer

설정할 GC 비율입니다.

Return Value

Type
Description

integer

이전에 설정된 GC 비율입니다.

Example Console

> debug.setGCPercent(50)
100
> debug.setGCPercent(70)
50
> debug.setGCPercent(100)
70

HTTP RPC

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"debug_setGCPercent", "params":[100],"id":73}' https://public-en-baobab.klaytn.net

{
  "jsonrpc":"2.0",
  "id":73,
  "result":70
}

debug_stacks

Returns a printed representation of the stacks of all goroutines.

Client
Method Invocation

Console

debug.stacks()

RPC

{"method": "debug_stacks", "params": []}

Parameters

None

Return Value

Type
Description

string

모든 go루틴의 스택 정보입니다.

Example

Console

> debug.stacks()
goroutine 163577 [running]:
/api/debug.(*HandlerT).Stacks(0xc4200a4780, 0x0, 0x0)
    /klaytn/build/_workspace/src/github.com/klaytn/klaytn/api/debug/api.go:173 +0x74
reflect.Value.call(0xc4213a80c0, 0xc42134d1f0, 0x13, 0xf050ec, 0x4, 0xc4233957a0, 0x1, 0x1, 0x474401, 0xc4233956c8, ...)
...

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_stacks","params":[],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":"goroutine 76176 [running]:\ngithub.com/klaytn/klaytn/api/debug.(*HandlerT).Stacks(0xc0002ce050, 0x0, 0x0)\n\t/private/tmp/klaytn-20181001-13887-zbyv2z/build/_workspace/src/github.com/klaytn/klaytn/api/debug/api.go:173 +0x74\nreflect.Value.call(0xc01867c660, 0xc000231bd8, 0x13, 0x4b26ca7, 0x4, 0xc008d8b7c0, 0x1, 0x1, 0x30, 0xc0323211d0 ..."}

See for information about the fields of the returned object.

See for information about the fields of the returned object.

https://golang.org/pkg/runtime/debug/#GCStats
https://golang.org/pkg/runtime/#MemStats
VM Tracing
pre-defined tracers