> For the complete documentation index, see [llms.txt](https://archive-ko.docs.klaytn.foundation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://archive-ko.docs.klaytn.foundation/content/dapp/sdk/caver-js/v1.4.1.md).

# caver-js \~v1.4.1

`caver-js`는 개발자가 HTTP 또는 웹소켓 연결을 사용하여 Klaytn 노드와 상호작용할 수 있도록 하는 자바스크립트 API 라이브러리입니다. [npm](https://www.npmjs.com/package/caver-js) 이용이 가능합니다.

## Features <a href="#features" id="features"></a>

* HTTP 및 웹소켓을 통한 Klaytn의 JSON-RPC 클라이언트 API의 완전한 구현
* Klaytn 트랜잭션, 계정 및 계정 키 유형 지원
* Klaytn 네트워크에서 스마트 컨트랙트를 배포하고 실행하기 위한 자바스크립트 스마트 컨트랙트 패키지
* Klaytn 계정 관리를 위한 인메모리 지갑
* 수수료 위임 지원
* Klaytn Wallet 키 형식 지원
* RLP에서 트랜잭션 오브젝트의 인코딩/디코딩
* 트랜잭션 객체의 서명
* web3-js 애플리케이션을 caver-js로 쉽게 포팅

## caver-js의 패키지 <a href="#packages-in-caver-js" id="packages-in-caver-js"></a>

Below are packages provided in `caver-js`.

* [caver.klay](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay.md)
* [caver.klay.accounts](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay.accounts.md)
* [caver.klay.Contract](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay.contract.md)
* [caver.klay.net](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay.net.md)
* [caver.klay.abi](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay.abi.md)
* [caver.utils](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.utils_1.4.1.md)

## 오류 코드 개선 <a href="#error-code-improvement" id="error-code-improvement"></a>

The error messages from Ethereum via web3.js are hardly figuring out where the error occurs. `caver-js` improves the interface to catch error messages from Klaytn.

More details can be found in the value of `txError` of the transaction receipt like the below:

```
Error: runtime error occurred in interpreter
 {
  "blockHash": "0xe7ec35c9fff1178d52cee1d46d40627d19f828c4b06ad1a5c3807698b99acb20",
  "blockNumber": 7811,
  "contractAddress": null,
  "from": "0xa8a2d37727197cc0eb827f8c5a3a3aceb26cf59e",
  "gasUsed": 9900000000,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": false,
  "to": "0xf8425b0f65147969621f9390ca06139c7b439497",
  "transactionHash": "0x85ce2b307899c90144442d9b3236827ac57375c522be2435093aebfd920b8c58",
  "transactionIndex": 0,
  "txError": "0x2",
  "events": {}
}
```

## Caution when Sending a Transaction to Klaytn <a href="#caution-when-sending-a-transaction-to-klaytn" id="caution-when-sending-a-transaction-to-klaytn"></a>

Klaytn은 고정된 가스 가격 (25 ston = 25 \* 10^9)을 사용합니다. Klaytn 네트워크에 제출된 다른 가스 가격의 트랜잭션은 거절됩니다. 가스 가격에 대한 자세한 내용은 [Gas and Unit Price Overview](/content/klaytn/design/transaction-fees.md#gas-and-unit-price-overview)를 참조하세요. 네트워크에서 사용되는 가스 가격은 [caver.klay.getGasPrice](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay/config.md#getgasprice)를 사용하여 얻을 수 있습니다.

만일 트랜잭션을 서명할 때나 제출할 때 `gasPrice`가 정의되지 않았을 경우, caver-js는 트랜잭션 가스 가격을 설정하기 위해 [caver.klay.getGasPrice](/content/dapp/sdk/caver-js/v1.4.1/api-references/caver.klay/config.md#getgasprice) RPC 호출을 사용합니다.

## Links <a href="#links" id="links"></a>

* caver-js [GitHub repository](https://github.com/klaytn/caver-js)
* caver-js on [npm](https://www.npmjs.com/package/caver-js)
