Skip to content

Tech: proof of ownership implementation #80

Closed
@iltoga

Description

@iltoga

Description

Proof of ownership is a message, signed by the node, that can be used by a client to prove node ownership. For instance can be used as a way to authenticate to the node and perform administrative tasks, such as requesting a change of the node private/public key.
This message is returned by an api call consumed by the client (/noderegistration/getproofofownership).

See https://docs.google.com/document/d/118CdR0WOIpZx4C9Hnx-JsrHz3vXn9OZ6eMokk9y71hk/edit#bookmark=id.f379wvfhj4m5 for details

Breakdown

  • implement Generate Proof of Ownership function:
    • lookup latest block height+hash in the db
    • lookup owner account address from config
    • sign these data with its node private key
  • implement Validate Proof of Ownership function:
    • validate that signature on the proof is valid for the provided node public key
    • validate that the height is not more than X blocks older than the current block height
    • look up block in the db where height = the height in the proof of ownership message, and verify the block hash in the proof also matches
  • implement grpc api for the client to consume the proof of ownership request:
    • api endpoint: /nodeadmin/getProofOfOwnership
    • request body:
      • signature ([]byte)
    • response data
      • accountType (uint32): account type
      • accountAddress (string): account address
      • blockHash ([]byte): last block hash
      • blockHeight (uint32): height of last block hash
      • signature ([]bytes): signature of all the above fields (with node's private key)
    • business logic:
      • validate request by verifying the 'signature' field is been signed using the node owner's account address (for now we don't have it and this data can be mocked just not to break the data flow. in future the node, after installation, should already contain a owner's account address, together with a default node private key)
      • if request is valid:
        • call Generate Proof of Ownership function, that should return the message described above as 'response data'
        • return that message to the client

Additional Diagram / File

See https://docs.google.com/document/d/118CdR0WOIpZx4C9Hnx-JsrHz3vXn9OZ6eMokk9y71hk/edit#bookmark=id.f379wvfhj4m5 for details

References

#68

Metadata

Metadata

Assignees

Labels

COREcore functionalitiesFEATURENew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions