IPC API
The IPC API allows users to create UNIX domain sockets for blockchains to publish to. When the blockchain accepts a vertex/block it will publish it to a socket and the decisions contained inside will be published to another.
A node will only expose this API if it is started with command line argument api-ipcs-enabled=true.

IPC Message Format

Socket messages consist of a 64bit integer in BigEndian format followed by that many bytes.
Example:
1
Sending:
2
[0x41, 0x76, 0x61, 0x78]
3
Writes to the socket:
4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41, 0x76, 0x61, 0x78]
Copied!

IPC Socket URL Format

The names of the sockets are of the form <network_id>-<chain_id>-<event_type> where <event_type> is either consensus or decisions. The consensus socket receives verticies and blocks and while the decisions socket recives individual transactions.

Format

This API uses the json 2.0 RPC format.

Endpoint

/ext/ipcs

Methods

ipcs.publishBlockchain

Register a blockchain so it publishes accepted vertices to a Unix domain socket.

Signature

1
ipcs.publishBlockchain({blockchainID: string}) -> {consensusURL: string, decisionsURL: string}
Copied!
    blockchainID is the blockchain that will publish accepted vertices.
    consensusURL is the path of the Unix domain socket the vertices are published to.
    decisionsURL is the path of the Unix domain socket the transactions are published to.

Example Call

1
curl -X POST --data '{
2
"jsonrpc": "2.0",
3
"method": "ipcs.publishBlockchain",
4
"params":{
5
"blockchainID":"11111111111111111111111111111111LpoYY"
6
},
7
"id": 1
8
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/ipcs
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"result":{
4
"decisionsURL":"/tmp/1-11111111111111111111111111111111LpoYY-consensus",
5
"consensusURL":"/tmp/1-11111111111111111111111111111111LpoYY-decisions"
6
},
7
"id":1
8
}
Copied!

ipcs.unpublishBlockchain

Deregister a blockchain so that it no longer publishes to a Unix domain socket.

Signature

1
ipcs.unpublishBlockchain({blockchainID: string}) -> {success: bool}
Copied!
    blockchainID is the blockchain that will no longer publish to a Unix domain socket.

Example Call

1
curl -X POST --data '{
2
"jsonrpc": "2.0",
3
"method": "ipcs.unpublishBlockchain",
4
"params":{
5
"blockchainID":"11111111111111111111111111111111LpoYY"
6
},
7
"id": 1
8
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/ipcs
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"result":{
4
"success":true
5
},
6
"id":1
7
}
Copied!
Last modified 10mo ago