Real-time WebSocket subscriptions for monitoring blockchain state changes. Connect to ws://127.0.0.1:8900 when running Surfnet. Surfnet implements accountSubscribe, logsSubscribe, programSubscribe, signatureSubscribe and slotSubscribe; blockSubscribe, voteSubscribe and slotUpdatesSubscribe are listed for completeness but are not supported. In every notification the payload is wrapped in params.result, next to the subscription id.
accountSubscribe
Account subscribe endpoint specification
Parameters
Account public key to monitor (base-58 encoded)
Optional subscription configuration
{
"jsonrpc": "2.0",
"id": 1,
"method": "accountSubscribe",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
{
"commitment": "confirmed",
"encoding": "base64"
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
{
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": {
"slot": 457254896,
"apiVersion": "4.2.1"
},
"value": {
"lamports": 2000000000,
"data": [
"",
"base64"
],
"owner": "11111111111111111111111111111111",
"executable": false,
"rentEpoch": 0,
"space": 0
}
},
"subscription": 12345
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "accountUnsubscribe",
"params": [
12345
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
blockSubscribe
blockSubscribe - Subscribe to block updates
Not supported by Surfnet. blockSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.
logsSubscribe
logsSubscribe - Subscribe to transaction logs
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [
"all",
{
"commitment": "confirmed"
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
{
"jsonrpc": "2.0",
"method": "logsNotification",
"params": {
"result": {
"context": {
"slot": 457254896,
"apiVersion": "4.2.1"
},
"value": {
"signature": "3Vgn9jbnyRU48EHSbD47wXLDNV17vzcArFdmZAiN2NjGLpgvsRtkdgR8h5FnHj4ghWDD6nkxq78kPra2c5Gghijo",
"err": null,
"logs": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
]
}
},
"subscription": 12345
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsUnsubscribe",
"params": [
12345
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
programSubscribe
programSubscribe - Subscribe to program account changes
{
"jsonrpc": "2.0",
"id": 1,
"method": "programSubscribe",
"params": [
"11111111111111111111111111111111",
{
"commitment": "confirmed",
"encoding": "base64"
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
{
"jsonrpc": "2.0",
"method": "programNotification",
"params": {
"result": {
"context": {
"slot": 457254896,
"apiVersion": "4.2.1"
},
"value": {
"pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
"account": {
"lamports": 2000000000,
"data": [
"",
"base64"
],
"owner": "11111111111111111111111111111111",
"executable": false,
"rentEpoch": 0,
"space": 0
}
}
},
"subscription": 12345
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "programUnsubscribe",
"params": [
12345
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
signatureSubscribe
Signature subscribe endpoint specification
Parameters
Transaction signature to monitor (base-58 encoded)
Optional subscription configuration
{
"jsonrpc": "2.0",
"id": 1,
"method": "signatureSubscribe",
"params": [
"3Vgn9jbnyRU48EHSbD47wXLDNV17vzcArFdmZAiN2NjGLpgvsRtkdgR8h5FnHj4ghWDD6nkxq78kPra2c5Gghijo",
{
"commitment": "confirmed"
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
{
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": {
"slot": 457254448,
"apiVersion": "4.2.1"
},
"value": {
"err": null
}
},
"subscription": 12345
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "signatureUnsubscribe",
"params": [
12345
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
slotSubscribe
Slot subscribe endpoint specification
{
"jsonrpc": "2.0",
"id": 1,
"method": "slotSubscribe",
"params": []
}
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
{
"jsonrpc": "2.0",
"method": "slotNotification",
"params": {
"result": {
"slot": 457254897,
"parent": 457254896,
"root": 457254866
},
"subscription": 12345
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "slotUnsubscribe",
"params": [
12345
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
slotUpdatesSubscribe
slotUpdatesSubscribe - Subscribe to slot updates
Not supported by Surfnet. slotUpdatesSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.
voteSubscribe
voteSubscribe - Subscribe to vote account updates
Not supported by Surfnet. voteSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.