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
  • defaultBlock
  • getBlockNumber
  • getBlock
  • getBlockReceipts
  • getBlockTransactionCount
  • getBlockWithConsensusInfo
  • getCommittee
  • getCommitteeSize
  • getCouncil
  • getCouncilSize
  • getStorageAt
  • isMining
  • isSyncing

Was this helpful?

  1. -
  2. dApp Developers
  3. SDK & Libraries for interacting with Klaytn Node
  4. caver-js
  5. caver-js ~v1.4.1
  6. API references
  7. caver.klay

Block

PreviousAccountNextTransaction

Last updated 2 years ago

Was this helpful?

defaultBlock

caver.klay.defaultBlock

기본 블록은 특정 메서드들에서 사용됩니다. You can override it by passing in the defaultBlock as the last parameter. The default value is "latest".

  • ->

Property

기본 블록 파라미터는 다음 중 하나일 수 있습니다.

  • 숫자: 블록 번호

  • "genesis" - String: 제네시스 블록

  • "latest" - String: The latest block (current head of the blockchain)

기본값은 "latest"입니다.

Example

> caver.klay.defaultBlock;
"latest"

// set the default block
> caver.klay.defaultBlock = 1000;

getBlockNumber

caver.klay.getBlockNumber([callback])

현재 블록 번호를 반환합니다.

Parameters

Name
Type
Description

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Number를 반환 - 가장 최신 블록의 블록 번호입니다.

Example

> caver.klay.getBlockNumber().then(console.log);
2744

getBlock

caver.klay.getBlock(blockHashOrBlockNumber [, returnTransactionObjects] [, callback])

블록 해시 또는 블록 번호와 매칭되는 블록을 반환합니다.

Parameters

Name
Type
Description

blockHashOrBlockNumber

String | Number

The block hash or block number. Or the string "genesis", or "latest".

returnTransactionObjects

Boolean

(optional, default false) If true, the returned block will contain all transactions as objects, if false it will only contains the transaction hashes.

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Object를 반환 - 블록 객체입니다.

Name
Type
Description

blockScore

QUANTITY

Former difficulty. Always 1 in the BFT consensus engine

extraData

String

The "extra data" field of this block.

gasUsed

Number

The total used gas by all transactions in this block.

governanceData

DATA

RLP encoded governance configuration

hash

32-byte String

Hash of the block. null when it is a pending block.

logsBloom

256-byte String

The bloom filter for the logs of the block. null when it is a pending block.

number

Number

The block number. null when it is a pending block.

parentHash

32-byte String

Hash of the parent block.

receiptsRoot

32-byte DATA

The root of the receipts trie of the block.

reward

20-byte DATA

The address of the beneficiary to whom the block rewards were given.

size

Number

Integer the size of this block in bytes.

stateRoot

32-byte String

The root of the final state trie of the block.

timestamp

Number

The unix timestamp for when the block was collated.

timestampFoS

QUANTITY

The fraction of a second of the timestamp for when the block was collated.

totalBlockScore

QUANTITY

Integer of the total blockScore of the chain until this block.

transactions

Array

Array of transaction objects, or 32-byte transaction hashes depending on the returnTransactionObjects parameter.

transactionsRoot

32-byte String

The root of the transaction trie of the block.

voteData

DATA

RLP encoded governance vote of the proposer

Example

> caver.klay.getBlock(19097).then(console.log);
{ 
    blockscore: '0x1',
    extraData: '0xd7820a01846b6c617988676f312e31312e32856c696e75780000000000000000f8b3ea94715dd3ce7a285f21111715a2ba5537414d40506b9471959675eeb7c7ec1e0c74f206a9c488d7f178d4b8418e55cfb464eed804671bbee503f2dcacae9349f23aa3c42fc43349f96ef08bb07c1039541a3b768af32384c8e29ec7e673356a6b0ea4c6d88604ae8abae4303201f843b841386a3fbd09cd3a7c82c0b8fdc9ae8c3e624be5f12553dde42bed456093e40c113aa36fb7015b578611e2cd2ee979e6017b15be7d3cc645f455b32e8607c85d7100',
    gasUsed: '0x5208',
    governanceData: '0x',
    hash: '0x6ccef34eb59fab927705d344f080f449b576c0626e4aa3e20f569feb8df6e283',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    number: '0x4a99',
    parentHash: '0x3b56b598828368d86b175a78ba21845125372851154840c6b1b318da910849c2',
    receiptsRoot: '0xe38e5532717f12f769b07ea016014bd39b74fb72def4de8442114cc2728609f2',
    reward: '0x59e6931f46b091f4ecbc39e8626fc0be7d3fcdeb',
    size: '0x314',
    stateRoot: '0xc65b3e3f1c32c33c095507d6d37e2a8a5589b178b5b03a1365295908ac92c40c',
    timestamp: '0x5d11f951',
    timestampFoS: '0x0',
    totalBlockScore: '0x4a9a',
    transactions: [ '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca' ],
    transactionsRoot: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
    voteData: '0x' 
}

getBlockReceipts

caver.klay.getBlockReceipts(blockHash [, callback])

주어진 블록 해시와 매칭된 블록에 있는 트랜잭션 영수증 목록을 반환합니다.

Parameters

Name
Type
Description

blockHash

String

Hash of a block.

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Array를 반환 - 블록에 있는 영수증들입니다. If the target block contains no transaction, an empty array [] is returned.

Example

> caver.klay.getBlockReceipts('0x6ccef34eb59fab927705d344f080f449b576c0626e4aa3e20f569feb8df6e283').then(console.log);
[ 
    { 
        blockHash: '0x6ccef34eb59fab927705d344f080f449b576c0626e4aa3e20f569feb8df6e283',
        blockNumber: '0x4a99',
        contractAddress: null,
        from: '0x71959675eeb7c7ec1e0c74f206a9c488d7f178d4',
        gas: '0x493e0',
        gasPrice: '0x5d21dba00',
        gasUsed: '0x5208',
        logs: [],
        logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
        nonce: '0x2',
        senderTxHash: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
        signatures: [ 
            { 
                V: '0x4e43',
                R: '0xa857ef0676d7e65697cadeaf1654b2facd71d0b9f942d695f3972a1f7c34c25c',
                S: '0x43fba9e5c2c16511f951e27957f1279ea3c1f913b27f9fbb2a8dcb5884e37e3d'
            } 
        ],
        status: '0x1',
        to: '0xef5cd886c7f8d85fbe8023291761341acbb4da01',
        transactionHash: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
        transactionIndex: '0x0',
        type: 'TxTypeValueTransfer',
        typeInt: 8,
        value: '0xde0b6b3a7640000' 
    } 
]

> caver.klay.getBlockReceipts('0x6275712cd6ec769603f1560819ad226ea29216881c495c778ca68f0c1cd6e550').then(console.log);
[]

getBlockTransactionCount

caver.klay.getBlockTransactionCount(blockHashOrBlockNumber [, callback])

주어진 블록에 담긴 트랜잭션의 개수를 반환합니다.

Parameters

Name
Type
Description

blockHashOrBlockNumber

String | Number

The block number or hash. Or the string "genesis", or "latest".

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Number를 반환 - 주어진 블록에 담긴 트랜잭션 개수입니다.

Example

> caver.klay.getBlockTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
1

getBlockWithConsensusInfo

caver.klay.getBlockWithConsensusInfo(blockHashOrBlockNumber [, callback])

주어진 블록 해시 또는 블록 번호로 조회한 블록을 합의에 대한 정보와 함께 반환합니다.

Parameters

Name
Type
Description

blockHashOrBlockNumber

String | Number

The block hash or block number. 또는 "genesis" 아니면 "latest".

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

Promise returns Object - A block object with consensus information (a proposer and a list of committee members) The block object contains:

Name
Type
Description

blockScore

QUANTITY

Former difficulty. Always 1 in the BFT consensus engine

committee

Array

Array of addresses of committee members of this block. 위원회란 블록 생성을 위한 합의 프로토콜에 참여한 검증자들 중 일부입니다.

extraData

String

The "extra data" field of this block.

gasUsed

QUANTITY

The total used gas by all transactions in this block.

governanceData

DATA

RLP encoded governance configuration

hash

32-byte DATA

Hash of the block. null when it is a pending block.

logsBloom

256-byte String

The bloom filter for the logs of the block. null when it is a pending block.

number

QUANTITY

The block number. null when it is a pending block.

parentHash

32-byte DATA

Hash of the parent block.

proposer

20-byte DATA

The address of the block proposer.

receiptsRoot

32-byte DATA

The root of the receipts trie of the block.

reward

20-byte DATA

The address of the beneficiary to whom the block rewards were given.

size

QUANTITY

Integer the size of this block in bytes.

stateRoot

32-byte DATA

The root of the final state trie of the block.

timestamp

QUANTITY

The unix timestamp for when the block was collated.

timestampFoS

QUANTITY

The fraction of a second of the timestamp for when the block was collated.

totalBlockScore

QUANTITY

Integer of the total blockScore of the chain until this block.

transactions

Array

Array of transaction objects.

transactionsRoot

32-byte DATA

The root of the transaction trie of the block.

voteData

DATA

RLP encoded governance vote of the proposer

Examples

> caver.klay.getBlockWithConsensusInfo(19097).then(console.log);
{ 
    blockscore: '0x1',
    committee: [ 
        '0x715dd3ce7a285f21111715a2ba5537414d40506b',
        '0x71959675eeb7c7ec1e0c74f206a9c488d7f178d4' 
    ],
    extraData: '0xd7820a01846b6c617988676f312e31312e32856c696e75780000000000000000f8b3ea94715dd3ce7a285f21111715a2ba5537414d40506b9471959675eeb7c7ec1e0c74f206a9c488d7f178d4b8418e55cfb464eed804671bbee503f2dcacae9349f23aa3c42fc43349f96ef08bb07c1039541a3b768af32384c8e29ec7e673356a6b0ea4c6d88604ae8abae4303201f843b841386a3fbd09cd3a7c82c0b8fdc9ae8c3e624be5f12553dde42bed456093e40c113aa36fb7015b578611e2cd2ee979e6017b15be7d3cc645f455b32e8607c85d7100',
    gasUsed: '0x5208',
    governanceData: '0x',
    hash: '0x6ccef34eb59fab927705d344f080f449b576c0626e4aa3e20f569feb8df6e283',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    number: '0x4a99',
    parentHash: '0x3b56b598828368d86b175a78ba21845125372851154840c6b1b318da910849c2',
    proposer: '0x715dd3ce7a285f21111715a2ba5537414d40506b',
    receiptsRoot: '0xe38e5532717f12f769b07ea016014bd39b74fb72def4de8442114cc2728609f2',
    reward: '0x59e6931f46b091f4ecbc39e8626fc0be7d3fcdeb',
    size: '0x314',
    stateRoot: '0xc65b3e3f1c32c33c095507d6d37e2a8a5589b178b5b03a1365295908ac92c40c',
    timestamp: '0x5d11f951',
    timestampFoS: '0x0',
    totalBlockScore: '0x4a9a',
    transactions: [ 
        { 
            blockHash: '0x6ccef34eb59fab927705d344f080f449b576c0626e4aa3e20f569feb8df6e283',
            blockNumber: '0x4a99',
            contractAddress: null,
            from: '0x71959675eeb7c7ec1e0c74f206a9c488d7f178d4',
            gas: '0x493e0',
            gasPrice: '0x5d21dba00',
            gasUsed: '0x5208',
            logs: [],
            logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
            nonce: '0x2',
            senderTxHash: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
            signatures: [ 
                { 
                    V: '0x4e43',
                    R: '0xa857ef0676d7e65697cadeaf1654b2facd71d0b9f942d695f3972a1f7c34c25c',
                    S: '0x43fba9e5c2c16511f951e27957f1279ea3c1f913b27f9fbb2a8dcb5884e37e3d' 
                } 
            ],
            status: '0x1',
            to: '0xef5cd886c7f8d85fbe8023291761341acbb4da01',
            transactionHash: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
            transactionIndex: '0x0',
            type: 'TxTypeValueTransfer',
            typeInt: 8,
            value: '0xde0b6b3a7640000' 
        } 
    ],
    transactionsRoot: '0xac418c96f7386a3343d149eeb29e48e28905525dda2e5afe55b0661f9ab01aca',
    voteData: '0x' 
}

getCommittee

caver.klay.getCommittee([defaultBlock] [, callback])

Returns a list of all validators in the committee at the specified block. 매개변수를 설정하지 않으면 최신 블록에서 위원회에 속한 검증자 목록을 반환합니다.

Parameters

Name
Type
Description

defaultBlock

Number | String

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Array를 반환 - 위원회에 있는 모든 검증자의 주소들이 담긴 배열입니다.

Example

> caver.klay.getCommittee().then(console.log);
[
    "0x207e38864b45a538733741dc1ff92eff9d1a6159",
    "0x6d64bc82b93368a7f963d6c34483ca3893f405f6",
    "0xbc9c19f91878369776812039e4ebcdfa3c646716",
    "0xe3ed6fa287752b992f936b42360770c59731d9eb"
]

getCommitteeSize

caver.klay.getCommitteeSize([defaultBlock] [, callback])

Returns the size of the committee at the specified block. 매개변수를 설정하지 않으면 최신 블록에서의 위원회 구성원 수를 반환합니다.

Parameters

Name
Type
Description

defaultBlock

Number | String

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Number를 반환 - 위원회의 크기입니다.

Example

> caver.klay.getCommitteeSize().then(console.log);
4

getCouncil

참고: getValidators은 이 메서드로 대체되어 더 이상 지원하지 않습니다.

caver.klay.getCouncil([defaultBlock] [, callback])

Returns a list of all validators of the council at the specified block. 매개변수를 설정하지 않으면 최신 블록에서 council에 속한 검증자 목록을 반환합니다.

Parameters

Name
Type
Description

defaultBlock

Number | String

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Array를 반환 - 위원회에 있는 모든 검증자들의 주소들이 담긴 배열입니다.

Example

> caver.klay.getCouncil().then(console.log);
[
    "0x207e38864b45a538733741dc1ff92eff9d1a6159",
    "0x6d64bc82b93368a7f963d6c34483ca3893f405f6",
    "0xbc9c19f91878369776812039e4ebcdfa3c646716",
    "0xe3ed6fa287752b992f936b42360770c59731d9eb"
]

getCouncilSize

caver.klay.getCouncilSize([defaultBlock] [, callback])

Returns the size of the council at the specified block. 매개변수를 설정하지 않으면 최신 블록에서의 council 구성원 수를 반환합니다.

Parameters

Name
Type
Description

defaultBlock

Number | String

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Number를 반환 - 카운슬의 크기입니다.

Example

> caver.klay.getCouncilSize().then(console.log);
4

getStorageAt

caver.klay.getStorageAt(address, position [, defaultBlock] [, callback])

주소를 사용해 특정 위치에 있는 스토리지를 반환합니다.

Parameters

Name
Type
Description

address

String

The address to get the storage from.

position

Number

The index position of the storage.

defaultBlock

Number | String

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 String을 반환 - 주어진 위치의 스토리지에 있는 값입니다.

Example

> caver.klay.getStorageAt("0x407d73d8a49eeb85d32cf465507dd71d507100c1", 0).then(console.log);
"0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"

isMining

caver.klay.isMining([callback])

Returns true if client is actively mining new blocks.

Parameters

Name
Type
Description

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Boolean을 반환합니다 - 클라이언트가 블록을 채굴중이면 true, 그렇지 않을 경우 false.

Example

> caver.klay.isMining().then(console.log);
true

isSyncing

caver.klay.isSyncing([callback])

노드가 현재 싱크중인지 확인하고 싱크중이면 싱크 객체를 반환하고 싱크중이 아니면 false를 반환합니다.

Parameters

Name
Type
Description

callback

Function

(optional) Optional callback, returns an error object as the first parameter and the result as the second.

Return Value

프로미스는 Object|Boolean을 반환 - 노드가 현재 싱크중이면 싱크 객체를 반환하고 싱크중이 아니면 false를 반환합니다.

Name
Type
Description

startingBlock

Number

싱크가 시작된 블록의 번호입니다.

currentBlock

Number

현재 노드가 이미 싱크한 상태인 블록의 블록 번호입니다.

highestBlock

Number

싱크해야 할 블록 번호 추정값입니다.

knownStates

Number

앞으로 다운로드할 상태(state) 추정값입니다.

pulledStates

Number

이미 다운로드한 상태(state)입니다.

Example

> caver.klay.isSyncing().then(console.log);
{
    startingBlock: 100,
    currentBlock: 312,
    highestBlock: 512,
    knownStates: 234566,
    pulledStates: 123455
}

(optional) If you pass this parameter, it will not use the default block set with .

(optional) If you pass this parameter, it will not use the default block set with .

(optional) If you pass this parameter, it will not use the default block set with .

(optional) If you pass this parameter, it will not use the default block set with .

(optional) If you pass this parameter, it will not use the default block set with .

caver.klay.defaultBlock
caver.klay.defaultBlock
caver.klay.defaultBlock
caver.klay.defaultBlock
caver.klay.defaultBlock
caver.klay.getStorageAt()
new caver.klay.Contract()
myContract.methods.myMethod().call()
caver.klay.getBalance()
caver.klay.getCode()
caver.klay.getTransactionCount()
caver.klay.call()