Fork of royalforkblog's address generator


#1

I saw this cool http://www.royalforkblog.com/2014/08/11/graphical-address-generator/
Asuming here that only the networkVersion=37 and ECKey.privateKeyPrefix=80 differs in Peercoin,
porting it shouldn’t be a problem.

Please find htm page attached and review/revise…

[code]

@font-face {

font-family: ‘Droid Sans Mono’;
font-style: normal;
font-weight: 400;
src: local(‘Droid Sans Mono’), local(‘DroidSansMono’), url(’/assets/fonts/droid_sans.ttf’) format(‘truetype’);
}

/* Private Key */

.private {
background-color: #b7c9e1;
padding: 0 0 25px 0;
margin-bottom: 0px;
}

.private-key {
margin-left: 54px;
}

.private-key .pk::after, .public-key .ripe160::after {
content: “”;
position: absolute;
height: 90px;
width: 10px;
background-image: url(/assets/imgs/wallet-gen/dash-down.svg);
background-repeat: no-repeat;
left: 50%;
top: 75px;
}

.private-key .pk::before {
content: “”;
position: absolute;
height: 304px;
width: 304px;
background-image: url(/assets/imgs/wallet-gen/pk-pub.svg);
background-repeat: no-repeat;
top: 60px;
left: -40px;
}

#passphrase {
width: 350px;
/* 520px = width of 64 hex chars /
/
(520 - 350) / 2 = 85 */
margin: 0 0 0 85px;
}

.wif-container {
margin-top: 85px;
margin-left: 38px;
}

.private-wif {
margin-left: 96px;
}

/* Public Key */

.public {
background-color: #f4f7fa;
margin-top: 0px;
}

.public-equation {
display: inline-block;
position: relative;
}

.public-equation img {
width: 100px;
vertical-align: middle;
}

/kpub/
.pub-key-label {
display: inline-block;
font-size: 30px;
margin-right: 25px;
font-style: italic;
position: relative;
}

.pub-key-label::after {
content: “pub”;
display: inline-block;
font-size: 15px;
position: absolute;
bottom: -2px;
}

.public-key-split {
position: absolute;
top: -32px;
left: 15px;
}

.public-key-x {
width: 512px;
}

.public-key-container {
width: 534px;
}

.public-coords {
font-size: 10pt;
margin-left: 50px;
}

.public-coords .hex-container {
width: 512px;
}

.public-coord-x {
display: inline-block;
position: relative;
}

.public-coord-x:after {
content: “”;
position: absolute;
height: 150px;
width: 80px;
right: -82px;
top: 15px;
background-image: url("/assets/imgs/wallet-gen/pub-x.svg");
background-repeat: no-repeat;
}

.public-coord-y {
margin-top: 10px;
}

.public-key {
position: relative;
margin-left: 54px;
}

.public-y-even-odd {
margin-left: 10px;
}

.public-key svg {
margin-left: 5px;
}

#parity-arrow {
margin: -7px 0 -4px 7px;
visibility: hidden;
}

svg.red line {
stroke: firebrick;
}

svg.red polygon {
fill: firebrick;
stroke: firebrick;
}

svg.green line {
stroke: forestgreen;
}

svg.green polygon {
fill: forestgreen;
stroke: forestgreen;
}

/* Public Address */
.public-address-container {
margin-top: 80px;
margin-left: 141px;
}

.ripe-hash {
margin-left: 104px;
}

.ripe160 {
width: 320px;
}

.public-address {
text-transform: initial !important;
margin-left: 62px;
}

.address-checksum {
width: 64px;
}

.public-address {
width: 272px;
}

/* information label things */
.information {
position: absolute;
width: 100px;
background-color: bisque;
font-size: 10pt;
padding: 5px;
box-sizing: border-box;
}

.information .title {
font-weight: bolder;
font-size: 16px;
}

.step1 {
right: -150px;
width: 125px;
bottom: 0;
}
.step2 {
width: 125px;
top: -75px;
}

.step3 {
width: 125px;
top: -75px;
right: 70px;
}

.step4 {
width: 370px;
top: -75px;
right: -305px;
}

.step5 {
top: 5px;
right: -225px;
width: 225px;
}

.step6 {
top: 35px;
right: -425px;
width: 300px;
}

.step7 {
top: 10px;
width: 515px;
left: -50px;
}

.step8 {
top: 0;
right: -225px;
width: 200px;
}

.step9 {
top: -75px;
width: 230px;
left: -95px;
}

.step10 {
top: -75px;
width: 175px;
right: -60px;
}

.step11 {
top: 0;
width: 200px;
right: -210px;
}

/*

  • /| -|
  • / | | border-top
  • / | -|
  • \ | -|
  • \ | | border-bottom
  • | -|
  • |___|
  • | border-right
  • Make sure height + width are 0

*/
.information::after {
content: “”;
position: absolute;
font-size: 10pt;
}

.information-arrow-left-bottom::after {
bottom: 5px;
left: -20px;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 20px solid bisque;
}

.information-arrow-left-middle::after {
bottom: 20px;
left: -20px;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 20px solid bisque;
}

.information-arrow-left-top::after {
top: 5px;
left: -20px;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 20px solid bisque;
}

.information-arrow-bottom-left::after {
left: 0px;
bottom: -20px;
border-top: 20px solid bisque;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}

.information-arrow-bottom-right::after {
right: 0px;
bottom: -20px;
border-top: 20px solid bisque;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}

.information-arrow-bottom-middle::after {
right: 50%;
bottom: -20px;
border-top: 20px solid bisque;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}

/Utilities/

.public, .private {
min-width: 980px;
}

.section-header {
font-size: 18px !important;
letter-spacing: 0px !important;
margin-bottom: 10px;
padding: 5px;
}

.container {
display: inline-block;
font-size: 0;
position: relative;
}

.container + .container {
margin-top: 20px;
}

.center {
text-align: center;
}

/Hex Part Things/
.version {
background-color: lightcoral;
}

.checksum {
background-color: gold;
}

.compression-flag {
background-color: lightpink;
}

.hex-container {
font-family: “Droid Sans Mono”;
text-transform: uppercase;
font-size: 0px;
border: 1px solid #000;
display: inline-flex;
padding: 0;
background-color: #ffffff;
}

.hex-container > div, .hex-padding {
display: inline-block;
padding: 3px;
font-size: 10pt;
}

.hex-container > .hex-left {
font-size: 10pt;
padding: 3px 0 3px 3px;
}

.hex-container > .hex-middle {
font-size: 10pt;
padding: 3px 0;
}

.hex-container > .hex-right {
font-size: 10pt;
padding: 3px 3px 3px 0;
}

<body>

<header class="site-header">
<div class="header-description">-&nbsp;&nbsp;Peercoin.</div>
<div class="wrap">
  <div class="sidebar">
    <div class="sidebar-content">
  </div>
  <div class="page-content">

Step by step Address Generator (Peercoin)

Generate Private Key

type something
1. Private key is 256 random bits.
    <div class="version hex-left">B7</div>
    <div class="pk hex-middle"></div>
    <div class="compression-flag hex-middle">01</div>
    <div class="checksum-pk checksum hex-right"></div>
  </div>
  <div class="information step2 information-arrow-bottom-left"><span class="title">2.</span> Prepend version number.</div>
  <div class="information step3 information-arrow-bottom-right"><span class="title">3.</span> Append compression flag.</div>
  <div class="information step4 information-arrow-bottom-left"><span class="title">4.</span> Append checksum. Checksum is the first 4 bytes of double sha256 hash of whatever is being checkedsum'ed.</div>
</div>
  <div>
    <div class="private-wif hex-container hex-padding"></div>
  </div>
  <div class="information information-arrow-left-top step5"><span class="title">5.</span> Base58 encoded data is easier to read and manage.  The "double-arrows" indicate this is reversible.</div>
</div>

Generate Public Key (compressed)

k
= * G


6. Multiply the private key by the elliptic curve generator point to get the public key. The public key is a point on the elliptic curve and has x and y coordinates.
<div class="public-coords">
  <div class="public-coord-x">
    x = <span class="hex-container hex-padding public-x"></span>
  </div>
  <div class="public-coord-y">
    y = <span class="hex-container hex-padding public-y"></span><span class="public-y-even-odd"></span>
  </div>
</div>


N/
A
7. Use parity of y coordinate and full x coordinate to represent the public key.




<div class="ripe-hash">
  <div class="ripe160 hex-container hex-padding">N/A</div>
</div>
<div class="information step8 information-arrow-left-top"><span class="title">8.</span> Hash public key twice.  This obfuscates the public key and shortens it.</div>




37
9. Prepend version (version number is different than in step 2)
10. Append checksum (same method as step 4)
  <div>
    <div class="hex-container hex-padding public-address">N/A</div>
  </div>
  <div class="information information-arrow-left-top step11"><span class="title">11.</span> After another base58 encoding, we have our public address :)</div>
</div>
  </div>
</div>

<footer class="site-footer">
<h2 class="footer-heading">copied from The Royal Fork</h2>

<div class="footer-col-1 column">

</div>

<div class="footer-col-2 column">

</div>

<div class="footer-col-3 column">

</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</body>

[/code]


#2

Better to insert as ‘code’. (/code) or insert # button while selecting code in post editor.


#3

I have a vanity address generator for peercoin, or is this just an address generator? I’ll need to look closer at code.

Fuzzybear

Sent from my HTC Desire using Tapatalk 2


#4

royal fork site is down. But for educational purpose, let me have a look at it this weekend and put a revamped version in github…


#5

I modded your original post to put code quotes round the code and ran the file locally I can see this is quite a nice explanation how the address formed etc and calculated so yes would be great for peercoin, I see you have made a few tweaks already.

I guess using https://wallet.peercointalk.org/ will be good for verifying addresses and private keys etc
https://vanity.peercointalk.org/ - is a link to the vanity address generator I was talking about
https://phpcoinaddress.peercointalk.org/ also lets you generate simple PPC addresses very quickly if you are not interested in the vanity part.

screenshot attached of the royalforkblog’s peercoin version so far:

Fuzzybear


#6

refactored and shared the proper way: ;D


#7

nice one [member=30004]thehuntergames[/member] :slight_smile:

I took the public folder and made the subdomain http://graphicalpeercoinaddress.peercointalk.org

testing and confirming with wallet details on https://wallet.peercointalk.org Not seeing matching addresses though yet :frowning:

passphrase = testing
Private key = CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90
generates PHcT6juYTVJBbG8Kzs1n8FV9omJqg6UFQE

on https://wallet.peercointalk.org under wallet details tab
CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90 is a valid private key format
Peercoin Address: PSDQ2ZwPUNK4ScrG2j7PaNJmGDum6rAYVq
Peercoin Address (compressed): PHYdhFPK8sMSAkQ81NdjsNtPJf6bAbbJnx
Private Key WIF (51 characters base58, starts with a ‘7’): 7AJcg18cy3gsKaAX6PSBzsYiwX74s6q5RQov7HudFgJnitJcGeM
import that WIF private key into Peerunity: PSDQ2ZwPUNK4ScrG2j7PaNJmGDum6rAYVq

7FDE73BAAA48EB75C013FE9FF52A74A096D48B9978351BDCB5B72331CA37487C is a valid private key format
Peercoin Address: PECqbpf4uBJu2gWVHEtzgj3yp8ZC6wE4Ug
Peercoin Address (compressed): PSw6v78WKcJmrAqK9MA5LQDXrqGXGHzum1
Private Key WIF (51 characters base58, starts with a ‘7’): 79hYXQB2hUPUd89VDz78MRfM12WVWyi8fjssb4y6dP31WPnFeKm
import that WIF private key into Peerunity: PECqbpf4uBJu2gWVHEtzgj3yp8ZC6wE4Ug
Private Key Hexadecimal Format (64 characters [0-9A-F]):7FDE73BAAA48EB75C013FE9FF52A74A096D48B9978351BDCB5B72331CA37487C (so this matches)

all other import to wallet or peerunity are not valid. So am I just missing the fact that this does not actually generate the Private Key WIF ready to import to peerunity?

Fuzzybear


#8

I entered the following priv key generated by wallet.peerc… itself: 79rESAH9xs48rv8rZgD3H6bTtXkZhZzDkDgP6K6mvFVRiZvpZuh

it comes up with;
Private Key WIF (compressed, 52 characters base58, starts with a ‘U’):
UA4JJ3xJZZvqhKXfmE4943h7gSjHL4bZFkxpWStVG2xU6NgU7Sqx

sadly you cant enter this key in compressed form(the one thats starts with U) as it is not accepted. :’(

maybe it should be changed into showing how the Private Key WIF (51 characters base58, starts with a ‘7’) is made :-*


#9

after some testing in http://bitaddress.org, I sadly have to say though that one is allowed to enter the wif compressed form:

Private Key WIF Compressed
52 characters base58, starts with a ‘K’ or ‘L’
KwdMABauTDh9wBDrib4SM2EyAznUXsmgrYTJMWJKNcaFa8N9ws3Z

so we have found a missing feature or bug in wallet.peercointalk :omg:


#10

hi fuzzy

I uploaded a new version on github. There was a CSS UpperCase declaration that shouldnt be applied to the private key box.


#11

Updated http://graphicalpeercoinaddress.peercointalk.org/

seed word “testing”

Private key is 256 random bits from SHA256 - CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90

WIF = UC4kT9adkNry6yP1pn2BYS727dsn48jCWk65QmdH1nVWoeB5Xiso
Public Key - PHcT6juYTVJBbG8Kzs1n8FV9omJqg6UFQE

Input CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90 on https://wallet.peercointalk.org/

Peercoin Address: PSDQ2ZwPUNK4ScrG2j7PaNJmGDum6rAYVq
Peercoin Address (compressed): PHcT6juYTVJBbG8Kzs1n8FV9omJqg6UFQE

Private Key WIF (51 characters base58, starts with a ‘7’): 7AJcg18cy3gsKaAX6PSBzsYiwX74s6q5RQov7HudFgJnitJcGeM
Private Key WIF (compressed, 52 characters base58, starts with a ‘U’): UC4kT9adkNry6yP1pn2BYS727dsn48jCWk65QmdH1nVWoeB5Xiso

So the addresses all match fine, it is just that https://wallet.peercointalk.org/ seems to not handle some of the other private key formats, ill look into this, graphicalpeercoinaddress works nicely :slight_smile:

Fuzzybear


#12

[quote=“FuzzyBear, post:11, topic:2783”]Peercoin Address: PSDQ2ZwPUNK4ScrG2j7PaNJmGDum6rAYVq
Peercoin Address (compressed): PHcT6juYTVJBbG8Kzs1n8FV9omJqg6UFQE[/quote]

I’m a bit confused. Why is there two addresses? What is the difference?


#13

Not directly related but found an interesting slideshare about bitcoin addresses (mostly apply to peercoin addresses too) :


#14

Happy holidays everyone,

I decided to update the GraphicalPeercoinAddress project with a P2TH calculator, just for kicks.

Test vector:

{
“txnId”: “c23375caa1ba3b0eec3a49fff5e008dede0c2761bb31fddd830da32671c17f84”,
“Address”:“PRoUKDUhA1vgBseJCaGMd9AYXdQcyEjxu9”
}

live at https://jointhepartypooper.github.io/GraphicalPeercoinAddress/public/

cheers


#15

You can publish it using gh-pages!

(create a branch with name gh-pages and it will be served by github)


#16

that is a good tip :))

https://jointhepartypooper.github.io/GraphicalPeercoinAddress/public/