Get Current MTP
get_current_mtp
The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured.
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| coin | string | ✓ | A compatible (UTXO) coin's ticker | |
| id | integer | – | null | Identifies a request to allow matching it with a response. |
Response Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| mtp | integer | ✓ | Unix timestamp | |
| id | integer | – | null | Identifies a response to allow matching it with a request. |
📌 Examples
POST Get Current MTP
get_current_mtp {
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
} curl --url "http://127.0.0.1:7783" --data '{
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"method":"get_current_mtp","userpass":"RPC_UserP@SSW0RD","mmrpc":"2.0","id":42,"params":{"coin":"DOC"}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"method": "get_current_mtp",
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"id": 42,
"params": {
"coin": "DOC"
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Get Current MTP Response
Response (success)
{
"mmrpc": "2.0",
"result": {
"mtp": 1658746383
},
"id": 42
}