Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roppa/luck
Bitcoin mining luck generator
https://github.com/roppa/luck
bitcoin
Last synced: 24 days ago
JSON representation
Bitcoin mining luck generator
- Host: GitHub
- URL: https://github.com/roppa/luck
- Owner: roppa
- License: mit
- Created: 2019-05-12T13:41:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-12T13:49:18.000Z (over 5 years ago)
- Last Synced: 2024-11-05T10:57:46.513Z (2 months ago)
- Topics: bitcoin
- Language: JavaScript
- Size: 42 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bitcoin Block Luck Calculation
This is a utility for Bitcoin miners/mining pools to calculate the 'luck' of mining a block.
When a block has been mined you need to save when the block was started mined (created) and the mined at (when a hash has been found) timestamps.
First we need to cover constant values:
- hash = 2 pow 32
- PHz per second = 10 pow 15
- block average = hash * PHz per secondTo calculate luck you need how long it took to mine the block, your total hashrate, and network difficulty. Eg:
- difficulty = 336899932795 // network difficulty
- hashrate = total hashrate of mined block
- minedTimeSeconds = (minedat - created) in seconds## luck({ difficulty, hashrate, minedTimeSeconds })
```javascript
console.log(luck({
difficulty: 336899932795
hashrate: 154.9, // block hashrate
minedTimeSeconds: 9172 // how long block took to mine
})) // '102.71'
```