On a Conflux network, when a transaction is sent using the cfx_sendRawTransaction method, if the transaction is not constructed correctly, the transaction will fail to be sent. Some of these errors are common, such as:

  • The nonce that has been executed is used
  • Nonce is used that has been sent to the trading pool

There are several other sending failures:

  • ChainId usage does not match
  • EpochHeight too big
  • Gas exceeding 1500w (half of block gas limit)
  • Gas xiao yu 21000
  • Data is too large (over 200K)
  • GasPrice is set to 0
  • Signature error
  • Trading with

The following is an RPC error returned by the cfx_sendRawTransaction method when the transaction fails to be sent

Nonce usage error

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\""}}Copy the code

In this case, you need to change the current available (unused) Nonce

Nonce is used that has been sent to the trading pool

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "\"tx already exist\""}}Copy the code

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 > {}"}}Copy the code

In these two cases, the transaction has been sent to the trading 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 the transaction

The nonce is too large. Procedure

The current NONCE for sending transactions cannot be too large. If the value 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\""}}Copy the code

gas

If the transaction gas is too small (<21000) or too large (> 1500W), the following error is returned:

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "\"NotEnoughBaseGas { required: 21000, got: 2000 }\""}}Copy the code
{
    "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\""}}Copy the code

gasPrice

Transaction gasPrice cannot be set to 0:

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "\"ZeroGasPrice\""}}Copy the code

data

Transaction size is limited, the maximum can not exceed 200K

epochHeight

If the transaction epochHeight exceeds 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 }\""}}Copy the code

Incorrect chainId usage

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "\"ChainIdMismatch { expected: 1, got: 2 }\""}}Copy the code

Encoding or signature error

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: raw"."data": "\"RlpIncorrectListLen\""}}Copy the code
{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "Can not recover pubkey for Ethereum like tx"}}Copy the code

Trading with

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "txpool is full"}}Copy the code

or

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "Failed imported to deferred pool: Transaction Pool is full"}}Copy the code

In this case, you can wait for a while to resend the transaction, and increasing the gasPrice of the transaction will help improve the probability of sending

other

The node is in catch-up mode. Procedure

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32077."message": "Request rejected due to still in the catch up mode."."data": null}}Copy the code

Send data after node data is synchronized to the latest

Internal error

{
    "jsonrpc": "2.0"."id": "15922956697249514502"."error": {
        "code": -32602."message": "Invalid parameters: tx"."data": "Failed to read account_cache from storage: {}"}}Copy the code