Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update rpc docs #31

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions documentation/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ paths:
$ref: ../web3rpc/rpc-specs/paths/kaia/configuration/clientVersion.yaml#/paths/~1kaia~1configuration~1clientVersion
/kaia/configuration/gasPrice:
$ref: ../web3rpc/rpc-specs/paths/kaia/configuration/gasPrice.yaml#/paths/~1kaia~1configuration~1gasPrice
/kaia/configuration/gasPriceAt:
$ref: ../web3rpc/rpc-specs/paths/kaia/configuration/gasPriceAt.yaml#/paths/~1kaia~1configuration~1gasPriceAt
# /kaia/configuration/gasPriceAt: # removed
# $ref: ../web3rpc/rpc-specs/paths/kaia/configuration/gasPriceAt.yaml#/paths/~1kaia~1configuration~1gasPriceAt
/kaia/configuration/getChainConfig:
$ref: ../web3rpc/rpc-specs/paths/kaia/configuration/getChainConfig.yaml#/paths/~1kaia~1configuration~1getChainConfig
/kaia/configuration/isParallelDBWrite:
Expand Down Expand Up @@ -350,8 +350,8 @@ paths:
$ref: ../web3rpc/rpc-specs/paths/klay/gas/upperBoundGasPrice.yaml#/paths/~1klay~1gas~1upperBoundGasPrice
/klay/gas/gasPrice:
$ref: ../web3rpc/rpc-specs/paths/klay/gas/gasPrice.yaml#/paths/~1klay~1gas~1gasPrice
/klay/gas/gasPriceAt:
$ref: ../web3rpc/rpc-specs/paths/klay/gas/gasPriceAt.yaml#/paths/~1klay~1gas~1gasPriceAt
# /klay/gas/gasPriceAt: // removed
# $ref: ../web3rpc/rpc-specs/paths/klay/gas/gasPriceAt.yaml#/paths/~1klay~1gas~1gasPriceAt
# klay/miscellaneous
/klay/miscellaneous/getStakingInfo:
$ref: ../web3rpc/rpc-specs/paths/klay/miscellaneous/getStakingInfo.yaml#/paths/~1klay~1miscellaneous~1getStakingInfo
Expand Down
2 changes: 0 additions & 2 deletions documentation/namespaces/kaia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ paths:
$ref: ../../web3rpc/rpc-specs/paths/kaia/configuration/chainID.yaml#/paths/~1kaia~1configuration~1chainID
/kaia/configuration/clientVersion:
$ref: ../../web3rpc/rpc-specs/paths/kaia/configuration/clientVersion.yaml#/paths/~1kaia~1configuration~1clientVersion
/kaia/configuration/gasPriceAt:
$ref: ../../web3rpc/rpc-specs/paths/kaia/configuration/gasPriceAt.yaml#/paths/~1kaia~1configuration~1gasPriceAt
/kaia/configuration/gasPrice:
$ref: ../../web3rpc/rpc-specs/paths/kaia/configuration/gasPrice.yaml#/paths/~1kaia~1configuration~1gasPrice
/kaia/configuration/isParallelDBWrite:
Expand Down
2 changes: 0 additions & 2 deletions documentation/namespaces/klay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ paths:
$ref: ../../web3rpc/rpc-specs/paths/klay/gas/upperBoundGasPrice.yaml#/paths/~1klay~1gas~1upperBoundGasPrice
/klay/gas/maxPriorityFeePerGas:
$ref: ../../web3rpc/rpc-specs/paths/klay/gas/maxPriorityFeePerGas.yaml#/paths/~1klay~1gas~1maxPriorityFeePerGas
/klay/gas/gasPriceAt:
$ref: ../../web3rpc/rpc-specs/paths/klay/gas/gasPriceAt.yaml#/paths/~1klay~1gas~1gasPriceAt
/klay/gas/gasPrice:
$ref: ../../web3rpc/rpc-specs/paths/klay/gas/gasPrice.yaml#/paths/~1klay~1gas~1gasPrice
# klay/miscellaneous
Expand Down
12 changes: 3 additions & 9 deletions web3rpc/rpc-specs/paths/eth/account/sign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@ paths:
- eth
operationId: sign
description: |
The sign method calculates a Klaytn-specific signature with:
The method calculates an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) signature: ```sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))```

sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))
**NOTE**: In versions earlier than Kaia v1.0.1, the method calculates an [KIP-97](https://kips.kaia.io/KIPs/kip-97) signature: sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))

Adding a prefix to the message makes the calculated signature recognizable as a Klaytn-specific signature. This prevents misuse where a malicious dApp signs arbitrary data (e.g. transaction) and uses the signature for impersonation.

`eth_sign` will be failed to baobab/cypress network because it is signed in the EN node, which means that the EN must have the key that you want to sign with.
Steps to test `eth_sign`.
- Step 1: Setup a local EN node
- Step 2: <a href="#tag/personal/operation/newAccount" target="_blank">Create an account</a> into the EN node
- Step 3: <a href="#tag/personal/operation/unlockAccount" target="_blank">Unlock the account</a> for using in signing
The personal_ecRecover and kaia_recoverFromMessage methods can verify the signature.

**JSONRPC:** `eth_sign`

Expand Down
13 changes: 6 additions & 7 deletions web3rpc/rpc-specs/paths/eth/gas/gasPrice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ paths:
- eth
operationId: gasPrice
description: |
Returns a suggested gasPrice or maxFeePerGas. The suggested price depends on the hardfork status.
- Fixed unit price before Magma
- Twice the base fee before Kaia
- Base fee plus suggested priority fee after Kaia
Returns a recommended gasPrice for a new transaction.

**NOTE:** This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.
- Before Magma, returns the fixed UnitPrice
- After Magma, returns the twice of next baseFee (2*baseFee)
- After Kaia, returns slightly buffered baseFee plus recommended tip (BaseFee * (1.10 or 1.15) + eth_maxPriorityFeePerGas)

**JSONRPC:** `eth_gasPrice`

Expand All @@ -40,7 +39,7 @@ paths:

responses:
200:
description: Suggested price in kei.
description: Recommended gas price in kei.
content:
application/json:
schema:
Expand Down Expand Up @@ -74,5 +73,5 @@ components:
result:
type: string
format: hex
description: Suggested price in kei.
description: Recommended gas price in kei.
example: "0xAE9F7BCC00"
13 changes: 7 additions & 6 deletions web3rpc/rpc-specs/paths/eth/gas/maxPriorityFeePerGas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ paths:
- eth
operationId: maxPriorityFeePerGas
description: |
Returns a suggested gasPrice or maxPriorityFeePerGas. The suggested price depends on the hardfork status.
- Fixed unit price before Magma
- Zero before Kaia
- Suggested priority fee from fee history, after Kaia
Returns a recommended maxPriorityFeePerGas for a new transaction.

- Before Magma, returns the fixed UnitPrice
- After Magma, returns zero
- After Kaia, returns zero if network is uncongested (i.e. next baseFee at its lower bound), otherwise 60% percentile effective tip from previous 20 blocks (under default setting)

**NOTE:** This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.

Expand All @@ -36,7 +37,7 @@ paths:

responses:
200:
description: Suggested price in kei
description: Recommended maxPriorityFeePerGas in kei.
content:
application/json:
schema:
Expand Down Expand Up @@ -76,6 +77,6 @@ components:
properties:
result:
type: string
description: Suggested price in kei
description: Recommended maxPriorityFeePerGas in kei.
format: hex
example: "0xAE9F7BCC00"
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ paths:
description: |
Signs a transaction that can be submitted to the network at a later time using with eth_sendRawTransaction.

`eth_signTransaction` will be failed to baobab/cypress network because it is signed in the EN node, which means that the EN must have the key that you want to sign with.
Steps to test `eth_signTransaction`.
- Step 1: Setup a local EN node
- Step 2: <a href="#tag/personal/operation/newAccount" target="_blank">Create an account</a> into the EN node
- Step 3: <a href="#tag/personal/operation/unlockAccount" target="_blank">Unlock the account</a> for using in signing

**JSONRPC:** `eth_signTransaction`

parameters:
Expand Down
12 changes: 3 additions & 9 deletions web3rpc/rpc-specs/paths/kaia/account/sign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ paths:
operationId: .sign
summary: "[Account] kaia_sign"
description: |
The sign method calculates a Klaytn-specific signature with:
The method calculates an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) signature: ```sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))```

sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))
**NOTE**: In versions earlier than Kaia v1.0.1, the method calculates an [KIP-97](https://kips.kaia.io/KIPs/kip-97) signature: sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))

Adding a prefix to the message makes the calculated signature recognizable as a Klaytn-specific signature. This prevents misuse where a malicious dApp can sign arbitrary data, e.g., transaction, and use the signature to impersonate the victim.

`kaia_sign` will be failed to baobab/cypress network because it is signed in the EN node, which means that the EN must have the key that you want to sign with.
Steps to test `kaia_sign`.
- Step 1: Setup a local EN node
- Step 2: <a href="#tag/personal/operation/newAccount" target="_blank">Create an account</a> into the EN node
- Step 3: <a href="#tag/personal/operation/unlockAccount" target="_blank">Unlock the account</a> for using in signing
The personal_ecRecover and kaia_recoverFromMessage methods can verify the signature.

**JSONRPC:** `kaia_sign`

Expand Down
12 changes: 8 additions & 4 deletions web3rpc/rpc-specs/paths/kaia/configuration/gasPrice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ paths:
operationId: .gasPrice
summary: "[Configuration] kaia_gasPrice"
description: |
Returns a suggestion for a gas price in peb.

Returns a recommended gasPrice for a new transaction.

- Before Magma, returns the fixed UnitPrice
- After Magma, returns the twice of next baseFee (2*baseFee)
- After Kaia, returns slightly buffered baseFee plus recommended tip (BaseFee * (1.10 or 1.15) + eth_maxPriorityFeePerGas)

**JSONRPC:** `kaia_gasPrice`
tags:
- kaia
Expand All @@ -35,7 +39,7 @@ paths:

responses:
200:
description: Returns a suggestion for a gas price in peb.
description: Recommended gas price in kei.
content:
application/json:
schema:
Expand All @@ -46,7 +50,7 @@ paths:
result:
type: string
format: hex
description: "Integer of the current gas price in peb"
description: Recommended gas price in kei.
example: "0xAE9F7BCC00"

x-codeSamples:
Expand Down
99 changes: 0 additions & 99 deletions web3rpc/rpc-specs/paths/kaia/configuration/gasPriceAt.yaml

This file was deleted.

10 changes: 7 additions & 3 deletions web3rpc/rpc-specs/paths/kaia/gas/maxPriorityFeePerGas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ paths:
operationId: .maxPriorityFeePerGas
summary: "[Gas] kaia_maxPriorityFeePerGas"
description: |
Returns a suggestion for a gas tip cap for dynamic fee transactions in peb.
Returns a recommended maxPriorityFeePerGas for a new transaction.

- Before Magma, returns the fixed UnitPrice
- After Magma, returns zero
- After Kaia, returns zero if network is uncongested (i.e. next baseFee at its lower bound), otherwise 60% percentile effective tip from previous 20 blocks (under default setting)

**NOTE:** This API is effective after Klaytn v1.8.0

Expand All @@ -38,7 +42,7 @@ paths:

responses:
200:
description: Returns a suggestion for a gas tip cap for dynamic fee transactions in peb.
description: Recommended maxPriorityFeePerGas in kei.
content:
application/json:
schema:
Expand All @@ -49,7 +53,7 @@ paths:
result:
type: string
format: hex
description: "Integer of the current max priority fee per gas"
description: Recommended maxPriorityFeePerGas in kei.
example: "0xAE9F7BCC00"

x-codeSamples:
Expand Down
2 changes: 0 additions & 2 deletions web3rpc/rpc-specs/paths/kaia/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ paths:
$ref: ./configuration/chainID.yaml#/paths/~1kaia~1configuration~1chainID
/kaia/configuration/clientVersion:
$ref: ./configuration/clientVersion.yaml#/paths/~1kaia~1configuration~1clientVersion
/kaia/configuration/gasPriceAt:
$ref: ./configuration/gasPriceAt.yaml#/paths/~1kaia~1configuration~1gasPriceAt
/kaia/configuration/gasPrice:
$ref: ./configuration/gasPrice.yaml#/paths/~1kaia~1configuration~1gasPrice
/kaia/configuration/isParallelDBWrite:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ paths:
operationId: .recoverFromMessage
summary: "[Miscellaneous] kaia_recoverFromMessage"
description: |
Using this API, users can recover from message data.
This method recovers or verifies an ECDSA signature signed by a private key associated with the given address.

The signature has to be signed by the private key that constitutes the account, e.g. "natural" private key of a Legacy account, one of the keys of a WeightedMultisig account.

Both [EIP-191](https://eips.ethereum.org/EIPS/eip-191) and [KIP-97](https://kips.kaia.io/KIPs/kip-97) signatures are accepted.

**JSONRPC:** `kaia_recoverFromMessage`
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ paths:
description: |
Constructs a transaction with given parameters and signs the transaction with a fee payer's private key. This method can be used either to generate a fee payer signature or to make a final raw transaction that is ready to submit to Klaytn network. In case you just want to extract the fee-payer signature, simply take the feePayerSignatures from the result. Note that the raw transaction is not final if the sender's signature is not attached (that is, signatures in tx is empty).

`kaia_signTransactionAsFeePayer` will be failed to baobab/cypress network because it is signed in the EN node, which means that the EN must have the key that you want to sign with.
Steps to test `kaia_signTransactionAsFeePayer`.
- Step 1: Setup a local EN node
- Step 2: <a href="#tag/personal/operation/newAccount" target="_blank">Create an account</a> into the EN node
- Step 3: <a href="#tag/personal/operation/unlockAccount" target="_blank">Unlock the account</a> for using in signing

**JSONRPC:** `kaia_signTransactionAsFeePayer`

tags:
Expand Down
12 changes: 3 additions & 9 deletions web3rpc/rpc-specs/paths/klay/account/sign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ paths:
operationId: sign
summary: "[Account] klay_sign"
description: |
The sign method calculates a Klaytn-specific signature with:
The method calculates an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) signature: ```sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))```

sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))
**NOTE**: In versions earlier than Kaia v1.0.1, the method calculates an [KIP-97](https://kips.kaia.io/KIPs/kip-97) signature: sign(keccak256("\x19Klaytn Signed Message:\n" + len(message) + message)))

Adding a prefix to the message makes the calculated signature recognizable as a Klaytn-specific signature. This prevents misuse where a malicious dApp can sign arbitrary data, e.g., transaction, and use the signature to impersonate the victim.

`klay_sign` will be failed to baobab/cypress network because it is signed in the EN node, which means that the EN must have the key that you want to sign with.
Steps to test `klay_sign`.
- Step 1: Setup a local EN node
- Step 2: <a href="#tag/personal/operation/newAccount" target="_blank">Create an account</a> into the EN node
- Step 3: <a href="#tag/personal/operation/unlockAccount" target="_blank">Unlock the account</a> for using in signing
The personal_ecRecover and kaia_recoverFromMessage methods can verify the signature.

**JSONRPC:** `klay_sign`

Expand Down
Loading
Loading