Skip to content
IEC 62541

OPC UA

The interoperability standard of industrial automation, with a browsable address space and built-in security.

Transport
UA-TCP (opc.tcp)
Default port
4840
Library
go-opcua
CLI
opcuactl

OPC Unified Architecture (OPC UA) is the interoperability standard of industrial automation. A server exposes an address space: a graph of nodes (objects, variables, methods) identified by NodeIds. Clients browse that graph, read and write values, call methods, and subscribe to data changes and events, over secure channels with X.509 certificates.

Where you meet it

  • PLCs and controllers from most major vendors
  • SCADA, MES and historian servers
  • Industrial gateways that translate fieldbus protocols into a single OPC UA model

Quickstart

From the command line

Download opcuactl from GitHub Releases, then:

Terminal window
# List endpoints and their security configurations
opcuactl discover endpoints -e opc.tcp://localhost:4840
# Browse the address space
opcuactl browse children -e opc.tcp://localhost:4840
# Read a value (anonymous / None, fine for lab servers)
opcuactl get value -e opc.tcp://localhost:4840 -n i=2258
# Monitor live value changes
opcuactl monitor value -e opc.tcp://localhost:4840 -n i=2258

For production servers, connect securely with endpoint auto-selection:

Terminal window
opcuactl get value -e opc.tcp://plc.example:4840 -n i=2258 \
--auth username --username operator --password "$OPCUACTL_PASSWORD" \
--security-policy auto --security-mode auto \
--cert ./pki/client.pem --key ./pki/client.key \
--trusted-cert ./pki/server-ca.pem

From Go

Terminal window
go get github.com/otfabric/go-opcua

Read the server’s current time:

main.go
package main
import (
"context"
"fmt"
"log"
"github.com/otfabric/go-opcua"
"github.com/otfabric/go-opcua/ua"
)
func main() {
ctx := context.Background()
c, err := opcua.NewClient("opc.tcp://localhost:4840")
if err != nil {
log.Fatal(err)
}
if err := c.Connect(ctx); err != nil {
log.Fatal(err)
}
defer c.Close(ctx)
v, err := c.Node(ua.MustParseNodeID("i=2258")).Value(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println("Server time:", v.Value())
}

What go-opcua supports

Roles Client and server
Transport UA-TCP (opc.tcp://), including reverse connect. HTTPS and WebSockets are not supported.
Encoding OPC UA Binary on the wire; JSON and XML for values
Security None, Sign and SignAndEncrypt; RSA policies from Basic128Rsa15 to Aes256Sha256RsaPss, and ECC nistP256, nistP384 and curve25519
Services Browse, read, write, subscriptions, events, method calls, historical access
Not implemented PubSub; brainpool and curve448 ECC policies
Go version 1.26 or later

Interoperability

opcua-interop runs go-opcua in all applicable client and server directions against open62541 (C) and Eclipse Milo (Java).

OT Fabric projects for OPC UA

go-opcua

OPC UA client and server: secure channels, subscriptions, events, methods and historical access.

go get github.com/otfabric/go-opcua

opcuactl

Discover, browse, read, write, call methods, monitor, read history and export from OPC UA servers.

opcua-interop

OPC UA reference clients and servers based on open62541 and Eclipse Milo.