func ExampleTimelockRSW_SetupTimelockPuzzle() {
	// Allocate memory for key
	key := make([]byte, 32)
	// set key to be some bytes that we want to be the solution to the puzzle
	copy(key[:], []byte(fmt.Sprint("!!! secret < 32 bytes !!!")))
	// Create a new timelock. A timelock can be used to create puzzles for a key with a certain time.
	rswTimelock, err := New2048A2(key)
	if err != nil {
		log.Fatalf("Error creating a new timelock puzzle: %s", err)
	}

	// set the time to be some big number
	t := uint64(1000000)

	// Create the puzzle. Puzzles can be solved.
	puzzle, expectedAns, err := rswTimelock.SetupTimelockPuzzle(t)
	if err != nil {
		log.Fatalf("Error creating puzzle: %s", err)
	}

	fmt.Printf("Puzzle nil? %t. Expected Answer: %s", puzzle == nil, string(expectedAns))
	// Puzzle nil? false. Expected Answer: !!! secret < 32 bytes !!!

}
// This is how you create a solvable RSW timelock puzzle.
This is how you create a solvable RSW timelock puzzle.
// This is how you create a solvable RSW timelock puzzle .
func ExampleTimelockRSW_SetupTimelockPuzzle() {
	key := make([]byte, 32)
	copy(key[:], []byte(fmt.Sprint("!!! secret < 32 bytes !!!")))
	rswTimelock, err := New2048A2(key)
	if err != nil {
		log.Fatalf("Error creating a new timelock puzzle: %s", err)
	}
	t := uint64(1000000)
	puzzle, expectedAns, err := rswTimelock.SetupTimelockPuzzle(t)
	if err != nil {
		log.Fatalf("Error creating puzzle: %s", err)
	}
	fmt.Printf("Puzzle nil? %t. Expected Answer: %s", puzzle == nil, string(expectedAns))
}
func ExampleTimelockRSW_SetupTimelockPuzzle ( ) { key := make ( [ ] byte , 32 ) copy ( key [ : ] , [ ] byte ( fmt . Sprint ( " " ) ) ) rswTimelock , err := New2048A2 ( key ) if err != nil { log . Fatalf ( " " , err ) } t := uint64 ( 1000000 ) puzzle , expectedAns , err := rswTimelock . SetupTimelockPuzzle ( t ) if err != nil { log . Fatalf ( " " , err ) } fmt . Printf ( " " , puzzle == nil , string ( expectedAns ) ) }
This is how you create a solvable RSW timelock puzzle.
This is how you create a solvable RSW timelock puzzle .
// Allocate memory for key // set key to be some bytes that we want to be the solution to the puzzle // Create a new timelock. A timelock can be used to create puzzles for a key with a certain time. // set the time to be some big number // Create the puzzle. Puzzles can be solved. // Puzzle nil? false. Expected Answer: !!! secret < 32 bytes !!!