Operation Flow

Step by step of how a typical operation is processed and recorded in Polaris.

Transaction Recording

1

User creates record

The user enters transaction data (amount, description, category, etc.) from the Polaris dashboard.

2

Backend validates

The server validates user permissions, data format, budget limits and configured business rules.

3

Encrypted and saved

Data is encrypted with AES-256-GCM and saved in Supabase with Row Level Security.

4

Hash generated

SHA-256 of the encrypted record is calculated to create a unique and irreversible digital fingerprint.

5

Digitally signed

The hash is signed with the user/department private key to guarantee authenticity.

6

Sent to Hedera

The signed message is published on Hedera Consensus Service (HCS), remaining immutable on the network.

7

TxId saved

The Hedera transaction ID is linked to the record in Supabase for future verifications.

Code Example

// Simplified pseudocode
async function registerTransaction(data, userId) {
  // 1. Validate permissions and data
  await validatePermissions(userId, data.departmentId)
  await validateData(data)
  
  // 2. Encrypt data
  const encrypted = await encrypt(data, MASTER_KEY)
  
  // 3. Save in Supabase
  const record = await supabase
    .from('transactions')
    .insert({ encrypted_data: encrypted, user_id: userId })
    .select()
    .single()
  
  // 4. Generate hash
  const hash = sha256(encrypted)
  
  // 5. Sign with user key
  const signature = await sign(hash, userPrivateKey)
  
  // 6. Publish on Hedera HCS
  const txResponse = await hederaClient.submitMessage({
    topicId: COMPANY_TOPIC_ID,
    message: JSON.stringify({
      type: 'transaction',
      hash,
      signature,
      timestamp: Date.now()
    })
  })
  
  // 7. Link txId
  await supabase
    .from('transactions')
    .update({ hedera_tx_id: txResponse.transactionId })
    .eq('id', record.id)
  
  return { success: true, txId: txResponse.transactionId }
}

Verification

To verify the integrity of any record:

  1. 1Get the encrypted record from Supabase
  2. 2Calculate SHA-256 of the encrypted data
  3. 3Query the message on Hedera using the txId
  4. 4Compare hashes: if they match, the record has not been altered