Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canis Major test commands #92

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

asmataamallah25
Copy link
Collaborator

This document provides a comprehensive guide for testing the Canis Major blockchain adaptor's functionality. It outlines a sequence of test commands and their expected responses for:

Entity Management

  • Creating a building entity using POST requests
  • Verifying entity types in the Context Broker
  • Retrieving transaction receipts

Transaction Verification

  • Checking blockchain transaction details
  • Viewing DLTtxReceipts in NGSI-LD format
  • Querying specific building receipts

@@ -0,0 +1,114 @@
# Canis Major test

Canis Major serves as a blockchain adaptor within the FIWARE ecosystem, providing secure data persistence across blockchain networks and the Context Broker. The workflow is straightforward: clients submit transactions containing payload data and wallet credentials, which undergo authentication through Wilma PEP Proxy and KeyRock Identity Management. Once validated, the data is stored in the Orion Context Broker and simultaneously processed into a Merkle-Tree structure for blockchain integration. The system then signs the transaction using the provided wallet credentials and submits it to an Oketh-compatible blockchain. Let's explore the practical implementation through a series of test commands.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canis Major is a blockchain adapter within the FIWARE ecosystem, providing secure data persistence across blockchain networks and the Context Broker. The workflow is straightforward:

  • Clients submit transactions containing payload data and wallet credentials.
  • These data are authenticated through a PEP Proxy and KeyRock Identity Management.
  • Once validated, the data is stored in an ETSI Broker (e.g., Orion-LD Broker) and simultaneously processed into a Merkle tree structure for blockchain integration.
  • The system then signs the transaction using the provided wallet credentials and submits it to an Oketh-compatible blockchain.

Let's explore the practical implementation through a series of test commands. First, it is needed the execution of the integration tests executing the following commands:

    cd it
    docker-compose -f docker-compose/docker-compose-env.yaml -f docker-compose/docker-compose-java.yaml up
    NGSI_ADDRESS=localhost:4000 mvn clean test

After running the integration tests, ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}'
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before going to the next point, you need to describe the header keys and the corresponding values, precisely:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}'
```

To retrieve the available entity types in the context broker run the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context Broker


To retrieve the available entity types in the context broker run the following command:
```bash
curl -L 'http://<Canis Major>:1026/ngsi-ld/v1/types' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is , should not be ?

```
The command returns the following response, demonstrating the available entity types in the Context Broker:
```bash
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
    "@context": "https://raw.githubusercontent.com/smart-data-models/dataModel.DistributedLedgerTech/master/context.jsonld",
    "id": "urn:ngsi-ld:EntityTypeList:d77ccfa0-b3cd-11ef-ae1b-0242ac120005",
    "type": "EntityTypeList",
    "typeList": ["DLTtxReceipt"]
}

"blockHash":"0x86082426228ee23ea8927607c7f731194ebc1dc7ca69a6321ff46e91b0fdbe2a","blockNumber":190,"blockNumberRaw":"0xbe","cumulativeGasUsed":23866,"cumulativeGasUsedRaw":"0x5d3a","from":"0x34e5b3f990e55d0651b35c817bafb89d2877cb95","gasUsed":23866,"gasUsedRaw":"0x5d3a","logs":[
{"address":"0x476059cd57800db8eb88f67c2aa38a6fcf8251e0","blockHash":"0x86082426228ee23ea8927607c7f731194ebc1dc7ca69a6321ff46e91b0fdbe2a","blockNumber":190,"blockNumberRaw":"0xbe","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0xa3865c00e01495fc2b86502cae36a4edb139f748682e7d80725a3d6571a482fa","0x9aeb7ab140e1449806e11e52ca85dacb6a028ae5feb8d431e7d927e7971e4d2d","0xb1a82faaa61a7bfbc90c42129b2049d408f20b8f43ae99e8b6aa6cc7e7b0b944"],"transactionHash":"0x18b8c942735e869a42fff06393ebb12824ec44ed030e9e6a579f8f839c59a5de","transactionIndex":0,"transactionIndexRaw":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000008000200000000000000000000010000000000004000000000000000000000000000110000000000000004000000000000000000000000000000000000000000000020000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","statusOK":true,"to":"0x476059cd57800db8eb88f67c2aa38a6fcf8251e0","transactionHash":"0x18b8c942735e869a42fff06393ebb12824ec44ed030e9e6a579f8f839c59a5de","transactionIndexRaw":"0x0"}]
}%
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line after the ```

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Each transaction contains detailed blockchain information including block hashes, gas usage, logs, and transaction hashes, but they all relate to the same building entity.

To ask the context brker Orion-LD about the receipt of a specific building use the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line after the colon

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


To ask the context brker Orion-LD about the receipt of a specific building use the following command:
```bash
curl -L 'http://<Canis Major>:1026/ngsi-ld/v1/entities/?type=DLTtxReceipt&q=refEntity%3D%3D%22urn%3Angsi-ld%3ABuilding%3Afarm002%22&attrs=TxReceipts' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that the IP should be and not ?

You should explain that you are using the query language of ETSI NGSI-LD API to request the data:

  • you request all the Entities whose type is DLTtxReceipt;
  • From them, only the entity or entities whose property refEntity value is equal to %22urn%3Angsi-ld%3ABuilding%3Afarm002%22 ("urn:ngsi-ld:Building:farm002"), and;
  • you want to receive only the property TxReceipts.

-H 'NGSILD-Tenant: orion'
```
The outpot will be similar to the following response:
```bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bash -> json

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Both transactions were successful (statusOK: true). Each receipt contains detailed blockchain information including logs, bloom filters, and raw transaction data.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To say that the values are the same, you need to compare the output of the Context Broker with the output of the Canis Major.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is the function that the validator should provide. If both outputs are the same, we should get true.
This is what I am working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants