# Blockchain

## Get the issuer's blockchain address

> Retrieves the blockchain address used by the issuer

```json
{"openapi":"3.0.0","info":{"title":"issuer-service","version":"1.0.0-rc2"},"servers":[{"url":"/"}],"security":[],"paths":{"/api/v1/blockchain/address":{"get":{"operationId":"GetBlockchainAddressHandler","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockchainAddressResponseDto"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"description":"Retrieves the blockchain address used by the issuer","summary":"Get the issuer's blockchain address","tags":["Blockchain"],"parameters":[]}}},"components":{"schemas":{"BlockchainAddressResponseDto":{"description":"Response DTO for blockchain address","properties":{"address":{"type":"string","description":"Blockchain address of the issuer","minLength":1,"pattern":"^0x[a-fA-F0-9]{40}$"}},"required":["address"],"type":"object","additionalProperties":false},"ErrorResponseDto":{"description":"Extended error response with HTTP details","properties":{"name":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"code":{"type":"number","format":"double","description":"Error code"},"statusCode":{"type":"number","format":"double","description":"HTTP status code"},"httpCode":{"type":"number","format":"double","description":"HTTP code"},"method":{"type":"string","description":"HTTP method"},"path":{"type":"string","description":"Request path"},"stack":{"type":"string","description":"Stack trace (tylko w środowisku deweloperskim)"}},"required":["name","message","code","statusCode","httpCode","method","path"],"type":"object","additionalProperties":false}}}}
```

Anchor the issuer's DID on blockchain\
\
Creates a blockchain transaction to register the issuer's DID
-------------------------------------------------------------

> Anchors the issuer's DID on the blockchain

```json
{"openapi":"3.0.0","info":{"title":"issuer-service","version":"1.0.0-rc2"},"servers":[{"url":"/"}],"security":[],"paths":{"/api/v1/blockchain/dids":{"post":{"operationId":"AnchorDIDOnBlockchainHandler","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnchorDIDResponseDto"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"description":"Anchors the issuer's DID on the blockchain","summary":"Anchor the issuer's DID on blockchain\n\nCreates a blockchain transaction to register the issuer's DID","tags":["Blockchain"],"parameters":[]}}},"components":{"schemas":{"AnchorDIDResponseDto":{"description":"Response DTO for anchoring DID on blockchain","properties":{"did":{"type":"string","description":"DID anchored on blockchain"}},"required":["did"],"type":"object","additionalProperties":false},"ErrorResponseDto":{"description":"Extended error response with HTTP details","properties":{"name":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"code":{"type":"number","format":"double","description":"Error code"},"statusCode":{"type":"number","format":"double","description":"HTTP status code"},"httpCode":{"type":"number","format":"double","description":"HTTP code"},"method":{"type":"string","description":"HTTP method"},"path":{"type":"string","description":"Request path"},"stack":{"type":"string","description":"Stack trace (tylko w środowisku deweloperskim)"}},"required":["name","message","code","statusCode","httpCode","method","path"],"type":"object","additionalProperties":false}}}}
```

Verify a DID on the blockchain\
\
Retrieves and validates a DID document from the blockchain
----------------------------------------------------------

> Verifies if a DID exists on the blockchain

```json
{"openapi":"3.0.0","info":{"title":"issuer-service","version":"1.0.0-rc2"},"servers":[{"url":"/"}],"security":[],"paths":{"/api/v1/blockchain/dids/{did}":{"get":{"operationId":"VerifyDIDOnBlockchainHandler","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyDIDResponseDto"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"description":"Verifies if a DID exists on the blockchain","summary":"Verify a DID on the blockchain\n\nRetrieves and validates a DID document from the blockchain","tags":["Blockchain"],"parameters":[{"description":"The DID to verify","in":"path","name":"did","required":true,"schema":{"type":"string"}}]}}},"components":{"schemas":{"VerifyDIDResponseDto":{"description":"Response DTO for verifying DID on blockchain","properties":{"did":{"$ref":"#/components/schemas/DidDocument","description":"DID Document from blockchain"}},"required":["did"],"type":"object","additionalProperties":false},"DidDocument":{"properties":{"id":{"type":"string"},"context":{"items":{"type":"string"},"type":"array"},"controller":{"items":{"type":"string"},"type":"array"},"verificationMethod":{"items":{"$ref":"#/components/schemas/DidVerificationMethod"},"type":"array"},"authentication":{"items":{"$ref":"#/components/schemas/DidVerificationRelationship"},"type":"array"},"assertionMethod":{"items":{"$ref":"#/components/schemas/DidVerificationRelationship"},"type":"array"},"keyAgreement":{"items":{"$ref":"#/components/schemas/DidVerificationRelationship"},"type":"array"},"capabilityInvocation":{"items":{"$ref":"#/components/schemas/DidVerificationRelationship"},"type":"array"},"capabilityDelegation":{"items":{"$ref":"#/components/schemas/DidVerificationRelationship"},"type":"array"},"service":{"items":{"$ref":"#/components/schemas/DidDocumentService"},"type":"array"},"alsoKnownAs":{"items":{"type":"string"},"type":"array"}},"required":["id","context","controller","verificationMethod","authentication","assertionMethod","keyAgreement","capabilityInvocation","capabilityDelegation","service","alsoKnownAs"],"type":"object","additionalProperties":false},"DidVerificationMethod":{"properties":{"id":{"type":"string"},"type":{"type":"string"},"controller":{"type":"string"},"publicKeyBase58":{"type":"string"},"publicKeyMultibase":{"type":"string"},"publicKeyJwk":{"$ref":"#/components/schemas/JsonWebKey"}},"required":["id","type","controller"],"type":"object","additionalProperties":false},"JsonWebKey":{"properties":{"kty":{"type":"string"},"crv":{"type":"string"},"x":{"type":"string"},"y":{"type":"string"}},"required":["kty","crv","x","y"],"type":"object","additionalProperties":false},"DidVerificationRelationship":{"properties":{"referenceId":{"type":"string"},"embeddedMethod":{"$ref":"#/components/schemas/DidVerificationMethod"}},"type":"object","additionalProperties":false},"DidDocumentService":{"properties":{"id":{"type":"string"},"type":{"type":"string"},"serviceEndpoint":{"items":{"type":"string"},"type":"array"}},"required":["id","type","serviceEndpoint"],"type":"object","additionalProperties":false},"ErrorResponseDto":{"description":"Extended error response with HTTP details","properties":{"name":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"code":{"type":"number","format":"double","description":"Error code"},"statusCode":{"type":"number","format":"double","description":"HTTP status code"},"httpCode":{"type":"number","format":"double","description":"HTTP code"},"method":{"type":"string","description":"HTTP method"},"path":{"type":"string","description":"Request path"},"stack":{"type":"string","description":"Stack trace (tylko w środowisku deweloperskim)"}},"required":["name","message","code","statusCode","httpCode","method","path"],"type":"object","additionalProperties":false}}}}
```

## Update the revocation list on the blockchain

> Updates the revocation list on the blockchain based on the current status of the credentials\
> It fetches all credentials from the database, checks their status, and updates the revocation list accordingly.

```json
{"openapi":"3.0.0","info":{"title":"issuer-service","version":"1.0.0-rc2"},"servers":[{"url":"/"}],"security":[{"clientSecret":[]}],"components":{"securitySchemes":{"clientSecret":{"type":"apiKey","name":"x-client-secret","in":"header"}},"schemas":{"ErrorResponseDto":{"description":"Extended error response with HTTP details","properties":{"name":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"code":{"type":"number","format":"double","description":"Error code"},"statusCode":{"type":"number","format":"double","description":"HTTP status code"},"httpCode":{"type":"number","format":"double","description":"HTTP code"},"method":{"type":"string","description":"HTTP method"},"path":{"type":"string","description":"Request path"},"stack":{"type":"string","description":"Stack trace (tylko w środowisku deweloperskim)"}},"required":["name","message","code","statusCode","httpCode","method","path"],"type":"object","additionalProperties":false}}},"paths":{"/api/v1/blockchain/revocations/{id}":{"post":{"operationId":"UpdateRevocationList","responses":{"200":{"description":"OK"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"description":"Updates the revocation list on the blockchain based on the current status of the credentials\nIt fetches all credentials from the database, checks their status, and updates the revocation list accordingly.","summary":"Update the revocation list on the blockchain","tags":["Blockchain"],"parameters":[{"description":"The ID of the revocation list to update","in":"path","name":"id","required":true,"schema":{"format":"double","type":"number"}}]}}}}
```
