Documentation ¶
Index ¶
- Variables
- func Check(id string, minDifficulty int) error
- func CommittedDifficulty(event *nostr.Event) int
- func Difficulty(id string) int
- func DoWork(ctx context.Context, event nostr.Event, targetDifficulty int) (nostr.Tag, error)
- func Generate(event *nostr.Event, targetDifficulty int, timeout time.Duration) (*nostr.Event, error)deprecated
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Check ¶
Check reports whether the event ID demonstrates a sufficient proof of work difficulty. Note that Check performs no validation other than counting leading zero bits in an event ID. It is up to the callers to verify the event with other methods, such as nostr.Event.CheckSignature.
func CommittedDifficulty ¶ added in v0.34.7
CommittedDifficulty returns the Difficulty but checks the "nonce" tag for a target.
if the target is smaller than the actual difficulty then the value of the target is used. if the target is bigger than the actual difficulty then it returns 0.
func Difficulty ¶
Difficulty counts the number of leading zero bits in an event ID.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.