[Transaction] eth_signTransaction
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: Create an account into the EN node
- Step 3: Unlock the account for using in signing
JSONRPC: eth_signTransaction
Request
- application/json
Body
Array [
]
Default value: eth_signTransaction
Method name
Default value: 1
Request ID, Random or Auto incrementation
Default value: 2.0
JSON-RPC Version (2.0)
params
object[]
The address from which the transaction is sent.
(not required when creating a new contract) The address to which the transaction is directed.
The integer of the gas provided for the transaction's execution. It will return unused gas.
The maximum amount to pay for the transaction's execution. Since Klaytn uses a fixed gas price, it must be set to 250 ston (Gpeb in Ethereum).
Gas tip cap for dynamic fee transaction in peb. Since Klaytn uses a fixed gas price, it must be set to 250 ston (Gpeb in Ethereum).
(optional) The hash of the method signature and the encoded parameter. It replaces data field, but 'data` field is still supported for backward compatibility.
(optional) The integer of values sent with this transaction.
The integer of a nonce.
Responses
- 200
Return the signed transaction object.
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
Default value: 2.0
error
object
A Number that indicates the error type that occurred. This MUST be an integer.
| code | message | description | |-----|-----|-------| | -32700 | Parse error | invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. | |-32602 | Invalid params | Invalid method parameter(s). |
A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.
A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).
result
object
A rawTransaction string (a RLP-encoded transaction string).
tx
object
required
An integer representing the type of the transaction.
The block number where this transaction was in.
Gas price provided by the sender in peb. null when it is not a legacy transaction.
A maximum amount to pay for the transaction to execute. null when it is a legacy transaction.
Gas tip cap for dynamic fee transaction in peb. null when it is a legacy transaction.
Gas provided by the sender.
Integer of values sent with this transaction.
ECDSA recovery id.
ECDSA recovery r.
ECDSA recovery s.
Chain id set on the requested node.
accessList
object[]
required
Hash of the transaction.
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"code": -32700,
"message": "Parse error",
"data": "string"
},
"result": {
"raw": "0x02f86f8302edaf048505d21dba008505d21dba00829999948c9f4468ae04fb3d79c80f6eacf0e4e1dd21deee0180c001a0b6e16781d247b505aa8eaf363a6ea61e7c23c77ad64846ffda28e73e31304884a05a296904cd009506cb5ed006af016d2c5dab255966af9ba6f8fc352f75e9b079",
"tx": {
"type": "0x2",
"nonce": "0x4",
"gasPrice": null,
"maxPriorityFeePerGas": "0x5d21dba00",
"maxFeePerGas": "0x5d21dba00",
"gas": "0x9999",
"value": "0x1",
"input": "0x",
"v": "0x1",
"r": "0xb6e16781d247b505aa8eaf363a6ea61e7c23c77ad64846ffda28e73e31304884",
"s": "0x5a296904cd009506cb5ed006af016d2c5dab255966af9ba6f8fc352f75e9b079",
"to": "0x8c9f4468ae04fb3d79c80f6eacf0e4e1dd21deee",
"chainId": "0x2edaf",
"accessList": [],
"hash": "0x9cfbea4942b334050660ec7207f3323ee13e3196b06279f922404384acbf7b47"
}
}
}