Source Code

;; Private Transactions
;; Execute confidential transactions

(define-data-var next-tx-id uint u1)

(define-map private-txs
  uint
  {
    sender-hash: (buff 32),
    receiver-hash: (buff 32),
    amount-hash: (buff 32),
    timestamp: uint
  }
)

(define-read-only (get-private-tx (tx-id uint))
  (map-get? private-txs tx-id)
)

(define-public (execute-private-tx (sender-hash (buff 32)) (receiver-hash (buff 32)) (amount-hash (buff 32)))
  (let ((tx-id (var-get next-tx-id)))
    (map-set private-txs tx-id {
      sender-hash: sender-hash,
      receiver-hash: receiver-hash,
      amount-hash: amount-hash,
      timestamp: block-height
    })
    (var-set next-tx-id (+ tx-id u1))
    (ok tx-id)
  )
)

Functions (2)

FunctionAccessArgs
get-private-txread-onlytx-id: uint
execute-private-txpublicsender-hash: (buff 32