Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/raghavsood/blockreward
- Owner: RaghavSood
- License: mit
- Created: 2024-06-02T01:30:14.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-06-05T04:42:27.000Z (5 months ago)
- Last Synced: 2024-06-19T03:13:09.368Z (5 months ago)
- Topics: bitcoin, blockchain, btc, mining
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 mainimport (
"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)
}
```