Register a protocol
curl --request POST \
--url https://app.blockgence.com/v1/guard/protocols \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"contracts": [
{
"address": "<string>",
"name": ""
}
],
"chain": "ethereum",
"rules": {},
"shared": false,
"events": [
{}
]
}
'import requests
url = "https://app.blockgence.com/v1/guard/protocols"
payload = {
"name": "<string>",
"contracts": [
{
"address": "<string>",
"name": ""
}
],
"chain": "ethereum",
"rules": {},
"shared": False,
"events": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
contracts: [{address: '<string>', name: ''}],
chain: 'ethereum',
rules: {},
shared: false,
events: [{}]
})
};
fetch('https://app.blockgence.com/v1/guard/protocols', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.blockgence.com/v1/guard/protocols",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'contracts' => [
[
'address' => '<string>',
'name' => ''
]
],
'chain' => 'ethereum',
'rules' => [
],
'shared' => false,
'events' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.blockgence.com/v1/guard/protocols"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.blockgence.com/v1/guard/protocols")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/guard/protocols")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Guard
Register a protocol
Registers a protocol and its contracts in Watchtower. Each contract is a Guard watch with
purpose: "protocol" and the protocol’s rules.
Body: {"name": "…", "chain": "ethereum", "contracts": [{"address": "0x…", "name": "…"}], "rules": {…}, "shared": false, "events": [...]}.
contracts: from 1 to 50. They count against the plan’s watch limit. Either all are registered or none.chain: only the networks listed inwatchtower.chainsofGET /v1/guard/status.rules: merged with the default rules (presets.protocolinGET /v1/guard/status):large_withdrawal: what leaves the contract in a transaction, net of what enters in the same transaction, in USD and only with priced assets. Thresholdmin_usd, US$1,000,000 by default. A flash loan that is repaid or a swap in a pool does not reach it.authority_change: a change of owner or admin, and granting, revoking or changing the administration role. Withall_roles: 1, any role.authority_transfer_started: the proposal of a new owner or admin in an OpenZeppelin two-step transfer, before it is accepted.proxy_upgrade: an upgrade of the proxy or the beacon.pause: pause and unpause.scheduled_change: a call scheduled in a timelock or a proposal of a governor registered as contracts of the protocol. It alerts before execution, with the effect of the call simulated on the state of the block in which it was scheduled. That state can change before execution, and a revert in the simulation does not mean the execution will fail.protocol_event: the custom events declared inevents.events: optional, custom events to monitor. Each one is{"signature": "Event(address indexed a, bool b)", "label": "…", "severity": "high", "contracts": ["0x…"]}.severityishighby default, and an emptycontractsapplies to all the protocol’s contracts. To choose it from the verified ABI, add"source": "abi", "abi_address": "0x…"(seeGET /v1/guard/protocols/{pid}/abi-events). Up to 30 events, signatures of up to 300 characters and up to 3 indexed parameters. Anonymous events, repeated events, events of contracts outside the protocol and events Guard already reads (the authority events,Transfer,Approval,ApprovalForAll,TransferSingle,TransferBatch,CallScheduled,QueueTransactionandProposalCreated) are not accepted.
Authority alerts and high or critical scheduled-change alerts are not lost to the daily alert cap. Custom event alerts have their own cap of 50 per contract per day. For a contract, Guard stores its authority events and those of the transactions with an alert, not every transfer.
Returns the created protocol, in the same shape as GET /v1/guard/protocols/{pid}.
Errors:
400: a network not available for Watchtower, an empty name, a number of contracts outside 1 to 50, an invalid or repeated address, an invalid rule,sharedwithout an organization, or an invalid event (including a contract without verified code or a signature that is not in its ABI).403: the contracts exceed the plan’s watch limit, or the API key is not assigned to a person.404: Watchtower is not enabled.409: one of the contracts is already monitored.422: the body contains an unknown field.502: the verified ABI that an event requires could not be read;detail.failuredescribes the failure.
Cost: free.
POST
/
v1
/
guard
/
protocols
Register a protocol
curl --request POST \
--url https://app.blockgence.com/v1/guard/protocols \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"contracts": [
{
"address": "<string>",
"name": ""
}
],
"chain": "ethereum",
"rules": {},
"shared": false,
"events": [
{}
]
}
'import requests
url = "https://app.blockgence.com/v1/guard/protocols"
payload = {
"name": "<string>",
"contracts": [
{
"address": "<string>",
"name": ""
}
],
"chain": "ethereum",
"rules": {},
"shared": False,
"events": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
contracts: [{address: '<string>', name: ''}],
chain: 'ethereum',
rules: {},
shared: false,
events: [{}]
})
};
fetch('https://app.blockgence.com/v1/guard/protocols', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.blockgence.com/v1/guard/protocols",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'contracts' => [
[
'address' => '<string>',
'name' => ''
]
],
'chain' => 'ethereum',
'rules' => [
],
'shared' => false,
'events' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.blockgence.com/v1/guard/protocols"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.blockgence.com/v1/guard/protocols")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/guard/protocols")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"contracts\": [\n {\n \"address\": \"<string>\",\n \"name\": \"\"\n }\n ],\n \"chain\": \"ethereum\",\n \"rules\": {},\n \"shared\": false,\n \"events\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Authorizations
APIKeyHeaderBearerAuth
Headers
Body
application/json
Response
Successful response.