Skip to content

Commit

Permalink
Merge pull request #30 from Lovok/master
Browse files Browse the repository at this point in the history
Cleanup 2nd VTC, add 3rd VTC, add Caishen, fix #30
  • Loading branch information
donSchoe committed Apr 29, 2014
2 parents e57e3b4 + 9e92ef4 commit bb13a0f
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ http://stackoverflow.com/q/6034390/1260906
Running P2Pool:
-------------------------
Vertcoin:
* Run P2Pool with the "--net vertcoin" or "--net vertcoin2" (if you want to connect to 2nd network; use --worker-port 9171 if you want default port for 2nd network workers) option.
* Run your miner program, connecting to 127.0.0.1 on port 9171 or 9172 (for 2nd network).
* Run P2Pool with the "--net vertcoin", "--net vertcoin2" (if you want to connect to 2nd network) or "--net vertcoin3" (for 3rd network) option.
* Run your miner program, connecting to 127.0.0.1 on port 9171, 9172 (for 2nd network) or 9174 (for 3rd network).

GPUCcoin:
* Run P2Pool with the "--net gpucoin" option.
Expand Down
42 changes: 41 additions & 1 deletion p2pool/bitcoin/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ def spa_sub(n):

return 101-i

def get_caishensubsidy(bnHeight):
nSubsidy = 28

if bnHeight == 0:
nSubsidy = 1
elif bnHeight < 2:
nSubsidy = 560000
elif bnHeight > 3583630:
nSubsidy = 1
elif bnHeight > 2150178:
nSubsidy = 3
elif bnHeight > 1075089:
nSubsidy = 5
elif bnHeight > 358363:
nSubsidy = 10

return int(nSubsidy * 100000000)

def get_subsidy(nCap, nMaxSubsidy, bnTarget):
bnLowerBound = 0.01
bnUpperBound = bnSubsidyLimit = nMaxSubsidy
Expand Down Expand Up @@ -245,7 +263,7 @@ def check_genesis_block(bitcoind, genesis_block_hash):
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),

kimocoin=math.Object(
P2P_PREFIX='6b696d6f'.decode('hex'),
P2P_PORT=1889,
Expand All @@ -267,6 +285,28 @@ def check_genesis_block(bitcoind, genesis_block_hash):
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),

caishen=math.Object(
P2P_PREFIX='fabfb5da'.decode('hex'),
P2P_PORT=14260,
ADDRESS_VERSION=28,
RPC_PORT=14261,
RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'caishenaddress' in (yield bitcoind.rpc_help()) and
not (yield bitcoind.rpc_getinfo())['testnet']
)),
SUBSIDY_FUNC=lambda height: get_caishensubsidy(height),
POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('vtc_scrypt').getPoWHash(data)),
BLOCK_PERIOD=88, # s
SYMBOL='CAI',
CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Caishen') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Caishen/') if platform.system() == 'Darwin' else os.path.expanduser('~/.caishen'), 'caishen.conf'),
BLOCK_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/block/',
ADDRESS_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/address/',
TX_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/tx/',
SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),

)
for net_name, net in nets.iteritems():
Expand Down
44 changes: 41 additions & 3 deletions p2pool/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=9171,
BOOTSTRAP_ADDRS='q30.qhor.net seed.p2pool.etyd.org vtc.royalminingco.com p2pool.letsmine.it'.split(' '),
BOOTSTRAP_ADDRS='q30.qhor.net seed.p2pool.etyd.org vtc.royalminingco.com p2pool.letsmine.it lovok.no-ip.com'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-vtc',
VERSION_CHECK=lambda v: True,
),

vertcoin2=math.Object( # --> low hashrate net
vertcoin2=math.Object( # --> middle hashrate net
PARENT=networks.nets['vertcoin'],
SHARE_PERIOD=15, # seconds
CHAIN_LENGTH=24*60*60//10, # shares
Expand All @@ -100,7 +100,26 @@
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=9172,
BOOTSTRAP_ADDRS='lovok.no-ip.com:9346 lovok.no-ip.com:9347 us-east.p2pools.net:9346 us-east.p2pools.net:9347 vert.marcsi.ch:9346 vert.marcsi.ch:9347'.split(' '),
BOOTSTRAP_ADDRS='lovok.no-ip.com us-east.p2pools.net us-central.p2pools.net us-west.p2pools.net vert.marcsi.ch'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-vtc',
VERSION_CHECK=lambda v: True,
),

vertcoin3=math.Object( # --> low hashrate net
PARENT=networks.nets['vertcoin'],
SHARE_PERIOD=15, # seconds
CHAIN_LENGTH=24*60*60//10, # shares
REAL_CHAIN_LENGTH=24*60*60//10, # shares
TARGET_LOOKBEHIND=200, # shares
SPREAD=12, # blocks
IDENTIFIER='a06a81c827cab975'.decode('hex'),
PREFIX='7c3614a6bcdcf796'.decode('hex'),
P2P_PORT=9348,
MIN_TARGET=4,
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=9174,
BOOTSTRAP_ADDRS='lovok.no-ip.com vtc.cubeconnex.com'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-vtc',
VERSION_CHECK=lambda v: True,
),
Expand Down Expand Up @@ -201,6 +220,25 @@
VERSION_CHECK=lambda v: True,
),

caishen=math.Object(
PARENT=networks.nets['caishen'],
SHARE_PERIOD=15, # seconds
CHAIN_LENGTH=24*60*60//10, # shares
REAL_CHAIN_LENGTH=24*60*60//10, # shares
TARGET_LOOKBEHIND=200, # shares
SPREAD=12, # blocks
IDENTIFIER='a06a81c827cab9e3'.decode('hex'),
PREFIX='7c3614a6bcdcf7e4'.decode('hex'),
P2P_PORT=2828,
MIN_TARGET=4,
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=2888,
BOOTSTRAP_ADDRS='thepool.pw lovok.no-ip.com'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-cai',
VERSION_CHECK=lambda v: True,
),

)
for net_name, net in nets.iteritems():
net.NAME = net_name
12 changes: 4 additions & 8 deletions web-static.modern/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ <h4>Status</h4>
<td width='25%' class='text-right'><span id='expected_time_to_block'></span></td>
</tr>
<tr>
<td width='25%'>Node fee:</td>
<td width='25%' class='text-right'><span id='node_fee'></span></td>
<td width='25%'>Node fee / donation:</td>
<td width='25%' class='text-right'><span id='node_fee'></span> / <span id='node_donation'></span></td>
<td width='25%'>Node uptime:</td>
<td width='25%' class='text-right'><span id='node_uptime'></span></td>
</tr>
Expand All @@ -139,10 +139,6 @@ <h4>Status</h4>
<td width='25%'>Protocol version:</td>
<td width='25%' class='text-right'><span id='protocol_version'></span></td>
</tr>
<!--<tr>
<td width='25%'>Node donation:</td>
<td width='25%' class='text-right'><span id='node_donation'></span></td>
</tr>-->
</table>

<h4>Active miners on this node</h4>
Expand Down Expand Up @@ -343,8 +339,8 @@ <h4>Recent blocks</h4>
.text(parseFloat(local_stats.block_value).toFixed(8))
.append(' ').append(currency.clone());

//$('#node_donation')
// .text(local_stats.donation_proportion + '%');
$('#node_donation')
.text((local_stats.donation_proportion * 100) + '%');

$('#node_fee')
.text(local_stats.fee + '%');
Expand Down

0 comments on commit bb13a0f

Please sign in to comment.