Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Oct 2012 09:17:28 GMT
From:      Daniel Morante <daniel@morante.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/172595: New port: net-p2p/pushpoold bitcoin push-mining pool server
Message-ID:  <201210110917.q9B9HSD1006178@red.freebsd.org>
Resent-Message-ID: <201210111149.q9BBnEh7062550@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         172595
>Category:       ports
>Synopsis:       New port: net-p2p/pushpoold bitcoin push-mining pool server
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 11 11:49:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Morante
>Release:        9.0
>Organization:
The Daniel Morante Company, Inc.
>Environment:
FreeBSD bitcoin.morante.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 01:47:53 UTC 2012     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
New port: net-p2p/pushpoold bitcoin push-mining pool server

Pushpools is an open source mining pool server.  A mining pool server is an 
HTTP JSON-RPC proxy to backend bitcoind processes.

As described here: https://bitcointalk.org/index.php?topic=8707.0

This is my first attempt at making a port.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	pushpoold
#	pushpoold/Makefile
#	pushpoold/pkg-descr
#	pushpoold/pkg-plist
#	pushpoold/distinfo
#	pushpoold/files
#	pushpoold/files/patch-msg.c
#	pushpoold/files/patch-server.c
#	pushpoold/files/patch-util.c
#	pushpoold/files/patch-Makfile.am
#	pushpoold/files/example-blkmon.cfg
#	pushpoold/files/example-cfg.json
#	pushpoold/files/pushpool.in
#	pushpoold/files/pushpool.conf.sample
#	pushpoold/files/blkmon.conf.sample
#	pushpoold/files/pkg-message.in
#
echo c - pushpoold
mkdir -p pushpoold > /dev/null 2>&1
echo x - pushpoold/Makefile
sed 's/^X//' >pushpoold/Makefile << '5b840b30ce618fd7a2a45dff30aa07ce'
X# $FreeBSD$
X
XPORTNAME=	pushpoold
XPORTVERSION=	0.5.1
XCATEGORIES=	net-p2p
X
XMAINTAINER=	daniel@morante.net
XCOMMENT=	A bitcoin push-mining pool server
X
XBUILD_DEPENDS=	${LOCALBASE}/include/argp.h:${PORTSDIR}/devel/argp-standalone
XLIB_DEPENDS=	event-1:${PORTSDIR}/devel/libevent \
X		memcached:${PORTSDIR}/databases/libmemcached \
X		jansson:${PORTSDIR}/devel/jansson \
X		curl:${PORTSDIR}/ftp/curl
X
XUSE_GITHUB=	yes
XGH_ACCOUNT=	jgarzik
XGH_PROJECT=	pushpool
XGH_COMMIT=	4d959b8
XGH_TAGNAME=	v${PORTVERSION}
X
XUSE_AUTOTOOLS=	autoconf autoheader libtool automake aclocal
XACLOCAL_ARGS=	-I m4
XAUTOMAKE_ARGS=	--gnu --add-missing --copy
XUSE_PKGCONFIG=	yes
XUSE_OPENSSL=	yes
X
XCONFIGURE_ENV=	PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" PTHREAD_LIBS="${PTHREAD_LIBS}"
XCFLAGS+=	-I${LOCALBASE}/include
XLDFLAGS+=	-L${LOCALBASE}/lib
X
XUSE_MYSQL=	yes
XUSE_RC_SUBR=	pushpool
XSUB_FILES=	pkg-message
X
Xpost-install:
X.if !defined(NOPORTEXAMPLES)
X	${MKDIR} ${EXAMPLESDIR}
X	${INSTALL_MAN} ${FILESDIR}/pushpool.conf.sample ${EXAMPLESDIR}
X	${INSTALL_MAN} ${FILESDIR}/blkmon.conf.sample ${EXAMPLESDIR}
X	${INSTALL_MAN} ${FILESDIR}/example-blkmon.cfg ${EXAMPLESDIR}
X	${INSTALL_MAN} ${FILESDIR}/example-cfg.json ${EXAMPLESDIR}
X.endif
X
X.include <bsd.port.mk>
5b840b30ce618fd7a2a45dff30aa07ce
echo x - pushpoold/pkg-descr
sed 's/^X//' >pushpoold/pkg-descr << '821777b5bcdb85ea48e5bd8e06f0587a'
XA bitcoin push-mining pool server.
X
XPushpools is an open source mining pool server.  A mining pool server is an 
XHTTP JSON-RPC proxy to backend bitcoind processes.
821777b5bcdb85ea48e5bd8e06f0587a
echo x - pushpoold/pkg-plist
sed 's/^X//' >pushpoold/pkg-plist << '9a6241c6be95f9eef1a62a86ac909974'
Xsbin/pushpoold
Xsbin/blkmond
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/blkmon.conf.sample
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pushpool.conf.sample
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-blkmon.cfg
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-cfg.json
X%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
9a6241c6be95f9eef1a62a86ac909974
echo x - pushpoold/distinfo
sed 's/^X//' >pushpoold/distinfo << '3b67fb5b21fb470eb0db0fd4890a0c5b'
XSHA256 (pushpoold-0.5.1.tar.gz) = 8692588700d82bb30f869234f9da23ef623a0a01613004577b1ef91c23b8e07d
XSIZE (pushpoold-0.5.1.tar.gz) = 48555
3b67fb5b21fb470eb0db0fd4890a0c5b
echo c - pushpoold/files
mkdir -p pushpoold/files > /dev/null 2>&1
echo x - pushpoold/files/patch-msg.c
sed 's/^X//' >pushpoold/files/patch-msg.c << 'c8196cd1ca9b8d8e89f382037c9e009c'
X--- msg.c	2011-06-27 13:57:30.000000000 -0400
X+++ msg.c	2012-10-10 03:00:47.000000000 -0400
X@@ -27,7 +27,11 @@
X #include <unistd.h>
X #include <string.h>
X #include <jansson.h>
X-#include <byteswap.h>
X+# define bswap_64 __bswap64 
X+# define bswap_32 __bswap32 
X+# define bswap_16 __bswap16 
X+# define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
X+#include <sys/endian.h>
X #include <openssl/sha.h>
X #include <syslog.h>
X #include "server.h"
c8196cd1ca9b8d8e89f382037c9e009c
echo x - pushpoold/files/patch-server.c
sed 's/^X//' >pushpoold/files/patch-server.c << '55cc764e3b9791d34dd406a70f67a10e'
X--- server.c	2011-06-27 13:57:30.000000000 -0400
X+++ server.c	2012-10-10 03:05:31.000000000 -0400
X@@ -38,7 +38,7 @@
X #include <zlib.h>
X #include <netdb.h>
X #include <stdarg.h>
X-#include <endian.h>
X+#include <sys/endian.h>
X #include <openssl/sha.h>
X #include <argp.h>
X #include "server.h"
55cc764e3b9791d34dd406a70f67a10e
echo x - pushpoold/files/patch-util.c
sed 's/^X//' >pushpoold/files/patch-util.c << 'd258bc9144ec8c92fce63bb0ef9dd329'
X--- util.c	2012-10-10 04:45:31.000000000 -0400
X+++ util.c	2012-10-10 04:42:23.000000000 -0400
X@@ -26,7 +26,6 @@
X #include <stdlib.h>
X #include <stdio.h>
X #include <syslog.h>
X-#include <alloca.h>
X #include <errno.h>
X #include <unistd.h>
X #include <string.h>
d258bc9144ec8c92fce63bb0ef9dd329
echo x - pushpoold/files/patch-Makfile.am
sed 's/^X//' >pushpoold/files/patch-Makfile.am << 'abd9ac4db2ed593820f9a94384ef7a09'
X--- Makefile.am	2011-06-27 13:57:30.000000000 -0400
X+++ Makefile.am	2012-10-11 01:08:13.000000000 -0400
X@@ -13,4 +13,4 @@
X pushpoold_LDFLAGS = $(PTHREAD_FLAGS)
X pushpoold_LDADD	= @LIBCURL@ @EVENT_LIBS@ @PTHREAD_LIBS@ @JANSSON_LIBS@ \
X 		  @CRYPTO_LIBS@ @Z_LIBS@ @LIBMEMCACHED_LIBS@ \
X-		  @SQLITE3_LDFLAGS@ @MYSQL_LDFLAGS@ @POSTGRESQL_LDFLAGS@
X+		  @SQLITE3_LDFLAGS@ @MYSQL_LDFLAGS@ @POSTGRESQL_LDFLAGS@ -largp
abd9ac4db2ed593820f9a94384ef7a09
echo x - pushpoold/files/example-blkmon.cfg
sed 's/^X//' >pushpoold/files/example-blkmon.cfg << 'e88776b2810429919b9eec455a4d2063'
Xhost=127.0.0.1
Xport=8333
Xpid=/tmp/pushpoold.pid
X
e88776b2810429919b9eec455a4d2063
echo x - pushpoold/files/example-cfg.json
sed 's/^X//' >pushpoold/files/example-cfg.json << 'dfe0ac53fdb9af698e374ba762d52eef'
X{
X	# network ports
X	"listen" : [
X		# binary protocol (default), port 8336
X		{ "port" : 8336 },
X
X		# HTTP JSON-RPC protocol, port 8337
X		{ "port" : 8337, "protocol" : "http-json" },
X
X		# HTTP JSON-RPC protocol, port 8339,
X		# with trusted proxy appserver.example.com forwarding
X		# requests to us
X		{ "port" : 8337, "protocol" : "http-json",
X		  "proxy" : "appserver.example.com" },
X
X		# binary protocol, localhost-only port 8338
X		{ "host" : "127.0.0.1", "port" : 8338, "protocol" : "binary" }
X	],
X
X	# database settings
X	"database" : {
X		"engine" : "sqlite3",
X		"name" : "/tmp/data.sqlite",
X		"stmt.pwdb" :
X		  "SELECT password FROM pool_worker WHERE username = ?"
X
X		# ... or ...
X
X		"engine" : "mysql",
X
X		# 'host' defaults to localhost, if not specified
X		"host" : "mysql.example.com",
X
X		# 'port' uses proper default port for the DB engine,
X		# if not specified
X		"port" : 12121,
X
X		"name" : "mydatabasename",
X		"username" : "myuser",
X		"password" : "mypass",
X
X		"stmt.pwdb" :
X		  "SELECT password FROM pool_worker WHERE username = ?"
X
X		# ... or ...
X
X		"engine" : "postgresql",
X
X		"host" : "db.example.com",
X
X		"port" : 12121,
X
X		"name" : "mydatabasename",
X		"username" : "myuser",
X		"password" : "mypass",
X
X		"stmt.pwdb" :
X		  "SELECT password FROM pool_worker WHERE username = $1"
X	},
X
X	# cache settings
X	"memcached" : {
X		"servers" : [
X			{ "host" : "127.0.0.1", "port" : 11211 }
X		]
X	},
X
X	"pid" : "/tmp/pushpoold.pid",
X
X	# overrides local hostname detection
X	"forcehost" : "localhost.localdomain",
X
X	"log.requests" : "/tmp/request.log",
X	"log.shares" : "/tmp/shares.log",
X
X	# the server assumes longpolling (w/ SIGUSR1 called for each blk)
X	"longpoll.disable" : false,
X
X	# length of time to cache username/password credentials, in seconds
X	"auth.cred_cache.expire" : 75,
X
X	# RPC settings
X	"rpc.url" : "http://127.0.0.1:8332/",
X	"rpc.user" : "myusername",
X	"rpc.pass" : "mypassword",
X
X	# rewrite returned 'target' to difficulty-1?
X	"rpc.target.rewrite" : true,
X
X	# allow clients to update the ntime field of their work
X	"roll.ntime.disable" : false
X}
dfe0ac53fdb9af698e374ba762d52eef
echo x - pushpoold/files/pushpool.in
sed 's/^X//' >pushpoold/files/pushpool.in << '71430ad33ae8ef8626278882670d58d2'
X#!/bin/sh
X
X# $FreeBSD$
X#
X# PROVIDE: pushpool
X# REQUIRE: LOGIN bitcoin
X# KEYWORD: shutdown
X#
X# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
X# to enable this service:
X#
X# pushpool_enable (bool):	Set to NO by default.
X#				Set it to YES to enable pushpool.
X# pushpool_config (path):	Set to %%PREFIX%%/etc/pushpool.conf
X#				by default.
X
X. /etc/rc.subr
X
Xname=pushpool
Xrcvar=`set_rcvar`
X
Xload_rc_config $name
X
X: ${pushpool_enable:="NO"}
X: ${pushpool_config="%%PREFIX%%/etc/pushpool.conf"}
X
Xcommand=%%PREFIX%%/sbin/pushpoold
Xpidfile="/var/run/${name}.pid"
X
Xcommand_args="--config=$pushpool_config --pid=$pidfile"
X
Xrun_rc_command "$1"
71430ad33ae8ef8626278882670d58d2
echo x - pushpoold/files/pushpool.conf.sample
sed 's/^X//' >pushpoold/files/pushpool.conf.sample << 'e423f15c11975b07f447367618c19e7d'
X{
X	# network ports
X	"listen" : [
X		# binary protocol (default), port 8342
X		{ "port" : 8342 },
X
X		# HTTP JSON-RPC protocol, port 8341
X		{ "port" : 8341, "protocol" : "http-json" },
X
X		# HTTP JSON-RPC protocol, port 8344,
X		# with trusted proxy appserver.example.com forwarding
X		# requests to us
X		{ "port" : 8344, "protocol" : "http-json",
X		  "proxy" : "127.0.0.1" },
X
X		# binary protocol, localhost-only port 8338
X		{ "host" : "127.0.0.1", "port" : 8338, "protocol" : "binary" }
X	],
X
X	# database settings
X	"database" : {
X		"engine" : "mysql",
X		"host" : "localhost",
X		"port" : 3306,
X		"name" : "pushpoold",
X		"username" : "pushpoold",
X		"password" : "pushpoold12345",
X		"sharelog" : true,
X		"stmt.pwdb":"SELECT `password` FROM `pool_worker` WHERE `username` = ?",
X		"stmt.sharelog":"INSERT INTO shares (rem_host, username, our_result, upstream_result, reason, solution) VALUES (?, ?, ?, ?, ?, ?)"
X
X	},
X
X	# cache settings
X	"memcached" : {
X		"servers" : [
X			{ "host" : "localhost", "port" : 11211 }
X		]
X	},
X
X	#"pid" : "/var/run/pushpool.pid",
X
X	# overrides local hostname detection
X	"forcehost" : "localhost.localdomain",
X
X	"log.requests" : "/var/log/pushpool-request.log",
X	"log.shares" : "/var/log/pushpool-shares.log",
X
X	# the server assumes longpolling (w/ SIGUSR1 called for each blk)
X	"longpoll.disable" : false,
X
X	# length of time to cache username/password credentials, in seconds
X	"auth.cred_cache.expire" : 75,
X
X	# RPC settings | Notice how this ISN'T port number 8332 this is becuase the same port number should not becuase inconjunction with the JSON RPC port other wise you'll get 500 errors
X	"rpc.url" : "http://127.0.0.1:8333/",
X	"rpc.user" : "admin",
X	"rpc.pass" : "1234567890",
X
X	# rewrite returned 'target' to difficulty-1?
X	"rpc.target.rewrite" : true
X}
e423f15c11975b07f447367618c19e7d
echo x - pushpoold/files/blkmon.conf.sample
sed 's/^X//' >pushpoold/files/blkmon.conf.sample << 'bdf8758ddd6afde69afb73e67ec44841'
Xhost=127.0.0.1
Xport=8333
Xpid=/var/run/pushpool.pid
X
bdf8758ddd6afde69afb73e67ec44841
echo x - pushpoold/files/pkg-message.in
sed 's/^X//' >pushpoold/files/pkg-message.in << '2fc28ea9e111215c14bbea6a8d0a1c6b'
X*******************************************************************
XTo configure pushpoold, please copy: 
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pushpool.conf.sample to %%PREFIX%%/etc/pushpool.conf
Xand edit this file:
X
Xcp %%PORTEXAMPLES%%%%EXAMPLESDIR%%/pushpool.conf.sample %%PREFIX%%/etc/pushpool.conf
X
XTo run the pushpoold server at startup, add the following
Xsettings to your /etc/rc.conf
X
Xpushpool_enable="YES"
X
X*******************************************************************
2fc28ea9e111215c14bbea6a8d0a1c6b
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210110917.q9B9HSD1006178>