Ethereum Adapter (RFC-027)

Document Maintainers: Andi Gabriel Tan 2024. List of other contributors in Annex. 1.

Copyright: MIT license

Copyright © 2018-2024 Axiologic Research and Contributors.

This document is licensed under MIT license.

1. Ethereum Adapter

The purpose of the Ethereum Adapter is to offer an HTTP interface to be used by the ApiHub anchoring component when configured to do the anchoring into a Quorum/Ethereum private network-based Blockchain. Ethereum Adapter uses a custom-designed smart contract in order to store anchor information and an organization account used to sign any written transaction. Configuration of the Ethereum Adapter can be made using environment variables as follows:

Variable Name Value Description
PORT 3000 Port on which the web server will listen.
SMARTCONTRACT_ENDPOINT none The Web API endpoint from where the information about smart contract address and smart contract interface definition can be obtained.
ANCHOR_SMARTCONTRACT_CONFIG_FOLDER ./config It is ignored if related environment variables are defined.
ACCOUNT none The Ethereum blockchain account under which the calls to the smart contract are made.
RPC_ADDRESS none he RPC endpoint of the Ethereum node.

The source code of the Ethereum Adapter can be found at: https://github.com/PharmaLedger-IMI/ethereum-anchoring in the SmartContract folder.

Status codes

Because of the complex logic of the smart contract regarding the validation process, we need a series of status codes in order to know what part of the validation failed and why. Based on the status codes, we can further customize the errors returned to the upper layers.

Status code Type Value Description
statusOK Success 200 createAnchor was called without errors, and information is stored on the blockchain.
statusAddedConstSSIOK Success 201 createAnchor was called for ConstSSI without errors, and information is stored on the blockchain.
statusHashLinkOutOfSync Error 100 Validation process for the continuity of the hash link failed.
statusCannotUpdateReadOnlyAnchor Error 101 Validation process for createAnchor when called with an update for an already stored ConstSSI.
statusHashOfPublicKeyDoesntMatchControlString Error 102 Validation of the controlString and publicKey failed.
statusSignatureCheckFailed Error 103 Validation of the signature failed.
statusTimestampOrSignatureCheckFailed Error 104  
statusCannotCreateExistingAnchor Error 105  
statusCannotAppendToNonExistentAnchor Error 106  
statusCannotAppendConstAnchor Error 107  

2. Smart Contract methods

Function createAnchor(anchorId, newAnchorValue)

Description: Create a new anchor.

Name Type Value Description
anchorId string *required  
newAnchorValue string *required  

Function appendAnchor(anchorId, newAnchorValue)

Description: Append an already existing anchor value to the current anchorId.

Name Type Value Description
anchorId string *required  
newAnchorValue string *required  

Function getAllVersions(anchorId)

Description: Get all versions of a certain anchorId.

Name Type Value Description
anchorId string *required  

Function getLastVersions(anchorId)

Description: Get the last version of a certain anchorId.

Name Type Value Description
anchorId string *required  

Function createOrUpdateMultipleAnchors(anchors)

Description: Modify anchors in an array.

Name Type Value Description
anchorId Array of objects *required  

Function dumpAnchors(from, limit, maxSize)

Description: Get rid of anchors.

Name Type Value Description
from uint *required  
limit uint *required  
maxSize uint *required  

Function totalNumberOfAnchors()

Description: Get the total number of anchors.

Name Type Value Description
       
Operation Entry point Description
PUT /createAnchor/:anchorId/:anchorValue  
PUT /appendAnchor/:anchorId/:anchorValue  
PUT /createOrAppendMultipleAnchors  
GET /getAllVersions/:anchorId  
GET /getLastVersion/:anchorId  
GET /totalNumberOfAnchors  
GET /dumpAnchors  
GET /health  

Contributors

  1. Axiologic Research: New content and improvements. Original texts under PharmaLedger Association and Novartis funding. MIT licensed content accordingly with the contracts. Publish and maintain the www.opendsu.org site.

  2. PharmaLedger Project: Review, feedback, observations, new content, and corrections MIT licensed accordingly with the consortium agreements.

  3. PrivateSky Research Project: MIT licensed content accordingly with the contracts. https://profs.info.uaic.ro/~ads/PrivateSky/

Annex 1. Contributors

Current Editors Email
Andi-Gabriel Țan andi@axiologic.net
Contributors Axiologic Research Email
Adrian Ganga adrian@axiologic.net
Andi-Gabriel Țan andi@axiologic.net
Cosmin Ursache cosmin@axiologic.net
Daniel Sava daniel@axiologic.net
Nicoleta Mihalache nicoleta@axiologic.net
Valentin Gérard valentin@axiologic.net
PrivateSky Contributors Email
Alex Sofronie alsofronie@gmail.com(DPO)
Cosmin Ursache cos.ursache@gmail.com(UAIC)
Daniel Sava sava.dumitru.daniel@gmail.com(HVS, AQS)
Daniel Visoiu visoiu.daniel.g@gmail.com(SGiant)
Lenuta Alboaie lalboaie@gmail.com(UAIC)
Rafael Mastaleru rafael@rms.ro(RMS)
Sînică Alboaie salboaie@gmail.com(UAIC)
Vlad Balmos vlad.balmos@gmail.com(Code932)
PharmaLedger Email
Ana Balan bam@rms.ro (RMS)
Bogdan Mastahac mab@rms.ro (RMS)
Cosmin Ursache cos@rms.ro (RMS)
Rafael Mastaleru raf@rms.ro (RMS)