Submit a block.
POSThttp://127.0.0.1:14265/api/core/v2/blocks
Submit a block. The node takes care of missing fields and tries to build the block. On success, the block will be stored in the Tangle. This endpoint will return the identifier of the built block. The node will try to auto-fill the following fields in case they are missing: parents
, nonce
. If payload
is missing, the block will be built without a payload. protocolVersion
is always required!
Request
- application/json
- application/vnd.iota.serializer-v1
Body
required
Protocol version number of the block. It also tells which protocol rules apply to the block.
The identifiers of the blocks this block references. Hex-encoded with 0x prefix.
payload object
The nonce which lets this block fulfill the Proof-of-Work requirement. Hex-encoded with 0x prefix.
Body
required
string
Responses
- 201
- 400
- 403
- 500
- 503
Successful operation.
Response Headers
- application/json
- Schema
- Example (from schema)
- default
Schema
The block identifier of the submitted block. Hex-encoded with 0x prefix.
{
"blockId": "string"
}
{
"blockId": "0xa4dd36465af63d495d35a05f592d42a51511c153e1bae8fad00453c8cbb48727"
}
Unsuccessful operation: indicates that the provided data is invalid.
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 400,
"message": "invalid data provided"
}
}
Unsuccessful operation: indicates that the endpoint is not available for public use.
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 403,
"message": "not available for public use"
}
}
Unsuccessful operation: indicates that an unexpected, internal server error happened which prevented the node from fulfilling the request.
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 500,
"message": "internal server error"
}
}
Unsuccessful operation: indicates that the node can´t auto-fill the parents or perform Proof-of-Work.
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 503,
"message": "service unavailable"
}
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'http://127.0.0.1:14265/api/core/v2/blocks' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"protocolVersion": 0,
"parents": [
"string"
],
"payload": {
"type": 0,
"essence": {
"type": 0,
"networkId": "string",
"inputsCommitment": "string",
"inputs": [
{
"type": 0,
"transactionId": "string",
"transactionOutputIndex": 0
}
],
"outputs": [
{
"type": 0,
"amount": "string",
"nativeTokens": [
{
"id": "string",
"amount": "string"
}
],
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"returnAddress": {
"type": 0,
"pubKeyHash": "string"
},
"returnAmount": "string"
},
{
"type": 0,
"unixTime": 0
},
{
"type": 0,
"returnAddress": {
"type": 0,
"pubKeyHash": "string"
},
"unixTime": 0
}
],
"features": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"data": "string"
},
{
"type": 0,
"tag": "string"
}
]
},
{
"type": 0,
"amount": "string",
"nativeTokens": [
{
"id": "string",
"amount": "string"
}
],
"aliasId": "string",
"stateIndex": 0,
"stateMetadata": "string",
"foundryCounter": 0,
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
}
],
"features": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"data": "string"
}
],
"immutableFeatures": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"data": "string"
}
]
},
{
"type": 0,
"amount": "string",
"nativeTokens": [
{
"id": "string",
"amount": "string"
}
],
"serialNumber": 0,
"tokenScheme": [
{
"type": 0,
"mintedTokens": "string",
"meltedTokens": "string",
"maxSupply": "string"
}
],
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"aliasId": "string"
}
}
],
"features": [
{
"type": 0,
"data": "string"
}
],
"immutableFeatures": [
{
"type": 0,
"data": "string"
}
]
},
{
"type": 0,
"amount": "string",
"nativeTokens": [
{
"id": "string",
"amount": "string"
}
],
"nftId": "string",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"returnAddress": {
"type": 0,
"pubKeyHash": "string"
},
"returnAmount": "string"
},
{
"type": 0,
"unixTime": 0
},
{
"type": 0,
"returnAddress": {
"type": 0,
"pubKeyHash": "string"
},
"unixTime": 0
}
],
"features": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"data": "string"
},
{
"type": 0,
"tag": "string"
}
],
"immutableFeatures": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "string"
}
},
{
"type": 0,
"data": "string"
}
]
}
],
"payload": {
"type": 0,
"tag": "string",
"data": "string"
}
},
"unlocks": [
{
"type": 0,
"signature": {
"type": 0,
"publicKey": "string",
"signature": "string"
}
},
{
"type": 0,
"reference": 0
},
{
"type": 0,
"reference": 0
},
{
"type": 0,
"reference": 0
}
]
},
"nonce": "string"
}'