is there a .conf entry that will auto sign all of my mined blocks?
No, but the Python code I posted could be modified to check against your current addresses and make those signatures automatically
# worldrecords.py
#
# Created by Clark Moody. Public domain.
#
# Show some love: AMLVXfPytaGv7Cx8X5ZnMtqQrQhAbtyNtr
#
#
from jsonrpc import ServiceProxy
import json
USER = '<user>'
PASS = '<pass>'
PORT = 9912
fname = 'worldrecords.txt'
checkMine = True
myName = 'Clark Moody'
# Searching for new world records
def main():
ip = '127.0.0.1'
addy = 'http://%s:%s@%s:%i' % (USER,PASS,ip,PORT)
p = ServiceProxy(addy)
# http://users.cybercity.dk/~dsl522332/math/Cunningham_Chain_records.htm
# http://www.primenumbers.net/Henri/fr-us/BiTwinRec.htm
records = {
# Length 6
'1CC06':{
'digits':633,
'block':None
},
'2CC06':{
'digits':475,
'block':None
},
# BiTwin chain of 6 primes, 2 links
'TWN06':{
'digits':399,
'block':None
},
# Length 7
'1CC07':{
'digits':356,
'block':None
},
'2CC07':{
'digits':251,
'block':None
},
# Length 8
'1CC08':{
'digits':186,
'block':None
},
'2CC08':{
'digits':224,
'block':None
},
# BiTwin chain of 8 primes, 3 links
'TWN08':{
'digits':177,
'block':None
},
# Length 9
'1CC09':{
'digits':185,
'block':None
},
'2CC09':{
'digits':111,
'block':None
},
# Length 10
'1CC0a':{
'digits':99,
'block':None
},
'2CC0a':{
'digits':109,
'block':None
},
# BiTwin chain of 10 primes, 4 links
'TWN0a':{
'digits':92,
'block':None
},
# Length 11
'1CC0b':{
'digits':50,
'block':None
},
'2CC0b':{
'digits':63,
'block':None
},
# Length 12
'1CC0c':{
'digits':42,
'block':None
},
'2CC0c':{
'digits':62,
'block':None
},
# BiTwin chain of 12 primes, 5 links
'TWN0c':{
'digits':47,
'block':None
},
# Length 13
'1CC0d':{
'digits':39,
'block':None
},
'2CC0d':{
'digits':33,
'block':None
},
# Length 14
'1CC0e':{
'digits':25,
'block':None
},
'2CC0e':{
'digits':33,
'block':None
},
# BiTwin chain of 14 primes, 6 links
'TWN0e':{
'digits':29,
'block':None
},
# Length 15
'1CC0f':{
'digits':24,
'block':None
},
'2CC0f':{
'digits':32,
'block':None
},
# Length 16
'1CC10':{
'digits':23,
'block':None
},
'2CC10':{
'digits':28,
'block':None
},
# BiTwin chain of 16 primes, 7 links
'TWN10':{
'digits':24,
'block':None
},
# Length 17
'1CC11':{
'digits':22,
'block':None
},
'2CC11':{
'digits':25,
'block':None
},
# Length 18
'1CC12':{
'digits':None,
'block':None
},
'2CC12':{
'digits':None,
'block':None
},
# BiTwin chain of 18 primes, 8 links
'TWN12':{
'digits':24,
'block':None
}
}
# Record history
hist = {}
data = {}
try:
with open(fname, 'r') as f:
data = json.load(f)
except:
pass
height = 1
if 'height' in data:
height = data['height']
if 'records' in data:
records = data['records']
if 'hist' in data:
hist = data['hist']
blockHash = p.getblockhash(height)
block = p.getblock(blockHash)
while 'nextblockhash' in block:
chain = block['primechain'].split('.')[0]
chainlength = 0
try:
chainlength = int(chain[3:5],16)
except:
print('Error with chain: %s, Block %i' % (chain,block['height']))
origin = block['primeorigin']
digits = len(origin)
height = block['height']
newrecord = False
if chain in records:
if digits > records[chain]['digits']:
print('New World Record!')
print(' Block %i, Chain %s (%i primes), %i digits' %
(height, chain, chainlength, digits))
if records[chain]['block'] is not None:
print(' *Previous record held by Primecoin, Block %i' %
(records[chain]['block'],))
print(' Previous record: %i digits' % (records[chain]['digits']))
records[chain]['digits'] = digits
records[chain]['block'] = height
newrecord = True
else:
print('New Chain Type: %s, Block %i, %i digits' %
(chain, height, digits))
records[chain] = {
'digits':digits,
'block': height
}
newrecord = True
if newrecord:
if chain not in hist:
hist[chain] = []
hist[chain].append({'block':height, 'digits':digits})
if newrecord and checkMine:
txid = block['tx'][0]
try:
txn = p.gettransaction(txid)
addy = txn['details'][0]['address']
if AddressMine(p, addy):
print(' **** You found it! Block %i **** \n' % (height))
except:
pass
block = p.getblock(block['nextblockhash'])
print('End of block chain reached. Height: %i' % (height,))
data = {
'records': records,
'height': block['height'],
'hist': hist
}
with open(fname, 'w') as f:
json.dump(data, f)
types = ['1CC', '2CC', 'TWN']
print('\n\n=== Record History ===\n')
for t in types:
for i in range(6,20):
chain = '%s%s' % (t, hex(i)[2:].zfill(2))
if chain not in hist:
continue
print(chain)
for r in hist[chain]:
print(' Height: %6i, Digits: %3i' %
(r['block'], r['digits']))
print(' ')
print('\n\n=== Current Records ===\n')
s = ' '
for t in types:
s = '%s%7s' % (s, t)
print('%s\n' % (s,))
for i in range(6,20):
s = ' %.2i' % (i,)
for t in types:
chain = '%s%s' % (t,hex(i)[2:].zfill(2))
if chain not in records or records[chain]['digits'] is None:
s = '%s%7s' % (s,'--')
else:
if records[chain]['block'] is not None:
s = '%s%7s' % (s, ('*%i' % (records[chain]['digits'])).rjust(7))
else:
s = '%s%7i' % (s, records[chain]['digits'])
print(s)
print('\n*Found by Primecoin network\n')
def AddressMine(P, addy):
print('Attempting to sign message for address %s' % addy)
msg = '%s owns this address: %s' % (myName, addy)
try:
sig = P.signmessage(addy, msg)
except:
return False
else:
print('Signed message:\n%s\nwith address: %s\nSignature:\n%s' %
(msg,addy,sig))
return True
if __name__ == '__main__':
main()
NOTE: Your wallet will need to be unlocked while you run this code. A simple modification to the script could unlock your wallet for you, but then you would be saving your wallet password in the source... Also, you might want to change your name on line 20 (unless you want to sign your world record over to me
)
NOTE 2: This new code prints out the history of records found by Primecoin. To get a complete picture, you'll need to delete your existing worldrecords.txt and re-scan from the beginning of the block chain.