Source Code

;; TX-OVERDRIVE: Retro Stacks Transaction Game
;; A simple contract to generate transactions rapidly
;; Each call to hack-node increments the caller's hack count

(define-map hack-count principal uint)
(define-data-var total-hacks uint u0)

;; Main game function - call this to "hack a node"
(define-public (hack-node)
  (begin
    (map-set hack-count tx-sender
      (+ (default-to u0 (map-get? hack-count tx-sender)) u1))
    (var-set total-hacks (+ (var-get total-hacks) u1))
    (ok true)))

;; Read-only: get a user's hack count
(define-read-only (get-hack-count (who principal))
  (default-to u0 (map-get? hack-count who)))

;; Read-only: get total hacks across all users
(define-read-only (get-total-hacks)
  (var-get total-hacks))

Functions (3)

FunctionAccessArgs
hack-nodepublic
get-hack-countread-onlywho: principal
get-total-hacksread-only