Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raghavsood/blockreward

A self contained, zero-dependency package to compute block rewards and supply for Bitcoin and Bitcoin-like chains
https://github.com/raghavsood/blockreward

bitcoin blockchain btc mining

Last synced: about 16 hours ago
JSON representation

A self contained, zero-dependency package to compute block rewards and supply for Bitcoin and Bitcoin-like chains

Awesome Lists containing this project

README

        

# blockreward

[![Go Reference](https://pkg.go.dev/badge/github.com/RaghavSood/blockreward.svg)](https://pkg.go.dev/github.com/RaghavSood/blockreward)

Convenience library to calculate block rewards for various bitcoin-like cryptocurrencies.

## Usage

```go
package main

import (
"fmt"
"github.com/RaghavSood/blockreward"
)

func main() {
blockHeight := int64(210000)
bitcoinReward := blockreward.SubsidyAtHeight(blockreward.BitcoinMainnet, blockHeight)
litecoinReward := blockreward.SubsidyAtHeight(blockreward.LitecoinMainnet, blockHeight)

fmt.Printf("Bitcoin reward at height %d: %d satoshis\n", blockHeight, bitcoinReward)
fmt.Printf("Litecoin reward at height %d: %d satoshis\n", blockHeight, litecoinReward)
}
```