The setban RPC attempts add or remove a IP/Subnet from the banned list.

Parameter #1—IP/Subnet of the node

Name Type Presence Description
IP(/Netmask) string Required
(exactly 1)
The node to add or remove as a string in the form of <IP address>. The IP address may be a hostname resolvable through DNS, an IPv4 address, an IPv4-as-IPv6 address, or an IPv6 address

Parameter #2—whether to add or remove the node

Name Type Presence Description
Command string Required
(exactly 1)
What to do with the IP/Subnet address above. Options are:
add to add a node to the addnode list
remove to remove a node from the list. If currently connected, this will disconnect immediately

Parameter #3—time how long the ip is banned

Name Type Presence Description
Bantime numeric
(0 or 1)
Time in seconds how long (or until when if absolute is set) the entry is banned. The default is 24h which can also be overwritten by the -bantime startup argument

Parameter #4—whether a relative or absolute timestamp

Name Type Presence Description
Absolute bool Optional
(0 or 1)
If set, the bantime must be a absolute timestamp in seconds since epoch (Jan 1 1970 GMT)

Result—null on success

Name Type Presence Description
result null Required
(exactly 1)
Always JSON null


Ban the following node.

pai-cli -testnet setban add 2592000

Result (no output from pai-cli because result is set to null).

See also

  • ListBanned: lists all banned IPs/Subnets.
  • ClearBanned: clears list of banned nodes.