Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prove-Me: Provably Fair RNG Library for Go

Go Reference Go Report Card

A lightweight, cryptographically secure Go library for building Provably Fair gaming systems (Casino, Roulette, Dice, Coinflip).

Designed to be simple, transparent, and impossible to manipulate.

🚀 Features

  • HMAC-SHA512 Determinism: Uses the industry-standard HMAC-SHA512 algorithm for generating results.
  • Nonce Support: Ensures that the same seeds can produce a unique sequence of results.
  • Range Control: Generate fair numbers within any [min, max] range.
  • Easy Verification: Built-in methods to prove to users that the server didn't cheat.

🛠 Installation

go get github.com/mafineeeek/prove-me

📖 How it Works

The Provably Fair system ensures trust between the player and the house:

  1. Server Seed: The server generates a random string (secret).
  2. Server Hash: The server provides the SHA256 hash of the server seed to the player before the bet.
  3. Client Seed: The player provides their own random string.
  4. Nonce: A count of how many bets have been made with this seed pair (starts at 0).
  5. Roll: When the bet is placed, the result is calculated as: HMAC_SHA512(ServerSeed, ClientSeed + ":" + Nonce)
  6. Verification: After the bet, the server reveals the secret ServerSeed. The player can then recalculate the hash and the roll result to verify fairness.

💻 Usage

package main

import (
	"fmt"
	"github.com/mafineeeek/prove-me"
)

func main() {
	// 1. Setup
	serverSeed, _ := proveme.GenerateSeed()
	clientSeed := "any-client-input"
	nonce := uint64(0)

	// 2. Roll (e.g., 1-100)
	result, _ := proveme.Roll(serverSeed, clientSeed, nonce, 1, 100)
	fmt.Printf("The roll result is: %d\n", result)

	// 3. Verify
	verification, _ := proveme.Verify(serverSeed, clientSeed, nonce, 1, 100)
	fmt.Printf("Verified outcome: %d\n", verification.Roll)
}

🧪 Testing

go test ./...

📝 License

MIT

About

⚡A lightweight, cryptographically secure Go library for building Provably Fair gaming systems

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages