In the Conflux network, cfx_sendRawTransaction
method, if the transaction structure is incorrect, the sending will fail. Some of these errors are more common, such as:
- Used nonce that has been executed
- Used the nonce that has been sent to the transaction pool
In addition, there are several situations where sending fails:
- chainId usage does not match
- epochHeight is too large
- Gas exceeds 1500w (half of block gas limit)
- gas less than 21000
- data is too large (more than 200K)
- gasPrice is set to 0
- Signature error
- Trading pool full
The following is the RPC error returned by the cfx_sendRawTransaction
method when the transaction fails to be sent
Wrong use of nonce
The nonce that has been executed is used
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"Transaction 0x4a2cfa73267139d965ab86d41f2af16db09e62ff92a5abffd7f8e743f36f327c is discarded due to a too stale nonce\""
}
}
In this case, it needs to be changed to the currently available (unused) nonce
Used the nonce that has been sent to the transaction pool
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"tx already exist\""
}
}
or
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "Tx with same nonce already inserted. To replace it, you need to specify a gas price > {}"
}
}
In these two cases, the transaction has been sent to the transaction pool. If you want to update or replace the transaction, you can use the same nonce, modify the corresponding field, and increase the gasPrice to resend
Used too big nonce
The nonce for sending the transaction cannot be currency. The current nonce is too large. If it exceeds 2000, the following error will be encountered:
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"Transaction 0xc875a03e1ce01268931a1a428d8f8313714ab5eb9c2b626bd327af7e5c3e8c03 is discarded due to in too distant future\""
}
}
gas
If the transaction gas is too small ( <21000
) or too large ( >1500w
), the following error will be returned:
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"NotEnoughBaseGas { required: 21000, got: 2000 }\""
}
}
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"transaction gas 20000000 exceeds the maximum value 15000000, the half of pivot block gas limit\""
}
}
gasPrice
The gasPrice of the transaction cannot be set to 0:
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"ZeroGasPrice\""
}
}
data
There is a size limit for the transaction, and the maximum cannot exceed 200k
epochHeight
If the epochHeight of the transaction is more than 10w compared with the epochNumber of the current network, the following error will be encountered:
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"EpochHeightOutOfBound { block_height: 53800739, set: 0, transaction_epoch_bound: 100000 }\""
}
}
chainId use error
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "\"ChainIdMismatch { expected: 1, got: 2 }\""
}
}
Encoding or signature error
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: raw",
"data": "\"RlpIncorrectListLen\""
}
}
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "Can not recover pubkey for Ethereum like tx"
}
}
Trading pool full
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "txpool is full"
}
}
or
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "Failed imported to deferred pool: Transaction Pool is full"
}
}
In this case, you can wait for a while to resend the transaction. Increasing the gasPrice of the transaction will help increase the probability of sending
other
Node is in catch-up mode
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32077,
"message": "Request rejected due to still in the catch up mode.",
"data": null
}
}
Wait until the node data is synchronized to the latest before sending
internal error
{
"jsonrpc": "2.0",
"id": "15922956697249514502",
"error": {
"code": -32602,
"message": "Invalid parameters: tx",
"data": "Failed to read account_cache from storage: {}"
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。