0.0.2 • Published 3 years ago

aeicontract v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

AEI Smart Contract

npm version License: MIT

AEI Smart Contract is written in Solidity using ERC721 standard (NFT) and can be use with Ethereum Clients. It is compatible with FIWARE-Canis Major Adaptor to store the data in blockchain. AEI, asset, events (metadata), relationship, is designed to store the NGSI-LD model with the help of Canis Major Adaptor.

AEI Model Architecture

AEI Model Architecture

  1. Entity/Asset with a unique identity will be a new asset (1:1 mapping of asset to an identity).
  2. Event or Metadata of the asset/entity has a 1:n mapping.
  3. An Asset can have a 1:n relationship with any other asset.

Example

Example

To Store the NGSI-LD model there are few possibilities with the help of some supported storage type:

  1. IPFS
  2. IOTA MaM
  3. MerkleRoot

Example

Methods

- createAsset(bytes32 uuid, string memory _newHash)
- getAsset(bytes32 uuid)
- updateAsset(bytes32 uuid, string memory _newHash)
- removeAsset (bytes32 uuid)
- isValidAsset(bytes32 uuid, bytes32[] memory _proof, bytes32 _leaf)
- isValidAssetEthMessage(bytes32 uuid, bytes32 _messageHash, bytes memory _signature)
- addRelation(bytes32 uuid, bytes32 reluuid)
- getRelations(bytes32 uuid)
- removeRelation(bytes32 uuid, uint index)
- isValidRelation(bytes32 uuid, uint index, bytes32[] memory _proof, bytes32 _leaf)
- addMetadata(bytes32 uuid, string memory _metadatahash)
- getMetadatas(bytes32 uuid) public view returns (string[] memory)
- removeMetadata(bytes32 uuid, uint index)
- isValidMetadata(bytes32 uuid, uint index, bytes32[] memory _proof, bytes32 _leaf)

Apart from that ERC721, Ownable, MerkleProof, ECDSA methods are supported.

Dependencies

This project uses:

  • truffle
  • NodeJS
  • Ganache-CLI (testrpc)
  • OpenZeppelin

License

AEI Contract is licensed under the MIT License.

© 2021 FIWARE Foundation e.V.