Show / Hide Table of Contents
Last modified: 2024-09-23

submitblock Method

Broadcasts a new block in the NEO network.

You must install the plugin RpcServer before you can invoke the method.

{
  "jsonrpc": "2.0",
  "method": "submitblock",
  "params": [base64],
  "id": 1
}

Parameter Description

base64: A Base64-encoded string of a serialized block.

Exception

  • -500, Inventory verification failed.

  • -501, Inventory already exists.

  • -502, Memory pool capacity reached.

  • -503, Already in pool.

  • -505, Policy check failed.

  • -506, Invalid transaction script.

  • -507, Invalid transaction attribute.

  • -508, Invalid signature.

  • -509, Invalid inventory size.

  • -510, Expired transaction.

  • -511, Insufficient funds for fee.

Example

Request body:

{
  "jsonrpc": "2.0",
  "method": "submitblock",
  "params": ["AAAAACMSKFbGpGl6t7uroMpi2ilhQd84eU/pUrRfQyswXYl76woLOY0oW1z4InfxoKyxFAAB+8FS6cRu2Pm0iaOiD8OMCnLadQEAAMgcAAD6lrDvowCyjK9dBALCmE1fvMuahQFCDEAd8EoEFBcxOLCZfh8w0tUEHHmyn++KzW4I8oeJ1WyMmjHVcolpNzOnAOzXTn/xujwy93gJ9ijvVo6wAF5qC3wCKxEMIQL4L//X3jDpIyMLze0sPNW+yFcufrrL3bnzOipdJpNLixELQRON768CAGUTt7+NSxXGAA7aoUS2kokAAAAAACYcEwAAAAAARzMAAAHNWK7P0zW+HrPTEeHcgAlj39ctnwEAXQMA5AtUAgAAAAwUzViuz9M1vh6z0xHh3IAJY9/XLZ8MFM1Yrs/TNb4es9MR4dyACWPf1y2fE8AMCHRyYW5zZmVyDBS8r0HWhMfUrW7g2Z2pcHudHwyOZkFifVtSOAFCDEADRhUarLK+/BBjhqaWY5ieento21zgkcsUMWNCBWGd+v8a35zatNRgFbUkni4dDNI/BGc3zOgPT6EwroUsgvR+KQwhAv3yei642bBp1hrlpk26E7iWN8VC2MdMXWurST/mONaPC0GVRA14"],
  "id": 1
}

Response body in successful cases:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "hash": "0xbe153a2ef9e9160906f7054ed8f676aa223a826c4ae662ce0fb3f09d38b093c1"
    }
}

Response body in unsuccessful cases:

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -500,
        "message": "AlreadyExists"
    }
}

Response Description:

When result is false, the block has failed to broadcast and an exception occurs. The following error codes can be expected

Error codesMessageDescription
500AlreadyExistsBlock or transaction already exists and cannot be sent repeatedly.
OutOfMemoryThe memory pool is full and no more transactions can be sent.
UnableToVerifyThe block cannot be validated.
InvalidThe format or parameter is incorrect
ExpiredThe block information is expired
InsufficientFundsInsufficient funds
PolicyFailThe behavior is not allowed (such as blacklist address trading)