Pages:
Author

Topic: [BOUNTY] Project: Private Key Label Printer for BitAddress.org - page 2. (Read 5666 times)

sr. member
Activity: 336
Merit: 250
Time for Plan ฿
Great work! Kudos to you both. I will send specs of the round labels that can be purchased here in the UK soon when I get them.
full member
Activity: 147
Merit: 100
Realbitcoin.info
 Still waiting for my labels, but everything is working well.

Thanks again guys.
I have sent Bitkook And Bitcoin Grid 0.2 Btc

ba427a040ebdf74c4afddb62cdd214b537603a04d2ea382be3bdaafc8a639b4b
e75a3e4dad2fed5cd3a8778d24f1ef1d64581ddfd4fc2607f88019d8348f6236
member
Activity: 113
Merit: 10
My version is done as well. I finaly managed to get the label and QR code placement better.  Chrome is the way to go. IE and Firefox struggle with the key generation which takes a lot longer than Chrome.

Link: BitAddress fork 0.1

I would like to hear some feedback. But please, try it on 'normal' paper first before trying it on actual sticker sheets Wink.

My version is done, it runs best in chrome.

Nice work Bitcoin Grid! I like the countdown when generating labels, and the fact that you made everything configurable. I have opted to try and find a best fit for the QR code and font sizes during code generation based on the label width.

Edit 21-06: Uploaded v 0.2. Sometimes the QR codes would come out blurry. This happened if the number of modules in the QR code was not a multiple of the number of pixels in the QR code width. Now by default the QR code width in pixels is a multiple of the modules in the QR code. If you want the code to be stretched to the maximum available width of the label, you can still do so by ticking the 'Allow QR scaling' checkbox.

I have also included jQuery. This will allow me to do more positioning and scaling improvements much more easily in the future (I plan on rewriting some of the old code to jQuery as well).

Link: BitAddress fork 0.2
newbie
Activity: 18
Merit: 0

Great work!

Was testing, then my printer run out off ink on the first sheet!  Angry
In other news, you finished the job faster then it took me to get the labels!

Please let me know your public key so I can 'buy' you some labels!  Tongue
Same goes for the next person to finish.

The one problem I did run across was the "change your paper size" text was acros the labels if using small margins,
but these could be edited out.

Just delete line 10401 or do a ctrl-f for this and just remove it
Code:
doc.text(10,4,'When printing use the "actual size" option and change your paper size to '+ base.format);

I will make it smaller in v0.2
full member
Activity: 147
Merit: 100
Realbitcoin.info

Great work!

Was testing, then my printer run out off ink on the first sheet!  Angry
In other news, you finished the job faster then it took me to get the labels!

Please let me know your public key so I can 'buy' you some labels!  Tongue
Same goes for the next person to finish.

The one problem I did run across was the "change your paper size" text was acros the labels if using small margins,
but these could be edited out.
member
Activity: 113
Merit: 10
Ok, let's work together on this Smiley

This should do the trick using the SecureRandom random number generator from BitAddress:

[edit 18-06]: Added the incremental key altering suggested by casascius to make finding valid keys faster. Firefox and IE only take 8 seconds for a full sheet now, Chrome is even faster.

Code:
generateMiniKey: function () {
  var rng = new SecureRandom();
  var possible = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
  var key = "S";
  
  for(var i = 0; i < 29; i++) {
    // Get a secure random number. The first argument to the BigInteger constructor
    // is the maximum number of bits to use, the second argument is the random number generator.
    var randomNumber = this.getSecureRandomNumber(rng, 0, possible.length - 1);
    key += possible.charAt(randomNumber);
  }
  
  // Replace random characters at random positions in the key until we found a valid minikey        
  do {
    var keyIndex = this.getSecureRandomNumber(rng, 1, key.length - 1);
    var replacementChar = possible[this.getSecureRandomNumber(rng, 0, possible.length - 1)];
    key = key.replaceAt(keyIndex, replacementChar);
  } while (!Bitcoin.ECKey.isMiniFormat(key));
  return key;
},

getSecureRandomNumber: function(rng, lowerBound, upperBound) {
  var randomNumber = lowerBound - 1;
  
  do {
    randomNumber = new BigInteger(upperBound.toString(2).length, rng);
  }
  // Filter out any numbers which have the right amount of bits, but are outside the upperBound.
  while(randomNumber < lowerBound || randomNumber > upperBound);
  
  return randomNumber.intValue();
},

You'll also need this string prototype function:
Code:
String.prototype.replaceAt=function(index, character) {
  return this.substr(0, index) + character + this.substr(index+character.length);
};

Added minikey generation (works with QR and text) and the ability to add one row of custom text:



Now I need to improve the positioning and scaling of the text and QR codes, because I'm not completely satified yet.
newbie
Activity: 18
Merit: 0
This makes mini keys but uses the javascript random number generator which is not good for cryptography i tried using the BitAddress SecureRandom function but i cant understand how it works. Can someone have a look at this?

Code:
//This code unsuitable for cryptographic purposes due to the use of Math.random();
//Bitcoin Grid - bitcoingrid.com
generateMiniKey: function (){
var possible = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
do{
var key = "S";
for( var i=0; i < 29; i++ ){
key += possible.charAt(Math.floor(Math.random() * possible.length));
}
} while (!Bitcoin.ECKey.isMiniFormat(key));
return key;
}
full member
Activity: 180
Merit: 100
vip
Activity: 1386
Merit: 1140
The Casascius 1oz 10BTC Silver Round (w/ Gold B)
Just generating 256 takes 9 seconds on my computer so a whole sheet would take about 10 minutes!

I will give it a go but its going to be slow.

Chrome seems to run javascript the fastest by far.

Generating minikeys requires a fair bit of throwing away possible candidates.  If those candidates are being generated randomly each time, the random number generation might be an easily removed bottleneck.  Simply generate ONE random candidate, and if it's not valid, increment it until it is.  The act of incrementing it is likely to be much faster than redoing the entire random generation.  Obviously, once you find a candidate, the next one must be random.

By "increment", I simply mean the following: look at the last character of the candidate, and increment it, UNLESS it was: H,N,k (in this case, increment it twice to skip illegal characters I,O,l), OR if it was 9 make it an A, OR if it was Z make it a (lowercase) a, OR if it was a z, then make it a 2 and repeat the incrementing process on the preceding character.  (Yes ordinarily it should be a 1, but I'm biased against the number 1 appearing in minikeys since they are the #1 cause of complaints when people type them as "l" and I have therefore eliminated them from all my series 2 coins, but they are otherwise still legal for minikeys)

full member
Activity: 249
Merit: 114
Who is John Galt?
I used 1.125" labels from sheet-labels.com for my coins. The part number is SL266. The labels are slightly smaller than the space on the coin so that you don't have worry as much about aligning them perfectly.

Also, because my printer doesn't have good registration, I had to add quite a bit of buffer around the edge of the labels in case the paper wasn't aligned perfectly.

I used the minikey format to generate the QR code. I chose the Q error correction level (30% maybe?). Fewer bits with more error correction makes the QR code more durable and requires less camera resolution to read the code. Take a look at the difference.

Here is a minikey with Q error correction:


Here is a base-58 key with Q error correction:
newbie
Activity: 18
Merit: 0
The 29mm labels are going to be the best fit on the coins but probably going to be harder to find in the US where 1 inch (25.4mm) is far more common unless someone wants to pay expensive shipping from outside US.  Ideally it should work with any labels - someone should be able to figure out the numbers for their particular labels and then hit print.

The send many command also needs to send to the Bitcoin address not the private key (starts with 1 not 5) and also needs to be a comma and space after the amount.

Also this would work so much better if it could generate the 30 character minikey and not the full length 51 char privkey. Mini keys are easy to generate, just generate 'S' plus 29 random alphanumerics in the base58 set, do a quick sha256 test on it+'?' (only 1 in 256 codes will pass the test), and increment or regenerate the code until you get one that passes. When you have one that passes just take sha256 of the string and use it as a private key. Minikey is described on the Bitcoin wiki and redemption is well established since I use it in Casascius Coins. I am willing to pay this bounty out more than once and would love to see bitaddress modified to make minikeys.


Just generating 256 takes 9 seconds on my computer so a whole sheet would take about 10 minutes!

I will give it a go but its going to be slow.
vip
Activity: 1386
Merit: 1140
The Casascius 1oz 10BTC Silver Round (w/ Gold B)
I plan to pay this bounty out more than once so please don't worry about your "competition", please feel free to "steal" one another's ideas, as ultimately the most desirable end result is one fork that has every benefit that's been thought of here.
member
Activity: 113
Merit: 10
I have made it possible to choose the units you want to enter the measurements in (inches, milimeters and pixels). As a quick check to see if you have the right numbers the width and height of the sheet in the chosen units are shown. That should allow anyone anywere to get the right dimensions for the generated labels in their preferred units.

I have fixed the send many string (added comma and put in the public adres (painfull mistake Smiley).

I will have a look at the mini key specification tomorrow if time permits. Sounds like a good solution if the user wants some custom text added to the label.

Units in milimeters:


Units in pixels:
vip
Activity: 1386
Merit: 1140
The Casascius 1oz 10BTC Silver Round (w/ Gold B)
The 29mm labels are going to be the best fit on the coins but probably going to be harder to find in the US where 1 inch (25.4mm) is far more common unless someone wants to pay expensive shipping from outside US.  Ideally it should work with any labels - someone should be able to figure out the numbers for their particular labels and then hit print.

The send many command also needs to send to the Bitcoin address not the private key (starts with 1 not 5) and also needs to be a comma and space after the amount.

Also this would work so much better if it could generate the 30 character minikey and not the full length 51 char privkey. Mini keys are easy to generate, just generate 'S' plus 29 random alphanumerics in the base58 set, do a quick sha256 test on it+'?' (only 1 in 256 codes will pass the test), and increment or regenerate the code until you get one that passes. When you have one that passes just take sha256 of the string and use it as a private key. Minikey is described on the Bitcoin wiki and redemption is well established since I use it in Casascius Coins. I am willing to pay this bounty out more than once and would love to see bitaddress modified to make minikeys.
newbie
Activity: 18
Merit: 0
There is one problem with presets; every browser and every printer prints pages differently (especially the margins are different, and the DPI of the printer will also have an effect because CSS assumes a default DPI of 96).

It's better to give users enough control so they can try to find the right parameters with a few blank normal paper pages before printing on the sticker pages.

Mine uses PDFs so you just print it as actual size with the correct paper size and it will come out the same on every printer.
member
Activity: 113
Merit: 10
There is one problem with presets; every browser and every printer prints pages differently (especially the margins are different, and the DPI of the printer will also have an effect because CSS assumes a default DPI of 96).

It's better to give users enough control so they can try to find the right parameters with a few blank normal paper pages before printing on the sticker pages.
newbie
Activity: 18
Merit: 0
I see, that's great. They do have templates on the website but not full specs. I guess I will order a few sheets to start with and measure and supply the required info.

Or just contact the company and ask for them?
sr. member
Activity: 336
Merit: 250
Time for Plan ฿
I see, that's great. They do have templates on the website but not full specs. I guess I will order a few sheets to start with and measure and supply the required info.
newbie
Activity: 18
Merit: 0
Not sure about the defaults but could you please also create presets for us metric folk for the following label sheets?

White 29mm diameter: http://www.labelplanet.co.uk/proddetail.php?prod=Round-Labels-White-Paper-29mm
Silver 25mm diameter: http://www.labelplanet.co.uk/proddetail.php?prod=Round-Silver-Labels-25mm

Thanks!

Mines coded in mm not inches.

I can’t find the specs for those labels on the website.

Do you have the specs for them? I need these (in mm):
Top Margin
Left Margin
Circle Diameter
Horizontal Spacing
Vertical Spacing
Num Labels Across
Num Labels Down
Pages:
Jump to: