Research Article

A Blockchain-Based User Authentication Scheme with Access Control for Telehealth Systems

Algorithm 2

Challenge-response pair contract.
function uploadCRP(, , , , )
if userExists  = = false
  status = ‘valid’
    = time.Now()
  user = User \{, , , , , status\}
  return putState(, user)
else
  return Errorf(“the user has already exists”)
function queryCRP
 err, result = getState
if (err = = null && result.getStatus() = = ‘valid’)
  return result
else if (result.getStatus() ! = “valid”)
  return Errorf(“the CRP of user has been expired”)
return err
function updateCRP(, , , )
if userExists  = = true
  status = ‘valid’
    = time.Now()
  user = User \{, , , , , status\}
  return putState(, user)
else
  return Errorf(“the user does not exist”)