serverVersion

Electrum for Bitcoin

Overview

The server.version method allows a client to identify itself to the server and negotiate the protocol version. It is important that only the first server.version message is accepted by the server after connection establishment.

Parameters

NameTypeRequiredDescription
client_namestringYesA string identifying the connecting client software.
protocol_versionmixedYesAn array [protocol_min, protocol_max] or a single string for equal values.

Returns

Upon a successful request, the server responds with the negotiated protocol version and server information. The response's result field contains an array with two elements:

FieldDescription
Server NameThe name and version of the Electrum server.
ProtocolThe negotiated protocol version between client and server.

Example response

{
  "result": ["electrs/0.10.4", "1.4"]
}

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/bitcoin-mainnet-electrs/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
    "method": "server.version",
    "params": ["TatumClient", "1.4"],
    "id": 1,
    "jsonrpc": "2.0"
}'
// yarn add @tatumio/tatum

import { TatumSDK, BitcoinElectrs, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<BitcoinElectrs>({ network: Network.BITCOIN_ELECTRS })

const serverVersion = await tatum.rpc.getServerVersion({
  client_name: 'TatumClient',
  protocol_version: '1.4',
})

console.log(serverVersion)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs