Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Anchoring elements are not stored in the anchor contract #196

@Therecanbeonlyone1969

Description

@Therecanbeonlyone1969

The current SimpleSidetreeAnchor.sol does not store the anchoring elements in the smart contract such that they could be verified by a 3rd party. Suggest to amend the contract the following way:

`pragma solidity 0.5.0;

contract SimpleSidetreeAnchor {
struct Anchor {
address operator;
bytes32 anchorhash;
string anchorURI;
}

mapping(uint256 => Anchor) anchor;

uint256 public transactionNumber = 0;
event Anchor(address indexed operator. bytes32 anchorFileHash, string anchoruri, uint256 transactionNumber);
function anchoringHash(bytes32 _anchorHash, string _anchorURI) public { 
    transactionNumber = transactionNumber + 1;
    anchor[transactionNumber].operator = msg.sender;
    anchor[transactionNumber].anchorhash = _anchorHash;
    anchor[transactionNumber].anchorURI = _anchorURI;
    emit Anchor(msg.sender,_anchorHash, _anchorURI, transactionNumber);
}

function getAnchorHash (uint256 transactionnumber) public view returns (address, bytes32, string)

   if (transctionnumber >0) {
      return (anchor[transactionnumber].operator, anchor[transactionnumber].anchorhash, anchor[transactionnumber].anchorURI);  

} else {
return (anchor[transactionNumber].operator, anchor[transactionNumber].anchorhash, anchor[transactionNumber].anchorURI);
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions