Show Posts
|
Pages: [1] 2 3 »
|
Recently I've seen a lot of blocks taking long amounts of time in which the disks are idle so I'd suggest to all the miner developers to add an extra command line option to their miners that tells if a USB drive has been used. If the option is switched on, the miner will write a small (few KB) file of random data to a folder on the hard drive/s so they won't automatically power down (many external drives do this and disregard the OS power preferences). For example the option could be something like --usb=/path/to/the/usb/folder/storing/the/plots/ I know this can be achieved through external software or shell scripts but it's kinda annoying to have another extra piece of software installed and running on the system...
|
|
|
After a bunch of wasted hours I've finally managed to make dcct's miner work with dev's v2 pool.So, first you have to download the original files from https://bchain.info/dcct_miner.tgzAfter you extract them, replace the contents of mine.c with the following code: /* Uses burstcoin plot files to mine coins Author: Markus Tervooren <info@bchain.info> BURST-R5LP-KEL9-UYLG-GFG6T
With code written by Uray Meiviar <uraymeiviar@gmail.com> BURST-8E8K-WQ2F-ZDZ5-FQWHX
Implementation of Shabal is taken from: http://www.shabal.com/?p=198
Usage: ./mine <node ip> [<plot dir> <plot dir> ..] */
#define _GNU_SOURCE #include <stdint.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <dirent.h> #include <pthread.h>
#include "shabal.h" #include "helper.h"
// Do not report results with deadline above this to the node. If you mine solo set this to 10000 to avoid stressing out the node. #define MAXDEADLINE 5000000
// Change if you need #define DEFAULT_PORT 8125
// These are fixed for BURST. Dont change! #define HASH_SIZE 32 #define HASH_CAP 4096 #define PLOT_SIZE (HASH_CAP * HASH_SIZE * 2)
// Read this many nonces at once. 100k = 6.4MB per directory/thread. // More may speedup things a little. #define CACHESIZE 100000
#define BUFFERSIZE 2000
unsigned long long addr; unsigned long long startnonce; int scoop;
unsigned long long best; unsigned long long bestn; unsigned long long deadline;
unsigned long long targetdeadline;
char signature[33]; char oldSignature[33];
char nodeip[16]; int nodeport = DEFAULT_PORT;
unsigned long long bytesRead = 0; unsigned long long height = 0; unsigned long long baseTarget = 0; time_t starttime;
int stopThreads = 0;
pthread_mutex_t byteLock;
#define SHARECACHE 1000
#ifdef SHARE_POOL int sharefill; unsigned long long sharekey[SHARECACHE]; unsigned long long sharenonce[SHARECACHE]; #endif
// Buffer to read the passphrase to. Only when SOLO mining #ifdef SOLO char passphrase[BUFFERSIZE + 1]; #endif
char readbuffer[BUFFERSIZE + 1];
// Some more buffers char writebuffer[BUFFERSIZE + 1];
char *contactWallet(char *req, int bytes) { int s = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
struct sockaddr_in ss; ss.sin_addr.s_addr = inet_addr( nodeip ); ss.sin_family = AF_INET; ss.sin_port = htons( nodeport );
struct timeval tv; tv.tv_sec = 15; tv.tv_usec = 0;
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,sizeof(struct timeval));
if(connect(s, (struct sockaddr*)&ss, sizeof(struct sockaddr_in)) == -1) { printf("\nError sending result to node \n"); fflush(stdout); return NULL; }
int written = 0; do { int w = write(s, &req[written], bytes - written); if(w < 1) { printf("\nError sending request to node \n"); return NULL; } written += w; } while(written < bytes);
int bytesread = 0, rbytes; do { rbytes = read(s, &readbuffer[bytesread], BUFFERSIZE - bytesread); if(bytes > 0) bytesread += rbytes;
} while(rbytes > 0 && bytesread < BUFFERSIZE);
close(s);
// Finish read readbuffer[bytesread] = 0;
// locate HTTP header end char *find = strstr(readbuffer, "\r\n\r\n");
// No header found if(find == NULL) return NULL;
return find + 4; }
void procscoop(unsigned long long nonce, int n, char *data, unsigned long long account_id) { char *cache; char sig[32 + 64];
cache = data;
int v;
memmove(sig, signature, 32);
for(v=0; v<n; v++) { memmove(&sig[32], cache, 64);
shabal_context x; shabal_init(&x, 256); shabal(&x, sig, 64 + 32);
char res[32];
shabal_close(&x, 0, 0, res);
unsigned long long *wertung = (unsigned long long*)res;
// Sharepool: Submit all deadlines below threshold // Uray_pool: Submit best deadline // Solo: Best deadline, but not low quality deadlines
#ifdef SHARE_POOL // For sharepool just store results for later submission if(*wertung < targetdeadline * baseTarget && sharefill < SHARECACHE) { sharekey[sharefill] = account_id; sharenonce[sharefill] = nonce; sharefill++; } #else if(bestn == 0 || *wertung <= best) { best = *wertung; bestn = nonce;
#ifdef SOLO if(best < baseTarget * MAXDEADLINE) { // Has to be this good before we inform the node #endif
#ifdef URAY_POOL int bytes = sprintf(writebuffer, "POST /burst?requestType=submitNonce&accountId=%llu&nonce=%llu HTTP/1.0\r\nConnection: close\r\n\r\n", account_id,bestn); #else int bytes = sprintf(writebuffer, "POST /burst?requestType=submitNonce&secretPhrase=%s&nonce=%llu HTTP/1.0\r\nConnection: close\r\n\r\n", passphrase, bestn); #endif char *buffer = contactWallet( writebuffer, bytes );
if(buffer != NULL) { char *rdeadline = strstr(buffer, "\"deadline\":"); if(rdeadline != NULL) { rdeadline += 11; char *end = strstr(rdeadline, "}"); if(end != NULL) { // Parse and check if we have a better deadline unsigned long long ndeadline = strtoull(rdeadline, 0, 10); if(ndeadline < deadline || deadline == 0) deadline = ndeadline; } } else { printf("\nWalet reported no deadline.\n"); } #ifdef SOLO // Deadline too high? Passphrase may be wrong. if(deadline > MAXDEADLINE) { printf("\nYour deadline is larger than it should be. Check if you put the correct passphrase to passphrases.txt.\n"); fflush(stdout); } #endif
} #ifdef SOLO } #endif }
#endif nonce++; cache += 64; } }
void *work_i(void *x_void_ptr) { char *x_ptr = (char*)x_void_ptr;
char *cache = (char*) malloc(CACHESIZE * HASH_SIZE * 2);
if(cache == NULL) { printf("\nError allocating memory \n"); exit(-1); }
DIR *d; struct dirent *dir; d = opendir(x_ptr);
if (d) { while ((dir = readdir(d)) != NULL) { unsigned long long key, nonce, nonces, stagger, n; char fullname[512]; strcpy(fullname, x_ptr);
if(sscanf(dir->d_name, "%llu_%llu_%llu_%llu", &key, &nonce, &nonces, &stagger)) { // Does path end with a /? If not, add it. if( fullname[ strlen( x_void_ptr ) ] == '/' ) { strcpy(&fullname[ strlen( x_void_ptr ) ], dir->d_name); } else { fullname[ strlen( x_void_ptr ) ] = '/'; strcpy(&fullname[ strlen( x_void_ptr ) + 1 ], dir->d_name); }
int fh = open(fullname, O_RDONLY);
if(fh < 0) { printf("\nError opening file %s \n", fullname); fflush(stdout); }
unsigned long long offset = stagger * scoop * HASH_SIZE * 2; unsigned long long size = stagger * HASH_SIZE * 2;
for(n=0; n<nonces; n+=stagger) { // Read one Scoop out of this block: // start to start+size in steps of CACHESIZE * HASH_SIZE * 2
unsigned long long start = n * HASH_CAP * HASH_SIZE * 2 + offset, i; unsigned long long noffset = 0; for(i = start; i < start + size; i += CACHESIZE * HASH_SIZE * 2) { unsigned int readsize = CACHESIZE * HASH_SIZE * 2; if(readsize > start + size - i) readsize = start + size - i;
int bytes = 0, b; do { b = pread(fh, &cache[bytes], readsize - bytes, i); bytes += b; } while(bytes < readsize && b > 0); // Read until cache is filled (or file ended) if(b != 0) { procscoop(n + nonce + noffset, readsize / (HASH_SIZE * 2), cache, key); // Process block
// Lock and add to totals pthread_mutex_lock(&byteLock); bytesRead += readsize; pthread_mutex_unlock(&byteLock); }
noffset += CACHESIZE; } if(stopThreads) { // New block while processing: Stop. close(fh); closedir(d); free(cache); return NULL; } } close(fh); } } closedir(d); } free(cache); return NULL; }
int pollNode() {
// Share-pool works differently #ifdef SHARE_POOL int bytes = sprintf(writebuffer, "GET /pool/getMiningInfo HTTP/1.0\r\nHost: %s:%i\r\nConnection: close\r\n\r\n", nodeip, nodeport); #else int bytes = sprintf(writebuffer, "POST /burst?requestType=getMiningInfo HTTP/1.0\r\nConnection: close\r\n\r\n"); #endif
char *buffer = contactWallet( writebuffer, bytes );
if(buffer == NULL) return 0;
// Parse result #ifdef SHARE_POOL char *rbaseTarget = strstr(buffer, "\"baseTarget\": \""); char *rheight = strstr(buffer, "\"height\": \""); char *generationSignature = strstr(buffer, "\"generationSignature\": \""); char *tdl = strstr(buffer, "\"targetDeadline\": \"");
if(rbaseTarget == NULL || rheight == NULL || generationSignature == NULL || tdl == NULL) return 0;
char *endBaseTarget = strstr(rbaseTarget + 15, "\""); char *endHeight = strstr(rheight + 11, "\""); char *endGenerationSignature = strstr(generationSignature + 24, "\""); char *endtdl = strstr(tdl + 19, "\"");
if(endBaseTarget == NULL || endHeight == NULL || endGenerationSignature == NULL || endtdl == NULL) return 0;
// Set endpoints endBaseTarget[0] = 0; endHeight[0] = 0; endGenerationSignature[0] = 0; endtdl[0] = 0; // Parse if(xstr2strr(signature, 33, generationSignature + 24) < 0) { printf("\nNode response: Error decoding generationsignature \n"); fflush(stdout); return 0; }
height = strtoull(rheight + 11, 0, 10); baseTarget = strtoull(rbaseTarget + 15, 0, 10); targetdeadline = strtoull(tdl + 19, 0, 10); #else char *rbaseTarget = strstr(buffer, "\"baseTarget\":\""); char *rheight = strstr(buffer, "\"height\":\""); char *generationSignature = strstr(buffer, "\"generationSignature\":\""); if(rbaseTarget == NULL || rheight == NULL || generationSignature == NULL) return 0;
char *endBaseTarget = strstr(rbaseTarget + 14, "\""); char *endHeight = strstr(rheight + 10, "\""); char *endGenerationSignature = strstr(generationSignature + 23, "\""); if(endBaseTarget == NULL || endHeight == NULL || endGenerationSignature == NULL) return 0;
// Set endpoints endBaseTarget[0] = 0; endHeight[0] = 0; endGenerationSignature[0] = 0; // Parse if(xstr2strr(signature, 33, generationSignature + 23) < 0) { printf("\nNode response: Error decoding generationsignature \n"); fflush(stdout); return 0; }
height = strtoull(rheight + 10, 0, 10); baseTarget = strtoull(rbaseTarget + 14, 0, 10); #endif
return 1; }
void update() { // Try until we get a result. while(pollNode() == 0) { printf("\nCould not get mining info from Node. Will retry.. \n"); fflush(stdout); struct timespec wait; wait.tv_sec = 1; wait.tv_nsec = 0; nanosleep(&wait, NULL); }; }
int main(int argc, char **argv) { int i; if(argc < 3) { printf("Usage: ./mine <node url> [<plot dir> <plot dir> ..]\n"); exit(-1); }
#ifdef SOLO // Reading passphrase from file int pf = open( "passphrases.txt", O_RDONLY ); if( pf < 0 ) { printf("Could not find file passphrases.txt\nThis file should contain the passphrase used to create the plotfiles\n"); exit(-1); } int bytes = read( pf, passphrase, 2000 );
// Replace spaces with + for( i=0; i<bytes; i++ ) { if( passphrase[i] == ' ' ) passphrase[i] = '+';
// end on newline if( passphrase[i] == '\n' || passphrase[i] == '\r') passphrase[i] = 0; }
passphrase[bytes] = 0; #endif
// Check if all directories exist: struct stat d = {0};
for(i = 2; i < argc; i++) { if ( stat( argv[i], &d) ) { printf( "Plot directory %s does not exist\n", argv[i] ); exit(-1); } else { if( !(d.st_mode & S_IFDIR) ) { printf( "%s is not a directory\n", argv[i] ); exit(-1); } } } char *hostname = argv[1];
// Contains http://? strip it. if(strncmp(hostname, "http://", 7) == 0) hostname += 7;
// Contains Port? Extract and strip. char *p = strstr(hostname, ":"); if(p != NULL) { p[0] = 0; p++; nodeport = atoi(p); }
printf("Using %s port %i\n", hostname, nodeport);
hostname_to_ip(hostname, nodeip);
memset(oldSignature, 0, 33);
pthread_t worker[argc]; time(&starttime);
// Get startpoint: update();
// Main loop for(;;) { // Get scoop: char scoopgen[40]; memmove(scoopgen, signature, 32);
char *mov = (char*)&height;
scoopgen[32] = mov[7]; scoopgen[33] = mov[6]; scoopgen[34] = mov[5]; scoopgen[35] = mov[4]; scoopgen[36] = mov[3]; scoopgen[37] = mov[2]; scoopgen[38] = mov[1]; scoopgen[39] = mov[0];
shabal_context x; shabal_init(&x, 256); shabal(&x, scoopgen, 40); char xcache[32]; shabal_close(&x, 0, 0, xcache); scoop = (((unsigned char)xcache[31]) + 256 * (unsigned char)xcache[30]) % HASH_CAP;
// New block: reset stats best = bestn = deadline = bytesRead = 0;
#ifdef SHARE_POOL sharefill = 0; #endif
for(i = 2; i < argc; i++) { if(pthread_create(&worker[i], NULL, work_i, argv[i])) { printf("\nError creating thread. Out of memory? Try lower stagger size\n"); exit(-1); } }
#ifdef SHARE_POOL // Collect threads back in for dev's pool: for(i = 2; i < argc; i++) pthread_join(worker[i], NULL);
if(sharefill > 0) { char *f1 = (char*) malloc(SHARECACHE * 100); char *f2 = (char*) malloc(SHARECACHE * 100);
int used = 0; for(i = 0; i<sharefill; i++) used += sprintf(&f1[used], "%llu:%llu:%llu\n", sharekey[i], sharenonce[i], height);
int ilen = 1, red = used; while(red > 10) { ilen++; red /= 10; }
int db = sprintf(f2, "POST /pool/submitWork HTTP/1.1\r\nHost: %s:%i\r\nContent-Type: text/plain;charset=UTF-8\r\nContent-Length: %i\r\n\r\n%s\n", nodeip, nodeport, used + 1, f1);
printf("\nServer response: %s\n", contactWallet(f2, db));
free(f1); free(f2); } #endif
memmove(oldSignature, signature, 32); // Wait until block changes: do { update(); time_t ttime; time(&ttime); #ifdef SHARE_POOL printf("\r%llu MB read/%llu GB total/%i shares@target %llu ", (bytesRead / ( 1024 * 1024 )), (bytesRead / (256 * 1024)), sharefill, targetdeadline); #else if(deadline == 0) printf("\r%llu MB read/%llu GB total/no deadline ", (bytesRead / ( 1024 * 1024 )), (bytesRead / (256 * 1024))); else printf("\r%llu MB read/%llu GB total/deadline %llus (%llis left) ", (bytesRead / ( 1024 * 1024 )), (bytesRead / (256 * 1024)), deadline, (long long)deadline + (unsigned int)starttime - (unsigned int)ttime); #endif
fflush(stdout);
struct timespec wait; // Query faster when solo mining #ifdef SOLO wait.tv_sec = 1; #else wait.tv_sec = 5; #endif wait.tv_nsec = 0; nanosleep(&wait, NULL); } while(memcmp(signature, oldSignature, 32) == 0); // Wait until signature changed
printf("\nNew block %llu, basetarget %llu \n", height, baseTarget); fflush(stdout);
// Remember starttime time(&starttime);
#ifndef SHARE_POOL // Tell all threads to stop: stopThreads = 1; for(i = 2; i < argc; i++) pthread_join(worker[i], NULL);
stopThreads = 0; #endif } }
and after that just follow the instructions from the original announcement made by dcct - https://bitcointalk.org/index.php?topic=731923.msg8879760#msg8879760Note 1: If anyone is wondering, the problem was in the way the data was submitted to the pool. The tip came from burstcoin in a post about Blago's miner. Note 2: I'm not a C programmer, so I'm not really sure if the content-length header has been calculated right, so if not all of the shares are being counted by the pool this would be the main reason. Note 3: The binaries provided in the archive are the original ones made by dcct and therefore won't work (the archive link is the one from his announcement post)... so you'll have to recompile the code. Note 4: I've only compiled and tested the code on a 64 bit Linux, but the changes I've made shouldn't break anything. Note 5: I've never used the v1 pool, nor I intend to use it, so if the original version wasn't working with it, this one won't work as well.
|
|
|
does HDD RPM affect mining ? For example , 7200 RPM vs 5400 RPM , any differences in mining (Not plotting) ?
According to the FAQ at burstcoin.info - no: Is SSD better than HDD?
No, a 5400RPM HDD is just as good as a 500gb SSD.
|
|
|
Since I didn't got an answer before, I'm going to ask again - where is more profitable to mine with a small amount of plots (1-2TB) - dev's or uray's pool? Also while mining on pools based on uray's source does the wallet need to be running too (I'm talking about the server, not about being logged in the browser)?
|
|
|
@Irontiga - where did you heard about WD being bought by Seagate or you're just joking? The only thing I could find was a post from April 1st, which makes it invalid news...
|
|
|
Community i need your help ... im trying to keep the price of BURST at 200 satoshi ... but i cannot do it alone ... so we need more buy pressure ... as u can se at poloniex and c-cex i already buy 200k BURST alone ...
If u care about this coin you need to buy ... trust me 200 satoshi is a good price ... it can easy go to 500
It's not just about buying and exchanges - we need some actual applications for the coin - games, shops, services and whatever else you can think of that accepts it as a payment method. Did u look at the dev PLANS ? Basic pool support (done) Improved pool support (done) Advanced transactions(escrow, subscription, reserve funds then transfer not yet known portion later) BurstId authentication system Allow linking BurstId to burst account for transfers with spending limits. DHT for off-chain services Off-chain encrypted messaging and voip between burstid accountsFile storage(disclaimer: still figuring out a good way to do this. this will take a while.)Those plans are fine, but I'm talking about third party applications... stuff done by the comunity... Bitcoin is so widely used today not just because of the active development, but because there are a lot of merchants that accept it as a payment method...
|
|
|
Community i need your help ... im trying to keep the price of BURST at 200 satoshi ... but i cannot do it alone ... so we need more buy pressure ... as u can se at poloniex and c-cex i already buy 200k BURST alone ...
If u care about this coin you need to buy ... trust me 200 satoshi is a good price ... it can easy go to 500
It's not just about buying and exchanges - we need some actual application for the coin - games, shops, services and whatever else you can think of that accepts it as a payment method.
|
|
|
but there are not PATH parameter in wplotgenerator.exe?  ? thanks! i try some command but seems it doesn't work!!! noone know if it is possible to give plot path ? Why don't you just copy the .exe to the folder you want the plots to be generated in and run it from there?
|
|
|
Hello It's possible to do my pads with different stagger? I am now in 2048 and I wanted to add a HDD but I get this message: It probably Takes too long to read the scoops! Consider stagger larger sizes I would like to add my next hdd in 4096
As long as you're talking about a different plot file - yes. Just make sure you have enough RAM available.
|
|
|
Hmmm....dunno why, but fixed anyway(i didn't make the bit ly links but I don't know why It'd do that)
Guess they just don't like MEGA... btw, not sure if you're working on it but it will be nice if there's a separate download section in the menu and a big download button on the front page that leads to that section.
|
|
|
You've left a ( after dcct's R2 miner and in the tools section it also says Dcct miner for Uray's pool. Also bit . ly is showing some warnings that may scare the users...
//EDIT: There's also some duplicate content... for example you have 2 links for dcct's tools and 2 links for Janror's plotter
What was that link? Every bit . ly link I clicked on the site is showing me a warning
|
|
|
You've left a ( after dcct's R2 miner and in the tools section it also says Dcct miner for Uray's pool. Also bit . ly is showing some warnings that may scare the users...
//EDIT: There's also some duplicate content... for example you have 2 links for dcct's tools and 2 links for Janror's plotter
|
|
|
I've edited my post before your reply, so check it again 
|
|
|
@Irontiga - You could add links to the block explorers in the site... Maybe also a section with sites where BURST could be used (exchanges, games, stores, etc.). Also it would be nice if it has a big download button somewhere plus a link in the menu because now it's kinda hard to figure out that you have to go to the guides section in order to download the wallet and the miner.
|
|
|
Yeah, I pm'd the dev and he never replied with the new api calls, you know what they are and what they return? Absolutely no idea - I'm one of the lazy people 
|
|
|
The API article in the Guides section could be rewritten in order to attract more developers of games, payment gateways, etc. I understand it's NXT compatible but the phrase "most of this applies to it" in that article kinda discourages the lazier devs who don't want to waste time reading the whole NXT API article in order to find out not all the functions are needed in BURST.
|
|
|
They are interchangeable - take a look at the instructions in the dev's pool: http://178.62.39.204:8121/ - a BURST address is used there for the same task. And I told you to wait for a confirmation from the pool owner because I'm not really sure that the posted burst address on the front page is indeed the one that should be used for the reward recipient (although it most probably is).
|
|
|
|