Create an identity document and read it back from chain.
from peaq_robot import PeaqRobot

sdk = PeaqRobot()

# Minimal (defaults id/controller to your address)
try:
    tx = sdk.id.create_identity()
    print(tx)
except Exception:
    # Identity may already exist
    pass

# Optional: create with a custom name (idempotent)
try:
    _ = sdk.id.create_identity(name=f"did:peaq:{sdk.address}")
except Exception:
    pass

doc = sdk.id.read_identity()
print(doc["decoded_data"])  # parsed document if available
Response example:
{
  "exists": true,
  "read_status": "success",
  "did_account": "5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
  "name": "identity:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
  "value": "0x0a3f...",
  "decoded_data": {
    "id": "did:peaq:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
    "controller": "did:peaq:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
    "verificationMethods": [
      {
        "id": "did:peaq:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8#keys-1",
        "type": "Sr25519VerificationKey2020",
        "controller": "did:peaq:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
        "publicKeyMultibase": "6c97e334e9199cd21944c6882f6222a1b8f5be2ff3b860021f4a074ad4d8d802"
      }
    ],
    "authentications": [
      "did:peaq:5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8#keys-1"
    ],
    "services": [],
    "signature": {
      "type": "Sr25519VerificationKey2020",
      "issuer": "5EX69aaLFLyDxNcbxVd3Y4FVxjyHTCXtLDx9scg3uQSXF3r8",
      "hash": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"
    }
  }
}
Fields:
  • exists, read_status
  • name, value (encoded string or raw)
  • decoded_data with verificationMethods, authentications, services, signature