<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Casascius</id>
	<title>Bitcoin Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Casascius"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Casascius"/>
	<updated>2026-05-18T19:49:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User_talk:Casascius/Radial_BitCoin&amp;diff=55977</id>
		<title>User talk:Casascius/Radial BitCoin</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User_talk:Casascius/Radial_BitCoin&amp;diff=55977"/>
		<updated>2015-04-05T15:14:54Z</updated>

		<summary type="html">&lt;p&gt;Casascius: Shout-out to Luke-Jr&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Radial Bitcoin&#039;&#039;&#039; is a page once created by Casascius as a satirical disparagement of [[tonal bitcoin]].  It is now, temporarily at the least, an apology piece toward the person and the idea the satire was directed toward.  Not for any specific reason or in reaction to anything - rather, this morning I got up and decided that today I would post this.&lt;br /&gt;
&lt;br /&gt;
I am Mike Caldwell.  Casascius.  A part of me has always been bothered by my having created a page here like I did and thrown out unwarranted negativity toward one of the biggest contributors to the Bitcoin project.  Sure, I think I still maintain that the idea of putting something in the Bitcoin software that would be confusing to everybody other than a select few isn&#039;t in the best interest in the project, but I am pretty sure that to put the level of effort I did into making a big deal out of it was pretty uncool.  It was also unnecessary.&lt;br /&gt;
&lt;br /&gt;
Bitcoin, at least now and even then, is not a one-man project, and the dynamics of collaboration were more than enough to ensure only the best ideas went into the project.  In retrospect, the notion that I could or should come along and stifle someone&#039;s creative spirit just for presenting an idea that from my perspective wasn&#039;t likely to fly, seems pretty shameful.  I am at peace with it today and trust by now I&#039;m forgiven, esp giving that I&#039;m coming to a wiki to own it, in writing no less.&lt;br /&gt;
&lt;br /&gt;
Luke-Jr, you are a hero.  You are a man with your hands touching and working on the beating heart of an upcoming major chapter in the history of the world and you are absolutely qualified to be doing that.  I owe you no less than my utmost respect and I only wish that I could claim anywhere near the same level of involvement and interaction with the core application as you have.  For me to have raised a stink about tonal bitcoin has said far more about me than it ever said about you.  I am sorry, and this apology is long overdue.&lt;br /&gt;
&lt;br /&gt;
As I write this, I think I now recall what got me thinking about you in the first place.  It was maybe a week ago I came across Electronic Frontier Foundation&#039;s [https://www.eff.org/deeplinks/2015/03/eff-files-second-round-comments-new-yorks-bitlicense-proposal blog post] describing their comments to New York DFS in regards to the BitLicense proposal.  I read just about all of it.&lt;br /&gt;
&lt;br /&gt;
I read Ms. Hofmann refer to those back-in-the-day religious comments you put into the block chain with your mining pool.  Those comments, which I of course saw in the block chain when you put them there, led me to roll my eyes in disdain at the time while conceding it was your right and privilege to put them there consistent with the established principles of how the block chain works.  I&#039;m inclined to be skeptical of religion myself.  As far as I know, for me to have harbored contempt about those comments is my private behavior I have never taken credit for that I can recall, I likewise lol toward myself as to how I could have been short-sighted about them.&lt;br /&gt;
&lt;br /&gt;
It was quite humbling for me to read those and point those out to NYDFS as prescient examples of protected expressions in the block chain.  I found her argument to be captivating.  I don&#039;t think I will go as far myself as to call your placement of them there any form of divine coincidence, but the look on my face as I write this, I think, says I don&#039;t think I&#039;d stop you or anyone else from doing so.&lt;br /&gt;
&lt;br /&gt;
At the time I was slamming tonal bitcoins to your face, I also offered to produce a tonal wall clock with my laser equipment.  While I&#039;m sure that looks a whole lot like being charitable with the right hand while throwing mud with the left, I think the driver behind that was my awareness that I was being a jerk (which offering to make a clock doesn&#039;t undo), and after some reflection I think I owe you a Casascius wall clock in the numbering system of your choice if you decide that to receive one is right for you.  Just let me know what I should keep in mind as I design it, which could reasonably take me some sort of while.&lt;br /&gt;
&lt;br /&gt;
I know this kind of personal correspondence, even as I make it open, probably doesn&#039;t really belong in the Bitcoin Wiki.  But, admins, I hope it will survive here long enough for Luke to see it, as well as anyone who might share it.  At the same time, I wouldn&#039;t be opposed to the past revision history of the spoof article being visible - I&#039;m owning it after all.  I will let Luke and others weigh in, and actually, beyond what I just said here, it probably shouldn&#039;t be my decision anyway.&lt;br /&gt;
&lt;br /&gt;
Luke, keep on keeping on.&lt;br /&gt;
&lt;br /&gt;
Mike Caldwell [[User:Casascius|Casascius]] ([[User talk:Casascius|talk]]) 15:14, 5 April 2015 (UTC)&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45145</id>
		<title>Auditable paper wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45145"/>
		<updated>2014-03-20T04:00:50Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &#039;&#039;&#039;auditable paper wallet&#039;&#039;&#039; is a paper wallet that includes an &#039;&#039;&#039;Audit Private Key&#039;&#039;&#039; for the purpose of guaranteeing to the user that the paper wallet includes sufficient entropy, in a manner that can be easily verified by the user.&lt;br /&gt;
&lt;br /&gt;
The purpose of the auditing is to alleviate the concern that a program, Live CD, or paper wallet printer appliance offered to help people produce safe paper wallets might contain a flawed or predictable random number generator that could result in theft.&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet provides a means for the user to introduce their own entropy through the keyboard, and then to confirm that the private keys on the paper wallets actually incorporate the user&#039;s entropy.&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet generator first asks the user to enter a long string of their choice, between 20 and 40 characters.  A suggested string is a simple mash of the keyboard, e.g. &amp;quot;as;dlfkjguwhaief;lkjsdvmnasdfkjh&amp;quot;.  The user should be reminded that the chosen string should be meant to be forgotten, should not be memorable, and the user should required to enter a string on the keyboard; no default or auto-generated string should ever be offered to the user.  Note that keyboard mashes typically have low entropy per character (i.e. they&#039;re more likely to favor home-row lowercase letters), so encouraging longer entry is better.&lt;br /&gt;
&lt;br /&gt;
Afterward, the paper wallet generator should guarantee that it generates private keys consisting solely of SHA256(USER_ENTROPY + PROGRAM_ENTROPY), where USER_ENTROPY is the string entered by the user, PROGRAM_ENTROPY is some sort of randomly generated string generated by the software, and + means concatenation.  The string USER_ENTROPY + PROGRAM_ENTROPY should be offered to the user as the &amp;quot;Audit Private Key&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The program should offer the ability to display the Audit Private Key, to copy it to the system clipboard, and to show a QR code on screen, but should discourage (while not necessarily prohibiting) the Audit Private Key from being printed on the paper wallet itself.  If the program offers the ability to print the Audit Private Key on the printed copy, it should be offered as a QR code, to enable the possibility of rapid auditing with a barcode scanner.&lt;br /&gt;
&lt;br /&gt;
==What is an audit==&lt;br /&gt;
An audit is simply the process of verifying that the hash of the Audit Private Key equals the private key on the paper wallet, and that the Bitcoin address corresponds to that private key.&lt;br /&gt;
&lt;br /&gt;
An audit allows the user to visually guarantee that the entropy he provided himself has been incorporated into the private key of the paper wallet.  The premise is that the maker of a Live CD or appliance that generates paper wallets cannot predict USER_ENTROPY, and so as long as the user is diligent in supplying an unpredictable string that has sufficient entropy, a successful audit guarantees the unpredictability of the private key.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
*User enters string: drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Program provides a random GUID: 1ee147fb-9416-4081-9dcb-60f5836d8822&lt;br /&gt;
*Audit Private Key: 1ee147fb-9416-4081-9dcb-60f5836d8822drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Bitcoin Private key (which is based on SHA256 of Audit Private Key): 5JpkQkz2Gg9NFSTVKLcBJdG8R2WdbB8hXFwPZ3G1Apbp29M1ap3&lt;br /&gt;
*Bitcoin address: 1FRDyKZkCUVPjTXQkNbPohgyWiAgEM5mDe&lt;br /&gt;
&lt;br /&gt;
==Caveats==&lt;br /&gt;
&lt;br /&gt;
Printing the Audit Private Key should be discouraged on paper wallets that are likely to be given to others who have no need to audit the paper wallet, particularly if the same USER_ENTROPY is used to batch-print multiple paper wallets.  The disclosure of USER_ENTROPY on one paper wallet could weaken the security of other paper wallets with identical USER_ENTROPY.&lt;br /&gt;
&lt;br /&gt;
Users who might print the Audit Private Key should be made fully aware that the Audit Private Key can be used to regenerate the Private Key and that its disclosure could result in the theft of funds.  Printing the Audit Private Key should be discouraged by default.&lt;br /&gt;
&lt;br /&gt;
Users should be made aware that steps undertaken to audit the paper wallet might result in the disclosure of the private key.  For example, if a user uses a website or a compromised computer to audit a paper wallet, the auditing process may result in the wallet being compromised and the funds stolen.  A good recommendation would be to only audit a random sample from a batch, and to not use the audited paper wallets for Bitcoin storage.&lt;br /&gt;
&lt;br /&gt;
An audit only protects a user against predictability.  It does not protect a user from disclosure risks, such as a Live CD or program that finds an internet connection and leaks key material, or one that can write to a file system or other storage to trigger a future leak if that storage later comes into contact with internet access.  It also does not protect a user from a compromised printer, or one that stores material from print jobs.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45144</id>
		<title>Auditable paper wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45144"/>
		<updated>2014-03-20T03:57:14Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &#039;&#039;&#039;auditable paper wallet&#039;&#039;&#039; is a paper wallet that includes an &#039;&#039;&#039;Audit Private Key&#039;&#039;&#039; for the purpose of guaranteeing to the user that the paper wallet includes sufficient entropy, in a manner that can be easily verified by the user.&lt;br /&gt;
&lt;br /&gt;
The purpose of the auditing is to alleviate the concern that a program, Live CD, or paper wallet printer appliance offered to help people produce safe paper wallets might contain a flawed or predictable random number generator that could result in theft.&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet provides a means for the user to introduce their own entropy through the keyboard, and then to confirm that the paper wallets actually include the user&#039;s entropy.&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet generator first asks the user to enter a long string of their choice, between 20 and 40 characters.  A suggested string is a simple mash of the keyboard, e.g. &amp;quot;as;dlfkjguwhaief;lkjsdvmnasdfkjh&amp;quot;.  The user should be reminded that the chosen string should be meant to be forgotten, should not be memorable, and the user should required to enter a string on the keyboard; no default or auto-generated string should ever be offered to the user.&lt;br /&gt;
&lt;br /&gt;
Afterward, the paper wallet generator should guarantee that it generates private keys consisting solely of SHA256(USER_ENTROPY + PROGRAM_ENTROPY), where USER_ENTROPY is the string entered by the user, PROGRAM_ENTROPY is some sort of randomly generated string generated by the software, and + means concatenation.  The string USER_ENTROPY + PROGRAM_ENTROPY should be offered to the user as the &amp;quot;Audit Private Key&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The program should offer the ability to display the Audit Private Key, to copy it to the system clipboard, and to show a QR code on screen, but should discourage (while not necessarily prohibiting) the Audit Private Key from being printed on the paper wallet itself.  If the program offers the ability to print the Audit Private Key on the printed copy, it should be offered as a QR code, to enable the possibility of rapid auditing with a barcode scanner.&lt;br /&gt;
&lt;br /&gt;
==What is an audit==&lt;br /&gt;
An audit is simply the process of verifying that the hash of the Audit Private Key equals the private key on the paper wallet, and that the Bitcoin address corresponds to that private key.&lt;br /&gt;
&lt;br /&gt;
An audit allows the user to visually guarantee that the entropy he provided himself has been incorporated into the private key of the paper wallet.  The premise is that the maker of a Live CD or appliance that generates paper wallets cannot predict USER_ENTROPY, and so as long as the user is diligent in supplying an unpredictable string that has sufficient entropy, a successful audit guarantees the unpredictability of the private key.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
*User enters string: drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Program provides a random GUID: 1ee147fb-9416-4081-9dcb-60f5836d8822&lt;br /&gt;
*Audit Private Key: 1ee147fb-9416-4081-9dcb-60f5836d8822drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Bitcoin Private key (which is based on SHA256 of Audit Private Key): 5JpkQkz2Gg9NFSTVKLcBJdG8R2WdbB8hXFwPZ3G1Apbp29M1ap3&lt;br /&gt;
*Bitcoin address: 1FRDyKZkCUVPjTXQkNbPohgyWiAgEM5mDe&lt;br /&gt;
&lt;br /&gt;
==Caveats==&lt;br /&gt;
&lt;br /&gt;
Printing the Audit Private Key should be discouraged on paper wallets that are likely to be given to others who have no need to audit the paper wallet, particularly if the same USER_ENTROPY is used to batch-print multiple paper wallets.  The disclosure of USER_ENTROPY on one paper wallet could weaken the security of other paper wallets with identical USER_ENTROPY.&lt;br /&gt;
&lt;br /&gt;
Users who might print the Audit Private Key should be made fully aware that the Audit Private Key can be used to regenerate the Private Key and that its disclosure could result in the theft of funds.  Printing the Audit Private Key should be discouraged by default.&lt;br /&gt;
&lt;br /&gt;
Users should be made aware that steps undertaken to audit the paper wallet might result in the disclosure of the private key.  For example, if a user uses a website or a compromised computer to audit a paper wallet, the auditing process may result in the wallet being compromised and the funds stolen.  A good recommendation would be to only audit a random sample from a batch, and to not use the audited paper wallets for Bitcoin storage.&lt;br /&gt;
&lt;br /&gt;
An audit only protects a user against predictability.  It does not protect a user from disclosure risks, such as a Live CD or program that finds an internet connection and leaks key material, or one that can write to a file system or other storage to trigger a future leak if that storage later comes into contact with internet access.  It also does not protect a user from a compromised printer, or one that stores material from print jobs.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45143</id>
		<title>Auditable paper wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45143"/>
		<updated>2014-03-20T03:56:36Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &#039;&#039;&#039;auditable paper wallet&#039;&#039;&#039; is a paper wallet that includes an &#039;&#039;&#039;Audit Private Key&#039;&#039;&#039; for the purpose of guaranteeing to the user that the paper wallet includes sufficient entropy, in a manner that can be easily verified by the user.&lt;br /&gt;
&lt;br /&gt;
The purpose of the auditing is to alleviate the concern that a program, Live CD, or paper wallet printer appliance offered to help people produce safe paper wallets might contain a flawed or predictable random number generator that could result in theft.&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet provides a means for the user to introduce their own entropy through the keyboard, and then to confirm that the paper wallets actually include the user&#039;s entropy.&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet generator first asks the user to enter a long string of their choice, between 20 and 40 characters.  A suggested string is a simple mash of the keyboard, e.g. &amp;quot;as;dlfkjguwhaief;lkjsdvmnasdfkjh&amp;quot;.  The user should be reminded that the chosen string should be meant to be forgotten, should not be memorable, and the user should required to enter a string on the keyboard; no default or auto-generated string should ever be offered to the user.&lt;br /&gt;
&lt;br /&gt;
Afterward, the paper wallet generator should guarantee that it generates private keys consisting solely of SHA256(USER_ENTROPY + PROGRAM_ENTROPY), where USER_ENTROPY is the string entered by the user, PROGRAM_ENTROPY is some sort of randomly generated string generated by the software, and + means concatenation.  The string USER_ENTROPY + PROGRAM_ENTROPY should be offered to the user as the &amp;quot;Audit Private Key&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The program should offer the ability to display the Audit Private Key, to copy it to the system clipboard, and to show a QR code on screen, but should discourage (while not necessarily prohibiting) the Audit Private Key from being printed on the paper wallet itself.  If the program offers the ability to print the Audit Private Key on the printed copy, it should be offered as a QR code, to enable the possibility of rapid auditing with a barcode scanner.&lt;br /&gt;
&lt;br /&gt;
==What is an audit==&lt;br /&gt;
An audit is simply the process of verifying that the hash of the Audit Private Key equals the private key on the paper wallet, and that the Bitcoin address corresponds to that private key.&lt;br /&gt;
&lt;br /&gt;
An audit allows the user to visually guarantee that the entropy he provided himself has been incorporated into the private key of the paper wallet.  The premise is that the maker of a Live CD or appliance that generates paper wallets cannot predict USER_ENTROPY, and so as long as the user is diligent in supplying an unpredictable string that has sufficient entropy, a successful audit guarantees the unpredictability of the private key.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
*User enters string: drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Program provides a random GUID: 1ee147fb-9416-4081-9dcb-60f5836d8822&lt;br /&gt;
*Audit private key: 1ee147fb-9416-4081-9dcb-60f5836d8822drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
*Private key (which is SHA256 of Audit private key): 5JpkQkz2Gg9NFSTVKLcBJdG8R2WdbB8hXFwPZ3G1Apbp29M1ap3&lt;br /&gt;
*Bitcoin address: 1FRDyKZkCUVPjTXQkNbPohgyWiAgEM5mDe&lt;br /&gt;
&lt;br /&gt;
==Caveats==&lt;br /&gt;
&lt;br /&gt;
Printing the Audit Private Key should be discouraged on paper wallets that are likely to be given to others who have no need to audit the paper wallet, particularly if the same USER_ENTROPY is used to batch-print multiple paper wallets.  The disclosure of USER_ENTROPY on one paper wallet could weaken the security of other paper wallets with identical USER_ENTROPY.&lt;br /&gt;
&lt;br /&gt;
Users who might print the Audit Private Key should be made fully aware that the Audit Private Key can be used to regenerate the Private Key and that its disclosure could result in the theft of funds.  Printing the Audit Private Key should be discouraged by default.&lt;br /&gt;
&lt;br /&gt;
Users should be made aware that steps undertaken to audit the paper wallet might result in the disclosure of the private key.  For example, if a user uses a website or a compromised computer to audit a paper wallet, the auditing process may result in the wallet being compromised and the funds stolen.  A good recommendation would be to only audit a random sample from a batch, and to not use the audited paper wallets for Bitcoin storage.&lt;br /&gt;
&lt;br /&gt;
An audit only protects a user against predictability.  It does not protect a user from disclosure risks, such as a Live CD or program that finds an internet connection and leaks key material, or one that can write to a file system or other storage to trigger a future leak if that storage later comes into contact with internet access.  It also does not protect a user from a compromised printer, or one that stores material from print jobs.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45142</id>
		<title>Auditable paper wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Auditable_paper_wallet&amp;diff=45142"/>
		<updated>2014-03-20T03:56:19Z</updated>

		<summary type="html">&lt;p&gt;Casascius: Created page with &amp;quot;An &amp;#039;&amp;#039;&amp;#039;auditable paper wallet&amp;#039;&amp;#039;&amp;#039; is a paper wallet that includes an &amp;#039;&amp;#039;&amp;#039;Audit Private Key&amp;#039;&amp;#039;&amp;#039; for the purpose of guaranteeing to the user that the paper wallet includes sufficien...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &#039;&#039;&#039;auditable paper wallet&#039;&#039;&#039; is a paper wallet that includes an &#039;&#039;&#039;Audit Private Key&#039;&#039;&#039; for the purpose of guaranteeing to the user that the paper wallet includes sufficient entropy, in a manner that can be easily verified by the user.&lt;br /&gt;
&lt;br /&gt;
The purpose of the auditing is to alleviate the concern that a program, Live CD, or paper wallet printer appliance offered to help people produce safe paper wallets might contain a flawed or predictable random number generator that could result in theft.&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet provides a means for the user to introduce their own entropy through the keyboard, and then to confirm that the paper wallets actually include the user&#039;s entropy.&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
An auditable paper wallet generator first asks the user to enter a long string of their choice, between 20 and 40 characters.  A suggested string is a simple mash of the keyboard, e.g. &amp;quot;as;dlfkjguwhaief;lkjsdvmnasdfkjh&amp;quot;.  The user should be reminded that the chosen string should be meant to be forgotten, should not be memorable, and the user should required to enter a string on the keyboard; no default or auto-generated string should ever be offered to the user.&lt;br /&gt;
&lt;br /&gt;
Afterward, the paper wallet generator should guarantee that it generates private keys consisting solely of SHA256(USER_ENTROPY + PROGRAM_ENTROPY), where USER_ENTROPY is the string entered by the user, PROGRAM_ENTROPY is some sort of randomly generated string generated by the software, and + means concatenation.  The string USER_ENTROPY + PROGRAM_ENTROPY should be offered to the user as the &amp;quot;Audit Private Key&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The program should offer the ability to display the Audit Private Key, to copy it to the system clipboard, and to show a QR code on screen, but should discourage (while not necessarily prohibiting) the Audit Private Key from being printed on the paper wallet itself.  If the program offers the ability to print the Audit Private Key on the printed copy, it should be offered as a QR code, to enable the possibility of rapid auditing with a barcode scanner.&lt;br /&gt;
&lt;br /&gt;
==What is an audit==&lt;br /&gt;
An audit is simply the process of verifying that the hash of the Audit Private Key equals the private key on the paper wallet, and that the Bitcoin address corresponds to that private key.&lt;br /&gt;
&lt;br /&gt;
An audit allows the user to visually guarantee that the entropy he provided himself has been incorporated into the private key of the paper wallet.  The premise is that the maker of a Live CD or appliance that generates paper wallets cannot predict USER_ENTROPY, and so as long as the user is diligent in supplying an unpredictable string that has sufficient entropy, a successful audit guarantees the unpredictability of the private key.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
User enters string: drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
Program provides a random GUID: 1ee147fb-9416-4081-9dcb-60f5836d8822&lt;br /&gt;
Audit private key: 1ee147fb-9416-4081-9dcb-60f5836d8822drgow3u4hgy984hreuahiouioehirfnadsfjsjkd&lt;br /&gt;
Private key (which is SHA256 of Audit private key): 5JpkQkz2Gg9NFSTVKLcBJdG8R2WdbB8hXFwPZ3G1Apbp29M1ap3&lt;br /&gt;
Bitcoin address: 1FRDyKZkCUVPjTXQkNbPohgyWiAgEM5mDe&lt;br /&gt;
&lt;br /&gt;
==Caveats==&lt;br /&gt;
&lt;br /&gt;
Printing the Audit Private Key should be discouraged on paper wallets that are likely to be given to others who have no need to audit the paper wallet, particularly if the same USER_ENTROPY is used to batch-print multiple paper wallets.  The disclosure of USER_ENTROPY on one paper wallet could weaken the security of other paper wallets with identical USER_ENTROPY.&lt;br /&gt;
&lt;br /&gt;
Users who might print the Audit Private Key should be made fully aware that the Audit Private Key can be used to regenerate the Private Key and that its disclosure could result in the theft of funds.  Printing the Audit Private Key should be discouraged by default.&lt;br /&gt;
&lt;br /&gt;
Users should be made aware that steps undertaken to audit the paper wallet might result in the disclosure of the private key.  For example, if a user uses a website or a compromised computer to audit a paper wallet, the auditing process may result in the wallet being compromised and the funds stolen.  A good recommendation would be to only audit a random sample from a batch, and to not use the audited paper wallets for Bitcoin storage.&lt;br /&gt;
&lt;br /&gt;
An audit only protects a user against predictability.  It does not protect a user from disclosure risks, such as a Live CD or program that finds an internet connection and leaks key material, or one that can write to a file system or other storage to trigger a future leak if that storage later comes into contact with internet access.  It also does not protect a user from a compromised printer, or one that stores material from print jobs.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=42144</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=42144"/>
		<updated>2013-11-02T18:15:02Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Confirmation code */ fix error/inconsistency with ref implementation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft (Some confusion applies: The announcements for this never made it to the list, so it hasn&#039;t had public discussion)&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and organizations wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pointb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pointbprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pointbx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pointbx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pointbprefix&#039;&#039; + &#039;&#039;pointbx1&#039;&#039; + &#039;&#039;pointbx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpointb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpointb&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, no lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: MOLON LABE&lt;br /&gt;
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX &lt;br /&gt;
*Encrypted key: 6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j&lt;br /&gt;
*Bitcoin address: 1Jscj8ALrYu2y9TD8NrpvDBugPedmbj4Yh&lt;br /&gt;
*Unencrypted private key (WIF): 5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8&lt;br /&gt;
*Unencrypted private key (hex): 44EA95AFBF138356A05EA32110DFD627232D0F2991AD221187BE356F19FA8190&lt;br /&gt;
*Confirmation code: cfrm38V8aXBn7JWA1ESmFMUn6erxeBGZGAxJPY4e36S9QWkzZKtaVqLNMgnifETYw7BPwWC9aPD&lt;br /&gt;
*Lot/Sequence: 263183/1&lt;br /&gt;
&lt;br /&gt;
Test 2: &lt;br /&gt;
*Passphrase (all letters are Greek - test UTF-8 compatibility with this): ΜΟΛΩΝ ΛΑΒΕ&lt;br /&gt;
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK &lt;br /&gt;
*Encrypted private key: 6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH&lt;br /&gt;
*Bitcoin address: 1Lurmih3KruL4xDB5FmHof38yawNtP9oGf&lt;br /&gt;
*Unencrypted private key (WIF): 5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D&lt;br /&gt;
*Unencrypted private key (hex): CA2759AA4ADB0F96C414F36ABEB8DB59342985BE9FA50FAAC228C8E7D90E3006&lt;br /&gt;
*Confirmation code: cfrm38V8G4qq2ywYEFfWLD5Cc6msj9UwsG2Mj4Z6QdGJAFQpdatZLavkgRd1i4iBMdRngDqDs51&lt;br /&gt;
*Lot/Sequence: 806938/1&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=41941</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=41941"/>
		<updated>2013-10-25T17:05:22Z</updated>

		<summary type="html">&lt;p&gt;Casascius: clarify numbering of BIP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BIP 38 was assigned to Mike Caldwell by Amir Taaki on November 22, 2012, consistent with the procedure described in [[BIP 0001]] as of the time the request was made.  There is possibly a lack of consensus as to whether this BIP number was properly assigned.  Because it has been implemented in multiple projects (including BitAddress.org, Bit2factor.org), concurrently assigning it to something else would have the effect of creating confusion as to what BIP 38 actually refers to.  A request to the Bitcoin-development mailing list to formally assign BIP 38 to this proposal was made by Mike Caldwell on August 17, 2013.  Discussion regarding this topic continues.&lt;br /&gt;
&lt;br /&gt;
(Mike Caldwell had previously filled this page with [https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;amp;oldid=36492 a BIP draft] which had not been proposed on the list or assigned a number and which doesn&#039;t appear to be moving forward.)&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:Casascius_silver_2013_curl.jpg&amp;diff=41116</id>
		<title>File:Casascius silver 2013 curl.jpg</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:Casascius_silver_2013_curl.jpg&amp;diff=41116"/>
		<updated>2013-09-19T03:17:00Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:Casascius_Aluminum_Coins_bag_500.jpg&amp;diff=38997</id>
		<title>File:Casascius Aluminum Coins bag 500.jpg</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:Casascius_Aluminum_Coins_bag_500.jpg&amp;diff=38997"/>
		<updated>2013-06-28T05:51:05Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:Casascius_Silver_2013_1BTC.jpg&amp;diff=38947</id>
		<title>File:Casascius Silver 2013 1BTC.jpg</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:Casascius_Silver_2013_1BTC.jpg&amp;diff=38947"/>
		<updated>2013-06-28T01:07:30Z</updated>

		<summary type="html">&lt;p&gt;Casascius: Casascius Silver 2013 1BTC Coin with Series 3 hologram&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Casascius Silver 2013 1BTC Coin with Series 3 hologram&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Paper_wallet&amp;diff=36580</id>
		<title>Paper wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Paper_wallet&amp;diff=36580"/>
		<updated>2013-04-02T04:24:08Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Producing safe paper wallets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;paper wallet&#039;&#039;&#039; is a way to store Bitcoins that involves printing the Bitcoin addresses and private keys directly on a piece of paper.  When done properly, paper wallets are one of the safest ways possible to store Bitcoins.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
A Bitcoin [[private key]] can be represented in several formats, but is typically a string of numbers and letters no more than about 51 characters in length.  This is easy to print on paper, and if kept secret, can securely hold an unlimited quantity of Bitcoins.&lt;br /&gt;
&lt;br /&gt;
==Producing safe paper wallets==&lt;br /&gt;
Several tools exist for producing paper wallets, including [[BitAddress.org]], [[vanitygen]], [[LinuxCoin]], and [[Bitcoin Address Utility]].  Paper wallets must be produced securely in order to be safe, because any leak of the private key constitutes the ability for an attacker to steal any present and future balance of the address.  Consider the following:&lt;br /&gt;
* Paper wallets should be produced on a computer not connected to the Internet.&lt;br /&gt;
* Be aware that malware often allows a remote third party to view your screen and see your keystrokes, and these can compromise the integrity of your paper wallet.  Also consider that antivirus software cannot completely rule out the possibility of malware.  However, using bootable CD&#039;s prevents the vast majority of malware from being able to run.  If you can generate a paper wallet with a bootable CD such as [[LinuxCoin]], the likelihood of malware being able to compromise your keys is very low.&lt;br /&gt;
* The private keys of paper wallets should never be saved to a computer hard drive.  You should also never scan your paper wallet into your computer or type the private keys or save them in e-mail, except at the moment you are redeeming the balance.&lt;br /&gt;
* A web-based paper wallet generator should be written so that all of the generation happens on your computer, not the web server.  After you load the paper wallet generating website in your web browser, you should disconnect from the internet, and observe that the paper wallet generator continues to function.  Afterward, you should close your browser before reconnecting to the internet.&lt;br /&gt;
* A paper wallet generator should use an appropriate source of random numbers (entropy).  This means that the generated addresses aren&#039;t predictable.  If the addresses come from a predictable or partially-predictable pattern, someone else who can predict the pattern addresses can steal the balance. Generally, this rules out any &amp;quot;web-based&amp;quot; generator unless you know the technical capabilities of the browser it&#039;s running in and audit the code.&lt;br /&gt;
&lt;br /&gt;
===Printer Security===&lt;br /&gt;
&lt;br /&gt;
Some printers will store the output using storage in which the data can be recovered from the printer&#039;s memory or from a hard drive (if the printer has one) and stores its print jobs there.  Most larger commercial printers have hard drives but whether or not documents are stored on them will vary based on manufacturer and model.&lt;br /&gt;
&lt;br /&gt;
==Redeeming Keys==&lt;br /&gt;
&lt;br /&gt;
There are various methods for copying the private key data from a paper wallet to other wallets.&lt;br /&gt;
bitcoind supports an &amp;quot;importprivkey&amp;quot; RPC method for this purpose.&lt;br /&gt;
Bitcoin-Qt&#039;s debug console can also be used in a similar way (see also [[how to import private keys v7+]]).&lt;br /&gt;
[[BlockChain.info]] and [[Armory]] can also import them directly into wallets.&lt;br /&gt;
[[MtGox|Mt. Gox]] provides the ability to Add Funds using a private key:&lt;br /&gt;
the exchange will then create a &amp;quot;sweep&amp;quot; transaction that spends any amount for that paper wallet address so that the amount is added to your account with them; it will also sweep to your account any bitcoins received to that address in the future as well.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Private key]]&lt;br /&gt;
&lt;br /&gt;
* [[Securing_your_wallet#Paper_Wallets]]&lt;br /&gt;
&lt;br /&gt;
* [[How to import private keys]]&lt;br /&gt;
&lt;br /&gt;
* [http://localbitcoins.blogspot.fi/2012/11/start-your-own-money-press.html Guide to paper wallets]&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
[[es:Monedero de papel]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=36492</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=36492"/>
		<updated>2013-03-30T03:46:16Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and organizations wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pointb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pointbprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pointbx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pointbx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pointbprefix&#039;&#039; + &#039;&#039;pointbx1&#039;&#039; + &#039;&#039;pointbx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpointb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpointb&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, no lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: MOLON LABE&lt;br /&gt;
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX &lt;br /&gt;
*Encrypted key: 6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j&lt;br /&gt;
*Bitcoin address: 1Jscj8ALrYu2y9TD8NrpvDBugPedmbj4Yh&lt;br /&gt;
*Unencrypted private key (WIF): 5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8&lt;br /&gt;
*Unencrypted private key (hex): 44EA95AFBF138356A05EA32110DFD627232D0F2991AD221187BE356F19FA8190&lt;br /&gt;
*Confirmation code: cfrm38V8aXBn7JWA1ESmFMUn6erxeBGZGAxJPY4e36S9QWkzZKtaVqLNMgnifETYw7BPwWC9aPD&lt;br /&gt;
*Lot/Sequence: 263183/1&lt;br /&gt;
&lt;br /&gt;
Test 2: &lt;br /&gt;
*Passphrase (all letters are Greek - test UTF-8 compatibility with this): ΜΟΛΩΝ ΛΑΒΕ&lt;br /&gt;
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK &lt;br /&gt;
*Encrypted private key: 6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH&lt;br /&gt;
*Bitcoin address: 1Lurmih3KruL4xDB5FmHof38yawNtP9oGf&lt;br /&gt;
*Unencrypted private key (WIF): 5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D&lt;br /&gt;
*Unencrypted private key (hex): CA2759AA4ADB0F96C414F36ABEB8DB59342985BE9FA50FAAC228C8E7D90E3006&lt;br /&gt;
*Confirmation code: cfrm38V8G4qq2ywYEFfWLD5Cc6msj9UwsG2Mj4Z6QdGJAFQpdatZLavkgRd1i4iBMdRngDqDs51&lt;br /&gt;
*Lot/Sequence: 806938/1&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=35335</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=35335"/>
		<updated>2013-01-20T05:17:45Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* EC multiply, no compression, lot/sequence numbers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pointb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pointbprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pointbx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pointbx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pointbprefix&#039;&#039; + &#039;&#039;pointbx1&#039;&#039; + &#039;&#039;pointbx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpointb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpointb&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, no lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: MOLON LABE&lt;br /&gt;
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX &lt;br /&gt;
*Encrypted key: 6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j&lt;br /&gt;
*Bitcoin address: 1Jscj8ALrYu2y9TD8NrpvDBugPedmbj4Yh&lt;br /&gt;
*Unencrypted private key (WIF): 5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8&lt;br /&gt;
*Unencrypted private key (hex): 44EA95AFBF138356A05EA32110DFD627232D0F2991AD221187BE356F19FA8190&lt;br /&gt;
*Confirmation code: cfrm38V8aXBn7JWA1ESmFMUn6erxeBGZGAxJPY4e36S9QWkzZKtaVqLNMgnifETYw7BPwWC9aPD&lt;br /&gt;
*Lot/Sequence: 263183/1&lt;br /&gt;
&lt;br /&gt;
Test 2: &lt;br /&gt;
*Passphrase (all letters are Greek - test UTF-8 compatibility with this): ΜΟΛΩΝ ΛΑΒΕ&lt;br /&gt;
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK &lt;br /&gt;
*Encrypted private key: 6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH&lt;br /&gt;
*Bitcoin address: 1Lurmih3KruL4xDB5FmHof38yawNtP9oGf&lt;br /&gt;
*Unencrypted private key (WIF): 5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D&lt;br /&gt;
*Unencrypted private key (hex): CA2759AA4ADB0F96C414F36ABEB8DB59342985BE9FA50FAAC228C8E7D90E3006&lt;br /&gt;
*Confirmation code: cfrm38V8G4qq2ywYEFfWLD5Cc6msj9UwsG2Mj4Z6QdGJAFQpdatZLavkgRd1i4iBMdRngDqDs51&lt;br /&gt;
*Lot/Sequence: 806938/1&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=35334</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=35334"/>
		<updated>2013-01-20T05:16:38Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* EC multiply, no compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pointb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pointbprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pointbx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pointbx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pointbprefix&#039;&#039; + &#039;&#039;pointbx1&#039;&#039; + &#039;&#039;pointbx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpointb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpointb&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, no lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression, lot/sequence numbers===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: MOLON LABE&lt;br /&gt;
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX &lt;br /&gt;
*Encrypted key: 6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j&lt;br /&gt;
*Bitcoin address: 1Jscj8ALrYu2y9TD8NrpvDBugPedmbj4Yh&lt;br /&gt;
*Unencrypted private key (WIF): 5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8&lt;br /&gt;
*Unencrypted private key (hex): 44EA95AFBF138356A05EA32110DFD627232D0F2991AD221187BE356F19FA8190&lt;br /&gt;
*Confirmation code: cfrm38V8aXBn7JWA1ESmFMUn6erxeBGZGAxJPY4e36S9QWkzZKtaVqLNMgnifETYw7BPwWC9aPD&lt;br /&gt;
&lt;br /&gt;
Test 2: &lt;br /&gt;
*Passphrase (all letters are Greek - test UTF-8 compatibility with this): ΜΟΛΩΝ ΛΑΒΕ&lt;br /&gt;
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK &lt;br /&gt;
*Encrypted private key: 6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH&lt;br /&gt;
*Bitcoin address: 1Lurmih3KruL4xDB5FmHof38yawNtP9oGf&lt;br /&gt;
*Unencrypted private key (WIF): 5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D&lt;br /&gt;
*Unencrypted private key (hex): CA2759AA4ADB0F96C414F36ABEB8DB59342985BE9FA50FAAC228C8E7D90E3006&lt;br /&gt;
*Confirmation code: cfrm38V8G4qq2ywYEFfWLD5Cc6msj9UwsG2Mj4Z6QdGJAFQpdatZLavkgRd1i4iBMdRngDqDs51&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_confirm.png&amp;diff=34806</id>
		<title>File:BIP38 iPhone screenshot confirm.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_confirm.png&amp;diff=34806"/>
		<updated>2013-01-08T06:27:23Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_codes.png&amp;diff=34805</id>
		<title>File:BIP38 iPhone screenshot codes.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_codes.png&amp;diff=34805"/>
		<updated>2013-01-08T06:15:07Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_ordering.png&amp;diff=34804</id>
		<title>File:BIP38 iPhone screenshot ordering.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_ordering.png&amp;diff=34804"/>
		<updated>2013-01-08T06:14:42Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_passphrase.png&amp;diff=34803</id>
		<title>File:BIP38 iPhone screenshot passphrase.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_passphrase.png&amp;diff=34803"/>
		<updated>2013-01-08T06:14:16Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_decrypted.png&amp;diff=34802</id>
		<title>File:BIP38 iPhone screenshot decrypted.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_decrypted.png&amp;diff=34802"/>
		<updated>2013-01-08T06:13:47Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_decryption.png&amp;diff=34801</id>
		<title>File:BIP38 iPhone screenshot decryption.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:BIP38_iPhone_screenshot_decryption.png&amp;diff=34801"/>
		<updated>2013-01-08T06:12:49Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34703</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34703"/>
		<updated>2013-01-05T19:33:53Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Confirmation code */ rename &amp;quot;pubfactor&amp;quot; to &amp;quot;pointb&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pointb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pointbprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pointbx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pointb[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pointbx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pointbprefix&#039;&#039; + &#039;&#039;pointbx1&#039;&#039; + &#039;&#039;pointbx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpointb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpointb&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34694</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34694"/>
		<updated>2013-01-05T18:26:36Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Encryption when EC multiply mode is used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;ownersalt&#039;&#039; + &#039;&#039;lotsequence&#039;&#039; and call this &#039;&#039;ownerentropy&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownerentropy&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4, and &#039;&#039;lotsequence&#039;&#039; is omitted.  &#039;&#039;ownerentropy&#039;&#039; becomes an alias for &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34606</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34606"/>
		<updated>2013-01-04T20:29:29Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Proposed specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 indicates whether a lot and sequence number are encoded into the first factor, and activates special behavior for including them in the decryption process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;lotsequence&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4.&lt;br /&gt;
* &#039;&#039;lotsequence&#039;&#039; is omitted.  The extra bytes in &#039;&#039;ownersalt&#039;&#039; take their place.&lt;br /&gt;
* All 8 bytes are provided as salt to the scrypt process.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
For the sake of simplicity, &#039;&#039;ownerentropy&#039;&#039; is used in future steps to refer to the 8 bytes produced by the owner (either 4 bytes &#039;&#039;ownersalt&#039;&#039; plus 4 bytes &#039;&#039;lotsequence&#039;&#039;, or 8 bytes &#039;&#039;ownersalt&#039;&#039;) where the distinction doesn&#039;t matter.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34605</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34605"/>
		<updated>2013-01-04T19:33:29Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Encryption when EC multiply mode is used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  A code known as an &#039;&#039;intermediate code&#039;&#039; conveys the information needed to generate such a key without knowledge of the passphrase.&lt;br /&gt;
&lt;br /&gt;
This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.  On the other hand, this serves a security benefit for someone possessing an address generated this way: if the address can be recreated by decrypting its private key with a passphrase, and it&#039;s a strong passphrase one can be certain only he knows himself, then he can safely conclude that nobody could know the private key to that address.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user.  The proposal forces these lot and sequence numbers to be included in any valid private keys generated from them.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each private key has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;lotsequence&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4.&lt;br /&gt;
* &#039;&#039;lotsequence&#039;&#039; is omitted.  The extra bytes in &#039;&#039;ownersalt&#039;&#039; take their place.&lt;br /&gt;
* All 8 bytes are provided as salt to the scrypt process.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
For the sake of simplicity, &#039;&#039;ownerentropy&#039;&#039; is used in future steps to refer to the 8 bytes produced by the owner (either 4 bytes &#039;&#039;ownersalt&#039;&#039; plus 4 bytes &#039;&#039;lotsequence&#039;&#039;, or 8 bytes &#039;&#039;ownersalt&#039;&#039;) where the distinction doesn&#039;t matter.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34600</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34600"/>
		<updated>2013-01-04T19:09:10Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Proposed specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
The person who knows the passphrase and who is the intended beneficiary of the private keys is called the &#039;&#039;owner&#039;&#039;.  He will generate one or more &amp;quot;intermediate codes&amp;quot;, which are the first factor of a two-factor redemption system, and will give them to someone else we&#039;ll call &#039;&#039;printer&#039;&#039;, who generates a key pair with an intermediate code can know the address and encrypted private key, but cannot decrypt the private key without the original passphrase.&lt;br /&gt;
&lt;br /&gt;
An intermediate code should, but is not required to, embed a printable &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number for the benefit of the user, which will be included in the encrypted private key strings.  An owner who has requested multiple private keys to be generated for him will be advised by applications to ensure that each one has a unique lot and sequence number consistent with the intermediate codes he generated.  These mainly help protect &#039;&#039;owner&#039;&#039; from potential mistakes and/or attacks that could be made by &#039;&#039;printer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;lot&amp;quot; and &amp;quot;sequence&amp;quot; number are combined into a single 32 bit number.  20 bits are used for the lot number and 12 bits are used for the sequence number, such that the lot number can be any decimal number between 0 and 1048575, and the sequence number can be any decimal number between 0 and 4095.  For programs that generate batches of intermediate codes for an &#039;&#039;owner&#039;&#039;, it is recommended that lot numbers be chosen at random within the range 100000-999999 and that sequence numbers are assigned starting with 1.&lt;br /&gt;
&lt;br /&gt;
Steps performed by &#039;&#039;owner&#039;&#039; to generate a single intermediate code, if lot and sequence numbers are being included:&lt;br /&gt;
# Generate 4 random bytes, call them &#039;&#039;ownersalt&#039;&#039;.&lt;br /&gt;
# Encode the lot and sequence numbers as a 4 byte quantity (big-endian): lotnumber * 4096 + sequencenumber.  Call these four bytes &#039;&#039;lotsequence&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersalt&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;lotsequence&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If lot and sequence numbers are not being included, then follow the same procedure with the following changes:&lt;br /&gt;
* &#039;&#039;ownersalt&#039;&#039; is 8 random bytes instead of 4.&lt;br /&gt;
* &#039;&#039;lotsequence&#039;&#039; is omitted.  The extra bytes in &#039;&#039;ownersalt&#039;&#039; take their place.&lt;br /&gt;
* All 8 bytes are provided as salt to the scrypt process.&lt;br /&gt;
* The SHA256 conversion of &#039;&#039;prefactor&#039;&#039; to &#039;&#039;passfactor&#039;&#039; is omitted.  Instead, the output of scrypt is used directly as &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
* The magic bytes are &amp;quot;2C E9 B3 E1 FF 39 E2 53&amp;quot; instead (the last byte is 0x53 instead of 0x51).&lt;br /&gt;
&lt;br /&gt;
For the sake of simplicity, &#039;&#039;ownerentropy&#039;&#039; is used in future steps to refer to the 8 bytes produced by the owner (either 4 bytes &#039;&#039;ownersalt&#039;&#039; plus 4 bytes &#039;&#039;lotsequence&#039;&#039;, or 8 bytes &#039;&#039;ownersalt&#039;&#039;) where the distinction doesn&#039;t matter.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if &#039;&#039;ownerentropy&#039;&#039; contains a value for &#039;&#039;lotsequence&#039;&#039;.  (While it has no effect on the keypair generation process, the decryption process needs this flag to know how to process &#039;&#039;ownerentropy&#039;&#039;)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039;, n=1024, r=1, p=1, length=64.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase, and to confirm the lot and sequence numbers (if applicable).  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownerentropy&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.  If applicable: &amp;quot;The lot number is &#039;&#039;lotnumber&#039;&#039; and the sequence number is &#039;&#039;sequencenumber&#039;&#039;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34598</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34598"/>
		<updated>2013-01-04T16:57:51Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Encryption when EC multiply mode is used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate 8 bytes of random numbers, call them &#039;&#039;ownerentropy&#039;&#039;.  Divide it into two halves, called &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: magic bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passfactor&#039;&#039; but without having to repeat the scrypt computation for each one.  Summary of the differences: the magic ended in 0x53 instead of 0x51; the entirety of &#039;&#039;ownerentropy&#039;&#039; was given to scrypt as salt rather than just the first four bytes, and the double SHA256 step was skipped (so &amp;quot;passfactor&amp;quot; was the output of scrypt).  Deprecation of the old methodology is recommended.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownerentropy&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039;.&lt;br /&gt;
#* Turn on bit 0x20 if the Bitcoin address will be formed by hashing the compressed public key (optional, saves space, but many Bitcoin implementations aren&#039;t compatible with it)&lt;br /&gt;
#* Turn on bit 0x04 if the magic ends in 0x51 instead of 0x53.  (The decryption process needs this in order to derive the first factor from the passphrase, but the process of creating new encrypted keypairs is the same regardless of the value of this bit)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownerentropy&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34542</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34542"/>
		<updated>2013-01-04T02:04:05Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Encryption when EC multiply mode is used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate 8 bytes of random numbers, call them &#039;&#039;ownerentropy&#039;&#039;.  Divide it into two halves, called &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passfactor&#039;&#039; but without having to repeat the scrypt computation for each one.  Summary of the differences: the magic ended in 0x53 instead of 0x51; the entirety of &#039;&#039;ownerentropy&#039;&#039; was given to scrypt as salt rather than just the first four bytes, and the double SHA256 step was skipped (so &amp;quot;passfactor&amp;quot; was the output of scrypt).  Deprecation of the old methodology is recommended.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039; to 0x04 (or 0x24 if generating Bitcoin address with compressed public key)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34541</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34541"/>
		<updated>2013-01-04T01:13:25Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Encryption when EC multiply mode is used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate 8 bytes of random numbers, call them &#039;&#039;ownerentropy&#039;&#039;.  Divide it into two halves, called &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passfactor&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passpoint&#039;&#039; but without having to repeat the scrypt computation for each one.  The magic bytes were different in the prior proposal, while still producing the &amp;quot;passphrase&amp;quot; prefix.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039; to 0x04 (or 0x24 if generating Bitcoin address with compressed public key)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34540</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34540"/>
		<updated>2013-01-04T01:12:43Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownerentropy&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate 8 bytes of random numbers, call them &#039;&#039;ownerentropy&#039;&#039;.  Divide it into two halves, called &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32.&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passpoint&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passpoint&#039;&#039; but without having to repeat the scrypt computation for each one.  The magic bytes were different in the prior proposal, while still producing the &amp;quot;passphrase&amp;quot; prefix.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039; to 0x04 (or 0x24 if generating Bitcoin address with compressed public key)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34535</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34535"/>
		<updated>2013-01-03T23:14:33Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Proposed specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownersalt&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.  Must be 0 for non-EC-multiplied keys.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate two 32-bit (4-byte) random numbers, call them &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32. (parameters n, r, p are provisional and subject to consensus-seeking)&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passpoint&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passpoint&#039;&#039; but without having to repeat the scrypt computation for each one.  The magic bytes were different in the prior proposal, while still producing the &amp;quot;passphrase&amp;quot; prefix.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039; to 0x04 (or 0x24 if generating Bitcoin address with compressed public key)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34533</id>
		<title>BIP 0038</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0038&amp;diff=34533"/>
		<updated>2013-01-03T23:13:52Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Proposed specification */ Modified the proposal to introduce a hashing step in the intermediate code generation process.  This helps allow bulk generation of intermediate codes with limited CPU, which in turn, improves security versus using 1 code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 38&lt;br /&gt;
  Title: Passphrase-protected private key&lt;br /&gt;
  Author: Mike Caldwell&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 20-11-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
A method is proposed for encrypting and encoding a passphrase-protected Bitcoin private key record in the form of a 58-character Base58Check-encoded printable string.  Encrypted private key records are intended for use on paper wallets and physical Bitcoins.  Each record string contains all the information needed to reconstitute the private key except for a passphrase, and the methodology uses salting and &#039;&#039;scrypt&#039;&#039; to resist brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
The method provides two encoding methodologies - one permitting any known private key to be encrypted with any passphrase, and another permitting a shared private key generation scheme where the party generating the final key string and its associated Bitcoin address (such as a physical bitcoin manufacturer) knows only a string derived from the original passphrase, and where the original passphrase is needed in order to actually redeem funds sent to the associated Bitcoin address.&lt;br /&gt;
&lt;br /&gt;
A 32-bit hash of the resulting Bitcoin address is encoded in plaintext within each encrypted key, so it can be correlated to a Bitcoin address with reasonable probability by someone not knowing the passphrase.  The complete Bitcoin address can be derived through successful decryption of the key record.&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The motivation to make this proposal stems from observations of the way physical bitcoins and paper wallets are used.&lt;br /&gt;
&lt;br /&gt;
An issuer of physical bitcoins must be trustworthy and trusted.  Even if trustworthy, users are rightful to be skeptical about a third party with theoretical access to take their funds.  A physical bitcoin that cannot be compromised by its issuer is always more intrinsically valuable than one that can.&lt;br /&gt;
&lt;br /&gt;
A two-factor physical bitcoin solution is highly useful to individuals and institutions wishing to securely own bitcoins without any risk of electronic theft and without the responsibility of climbing the technological learning curve necessary to produce such an environment themselves.  Two-factor physical bitcoins allow a secure storage solution to be put in a box and sold on the open market, greatly enlarging the number of people who are able to securely store bitcoins.&lt;br /&gt;
&lt;br /&gt;
Existing methodologies for creating two-factor physical bitcoins are limited and cumbersome.  At the time of this proposal, a user could create their own private key, submit the public key to the physical bitcoin issuer, and then receive a physical bitcoin that must be kept together with some sort of record of the user-generated private key, and finally, must be redeemed through a tool.  The fact that the physical bitcoin must be kept together with a user-produced private key negates much of the benefit of the physical bitcoin - the user may as well just print and maintain a private key.&lt;br /&gt;
&lt;br /&gt;
A standardized password-protected private key format makes acquiring and redeeming two-factor physical bitcoins simpler for the user.  Instead of maintaining a private key that cannot be memorized, the user may choose a passphrase of their choice.  The passphrase may be much shorter than the length of a typical private key, short enough that they could use a label or engraver to permanently commit their passphrase to their physical Bitcoin piece once they have received it.  By adopting a standard way to encrypt a private key, we maximize the possibility that they&#039;ll be able to redeem their funds in the venue of their choice, rather than relying on an executable redemption tool they may not wish to download.&lt;br /&gt;
&lt;br /&gt;
Password and passphrase-protected private keys enable new practical use cases for sending bitcoins from person to person.  Someone wanting to send bitcoins through postal mail could send a password-protected paper wallet and give the recipient the passphrase over the phone or e-mail, making the transfer safe from interception of either channel.  A user of paper wallets or Bitcoin banknote-style vouchers (&amp;quot;cash&amp;quot;) could carry funded encrypted private keys while leaving a copy at home as an element of protection against accidental loss or theft.  A user of paper wallets who leaves bitcoins in a bank vault or safety deposit box could keep the password at home or share it with trusted associates as protection against someone at the bank gaining access to the paper wallets and spending from them.  The foreseeable and unforeseeable use cases for password-protected private keys are numerous.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
This proposal is hereby placed in the public domain.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds.  I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key.  I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.&#039;&#039;&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;User story:&#039;&#039;&#039; (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
This proposal makes use of the following functions and definitions:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;AES256Encrypt, AES256Decrypt&#039;&#039;&#039;: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining.  Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.&lt;br /&gt;
*&#039;&#039;&#039;SHA256&#039;&#039;&#039;, a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.&lt;br /&gt;
*&#039;&#039;&#039;scrypt&#039;&#039;&#039;: A well-known key derivation algorithm.  It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.&lt;br /&gt;
*&#039;&#039;&#039;ECMultiply&#039;&#039;&#039;: Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.&lt;br /&gt;
*&#039;&#039;&#039;G, N&#039;&#039;&#039;: Constants defined as part of the [[secp256k1]] elliptic curve.  G is an elliptic curve point, and N is a large positive integer.&lt;br /&gt;
*&#039;&#039;&#039;[[Base58Check]]&#039;&#039;&#039;: a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.&lt;br /&gt;
&lt;br /&gt;
===Prefix===&lt;br /&gt;
It is proposed that the resulting Base58Check-encoded string start with a &#039;6&#039;.  The number &#039;6&#039; is intended to represent, from the perspective of the user, &amp;quot;a private key that needs something else to be usable&amp;quot; - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix &#039;5&#039; most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.&lt;br /&gt;
&lt;br /&gt;
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.&lt;br /&gt;
&lt;br /&gt;
To keep the size of the encrypted key down, no initialization vectors (IVs) are used in the AES encryption.  Rather, suitable values for IV-like use are derived using scrypt from the passphrase and from using a 32-bit hash of the resulting Bitcoin address as salt.&lt;br /&gt;
&lt;br /&gt;
===Proposed specification===&lt;br /&gt;
&lt;br /&gt;
* Object identifier prefix: 0x0142 (non-EC-multiplied) or 0x0143 (EC-multiplied).  These are constant bytes that appear at the beginning of the Base58Check-encoded record, and their presence causes the resulting string to have a predictable prefix.&lt;br /&gt;
* How the user sees it: 58 characters always starting with &#039;6P&#039;&lt;br /&gt;
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.&lt;br /&gt;
* Count of payload bytes (beyond prefix): 37&lt;br /&gt;
** 1 byte (&#039;&#039;flagbyte&#039;&#039;): &lt;br /&gt;
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the &amp;quot;6P&amp;quot; prefix intact.  For non-EC-multiplied keys, the bits are 11.  For EC-multiplied keys, the bits are 00.&lt;br /&gt;
*** the bit with value 0x20 when set indicates the key should be converted to a bitcoin address using the compressed public key format.&lt;br /&gt;
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors.  These bits must be 0 to comply with this version of the specification.&lt;br /&gt;
*** remaining bits are reserved for future use and must all be 0 to comply with this version of the specification.&lt;br /&gt;
*** the bit with value 0x04 selects one of two methods for introducing &#039;&#039;ownersalt&#039;&#039; into the key derivation process.  This applies to EC-multiplied keys only.&lt;br /&gt;
** 4 bytes: SHA256(SHA256(expected_bitcoin_address))[0...3], used both for typo checking and as salt&lt;br /&gt;
**16 bytes: Contents depend on whether EC multiplication is used.&lt;br /&gt;
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):&lt;br /&gt;
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):&lt;br /&gt;
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF&#039;s) &lt;br /&gt;
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):&lt;br /&gt;
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF&#039;s)&lt;br /&gt;
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6Pn):&lt;br /&gt;
** Minimum value: 6PnM2wz9LHo2BEAbvoGpGjMLGXCom35XwsDQnJ7rLiRjYvCxjpLenmoBsR (based on 01 43 20 plus thirty-six 00&#039;s)&lt;br /&gt;
** Maximum value: 6PnZki3vKspApf2zym6Anp2jd5hiZbuaZArPfa2ePcgVf196PLGrQNyVUh (based on 01 43 20 plus thirty-six FF&#039;s)&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply flag is not used====&lt;br /&gt;
Encrypting a private key without the EC multiplication offers the advantage that any known private key can be encrypted.  The party performing the encryption must know the passphrase.&lt;br /&gt;
&lt;br /&gt;
Encryption steps:&lt;br /&gt;
# Compute the Bitcoin address (ASCII), and take the first four bytes of SHA256(SHA256()) of it.  Let&#039;s call this &amp;quot;addresshash&amp;quot;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  &#039;&#039;addresshash&#039;&#039; came from the earlier step, n=16384, r=8, p=8, length=64 (n, r, p are provisional and subject to consensus)&lt;br /&gt;
#*Let&#039;s split the resulting 64 bytes in half, and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[0...15] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt(bitcoinprivkey[16...31] xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x42 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;salt&#039;&#039; + &#039;&#039;encryptedhalf1&#039;&#039; + &#039;&#039;encryptedhalf2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Decryption steps:&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; by passing the passphrase and &#039;&#039;addresshash&#039;&#039; into scrypt function.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedhalf1&#039;&#039; and &#039;&#039;encryptedhalf2&#039;&#039; using AES256Decrypt, merge them to form the encrypted private key.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in &#039;&#039;flagbyte&#039;&#039; of the encrypted key record.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
====Encryption when EC multiply mode is used====&lt;br /&gt;
Encrypting a private key with EC multiplication offers the ability for someone to generate encrypted keys knowing only an EC point derived from the original passphrase and some salt generated by the passphrase&#039;s owner, and without knowing the passphrase itself.  Only the person who knows the original passphrase can decrypt the private key.  This methodology does not offer the ability to encrypt a known private key - this means that the process of creating encrypted keys is also the process of generating new addresses.&lt;br /&gt;
&lt;br /&gt;
Using EC multiply also allows a passphrase to be protected once by very expensive scrypt parameters, and then the protected passphrase be used to trivially generate large numbers of Bitcoin keypairs protected with the same passphrase without a correspondingly-expensive per-keypair delay or resource cost.&lt;br /&gt;
&lt;br /&gt;
Steps performed by the person with the passphrase (call him the &#039;&#039;owner&#039;&#039;):&lt;br /&gt;
# Generate two 32-bit (4-byte) random numbers, call them &#039;&#039;ownersaltA&#039;&#039; and &#039;&#039;ownersaltB&#039;&#039;.&lt;br /&gt;
# Derive a key from the passphrase using scrypt&lt;br /&gt;
#* Parameters: &#039;&#039;passphrase&#039;&#039; is the passphrase itself encoded in UTF-8.  salt is &#039;&#039;ownersaltA&#039;&#039;. n=16384, r=8, p=8, length=32. (parameters n, r, p are provisional and subject to consensus-seeking)&lt;br /&gt;
#* Call the resulting 32 bytes &#039;&#039;prefactor&#039;&#039;.&lt;br /&gt;
#* Take SHA256(SHA256(&#039;&#039;prefactor&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;)) and call this &#039;&#039;passpoint&#039;&#039;.&lt;br /&gt;
# Compute the elliptic curve point G * &#039;&#039;passfactor&#039;&#039;, and convert the result to compressed notation (33 bytes).  Call this &#039;&#039;passpoint&#039;&#039;.  Compressed notation is used for this purpose regardless of whether the intent is to create Bitcoin addresses with or without compressed public keys.&lt;br /&gt;
# Convey &#039;&#039;ownersalt&#039;&#039; and &#039;&#039;passpoint&#039;&#039; to the party generating the keys, along with a checksum to ensure integrity.&lt;br /&gt;
#* The following Base58Check-encoded format is recommended for this purpose: bytes &amp;quot;2C E9 B3 E1 FF 39 E2 51&amp;quot; followed by &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and then &#039;&#039;passpoint&#039;&#039;.  The resulting string will start with the word &amp;quot;passphrase&amp;quot; due to the constant bytes, will be 72 characters in length, and encodes 49 bytes (8 bytes constant + 8 bytes &#039;&#039;ownersalt&#039;&#039; + 33 bytes &#039;&#039;passpoint&#039;&#039;).  The checksum is handled in the Base58Check encoding.  The resulting string is called &#039;&#039;intermediate_passphrase_string&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
NOTE: The methodology for creating an intermediate code was recently modified to introduce &#039;&#039;ownersaltB&#039;&#039;.  This permits rapid generation of batches of unique intermediate codes on mobile devices, allowing them to have a unique &#039;&#039;passpoint&#039;&#039; but without having to repeat the scrypt computation for each one.  The magic bytes were different in the prior proposal, while still producing the &amp;quot;passphrase&amp;quot; prefix.&lt;br /&gt;
&lt;br /&gt;
Steps to create new encrypted private keys given &#039;&#039;intermediate_passphrase_string&#039;&#039; from &#039;&#039;owner&#039;&#039; (so we have &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, and &#039;&#039;passpoint&#039;&#039;, but we do not have &#039;&#039;passfactor&#039;&#039; or the passphrase):&lt;br /&gt;
# Set &#039;&#039;flagbyte&#039;&#039; to 0x04 (or 0x24 if generating Bitcoin address with compressed public key)&lt;br /&gt;
# Generate 24 random bytes, call this &#039;&#039;seedb&#039;&#039;.  Take SHA256(SHA256(&#039;&#039;seedb&#039;&#039;)) to yield 32 bytes, call this &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# ECMultiply &#039;&#039;passpoint&#039;&#039; by &#039;&#039;factorb&#039;&#039;.  Use the resulting EC point as a public key and hash it into a Bitcoin address using either compressed or uncompressed public key methodology (specify which methodology is used inside &#039;&#039;flagbyte&#039;&#039;).  This is the generated Bitcoin address, call it &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Take the first four bytes of SHA256(SHA256(&#039;&#039;generatedaddress&#039;&#039;)) and call it &#039;&#039;addresshash&#039;&#039;.&lt;br /&gt;
# Now we will encrypt &#039;&#039;seedb&#039;&#039;.  Derive a second key from &#039;&#039;passpoint&#039;&#039; using scrypt&lt;br /&gt;
#*Parameters: &#039;&#039;passphrase&#039;&#039; is &#039;&#039;passpoint&#039;&#039; provided from the first party (expressed in binary as 33 bytes).  &#039;&#039;salt&#039;&#039; is &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039;, n=1024, r=1, p=1, length=64 (n, r, p are provisional and subject to consensus).  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
#*Split the result into two 16-byte halves and call them &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result &#039;&#039;encryptedpart1&#039;&#039;&lt;br /&gt;
# Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result &#039;&#039;encryptedseedb&#039;&#039;.  The &amp;quot;+&amp;quot; operator is concatenation.&lt;br /&gt;
&lt;br /&gt;
The encrypted private key is the Base58Check-encoded concatenation of the following, which totals 39 bytes without Base58 checksum:&lt;br /&gt;
* 0x01 0x43 + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;encryptedpart1&#039;&#039;[0...7] + &#039;&#039;encryptedpart2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Confirmation code=====&lt;br /&gt;
The party generating the Bitcoin address has the option to return a &#039;&#039;confirmation code&#039;&#039; back to &#039;&#039;owner&#039;&#039; which allows &#039;&#039;owner&#039;&#039; to independently verify that he has been given a Bitcoin address that actually depends on his passphrase.  This protects &#039;&#039;owner&#039;&#039; from being given a Bitcoin address by the second party that is unrelated to the key derivation and possibly spendable by the second party.  If a Bitcoin address given to &#039;&#039;owner&#039;&#039; can be successfully regenerated through the confirmation process, &#039;&#039;owner&#039;&#039; can be reasonably assured that any spending without the passphrase is infeasible.  This confirmation code is 75 characters starting with &amp;quot;cfrm38&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To generate it, we need &#039;&#039;flagbyte&#039;&#039;, &#039;&#039;ownersaltA&#039;&#039;, &#039;&#039;ownersaltB&#039;&#039;, &#039;&#039;factorb&#039;&#039;, &#039;&#039;derivedhalf1&#039;&#039; and &#039;&#039;derivedhalf2&#039;&#039; from the original encryption operation.&lt;br /&gt;
# ECMultiply &#039;&#039;factorb&#039;&#039; by G, call the result &#039;&#039;pubfactorb&#039;&#039;.  The result is 33 bytes.&lt;br /&gt;
# The first byte is 0x02 or 0x03.  XOR it by (derivedhalf2[31] &amp;amp; 0x01), call the resulting byte &#039;&#039;pubfactorprefix&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[1...16] xor derivedhalf1[0...15], derivedhalf2) and call the result &#039;&#039;pubfactorx1&#039;&#039;.&lt;br /&gt;
# Do AES256Encrypt(pubfactor[17...32] xor derivedhalf1[16...31], derivedhalf2) and call the result &#039;&#039;pubfactorx2&#039;&#039;.&lt;br /&gt;
# Concatenate &#039;&#039;pubfactorprefix&#039;&#039; + &#039;&#039;pubfactorx1&#039;&#039; + &#039;&#039;pubfactorx2&#039;&#039; (total 33 bytes) and call the result &#039;&#039;encryptedpubfactor&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The result is a Base58Check-encoded concatenation of the following:&lt;br /&gt;
* 0x64 0x3B 0xF6 0xA8 0x9A + &#039;&#039;flagbyte&#039;&#039; + &#039;&#039;ownersaltA&#039;&#039; + &#039;&#039;ownersaltB&#039;&#039; + &#039;&#039;addresshash&#039;&#039; + &#039;&#039;encryptedpubfactor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A confirmation tool, given a passphrase and a confirmation code, can recalculate the address, verify the address hash, and then assert the following: &amp;quot;It is confirmed that Bitcoin address &#039;&#039;address&#039;&#039; depends on this passphrase&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=====Decryption=====&lt;br /&gt;
# Collect encrypted private key and passphrase from user.&lt;br /&gt;
# Derive &#039;&#039;passfactor&#039;&#039; using scrypt with &#039;&#039;ownersalt&#039;&#039; and the user&#039;s passphrase and use it to recompute &#039;&#039;passpoint&#039;&#039;&lt;br /&gt;
# Derive decryption key for &#039;&#039;seedb&#039;&#039; using scrypt with &#039;&#039;passpoint&#039;&#039;, &#039;&#039;addresshash&#039;&#039;, and &#039;&#039;ownersalt&#039;&#039;&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart2&#039;&#039; using AES256Decrypt to yield the last 8 bytes of &#039;&#039;seedb&#039;&#039; and the last 8 bytes of &#039;&#039;encryptedpart1&#039;&#039;.&lt;br /&gt;
# Decrypt &#039;&#039;encryptedpart1&#039;&#039; to yield the remainder of &#039;&#039;seedb&#039;&#039;.&lt;br /&gt;
# Use &#039;&#039;seedb&#039;&#039; to compute &#039;&#039;factorb&#039;&#039;.&lt;br /&gt;
# Multiply &#039;&#039;passfactor&#039;&#039; by &#039;&#039;factorb&#039;&#039; mod N to yield the private key associated with &#039;&#039;generatedaddress&#039;&#039;.&lt;br /&gt;
# Convert that private key into a Bitcoin address, honoring the compression preference specified in the encrypted key.&lt;br /&gt;
# Hash the Bitcoin address, and verify that &#039;&#039;addresshash&#039;&#039; from the encrypted private key record matches the hash.  If not, report that the passphrase entry was incorrect.&lt;br /&gt;
&lt;br /&gt;
==Backwards compatibility==&lt;br /&gt;
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]].  It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.&lt;br /&gt;
&lt;br /&gt;
==Suggestions for implementers of proposal with alt-chains==&lt;br /&gt;
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.&lt;br /&gt;
&lt;br /&gt;
Alt-chain implementers should exploit the address hash for this purpose.  Since each operation in this proposal involves hashing a text representation of a coin address which (for Bitcoin) includes the leading &#039;1&#039;, an alt-chain can easily be denoted simply by using the alt-chain&#039;s preferred format for representing an address.  Alt-chain implementers may also change the prefix such that encrypted addresses do not start with &amp;quot;6P&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Discussion item: scrypt parameters==&lt;br /&gt;
This proposal leaves the scrypt parameters up in the air.  The following items are proposed for consideration:&lt;br /&gt;
&lt;br /&gt;
The main goal of scrypt is to reduce the feasibility of brute force attacks.  It must be assumed that an attacker will be able to use an efficient implementation of scrypt.  The parameters should force a highly efficient implementation of scrypt to wait a decent amount of time to slow attacks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, an unavoidably likely place where scrypt will be implemented is using slow interpreted languages such as javascript.  What might take milliseconds on an efficient scrypt implementation may take seconds in javascript.&lt;br /&gt;
&lt;br /&gt;
It is believed, however, that someone using a javascript implementation is probably dealing with codes by hand, one at a time, rather than generating or processing large batches of codes.  Thus, a wait time of several seconds is acceptable to a user.&lt;br /&gt;
&lt;br /&gt;
A private key redemption process that forces a server to consume several seconds of CPU time would discourage implementation by the server owner, because they would be opening up a denial of service avenue by inviting users to make numerous attempts to invoke the redemption process.  However, it&#039;s also feasible for the server owner to implement his redemption process in such a way that the decryption is done by the user&#039;s browser, offloading the task from his own server (and providing another reason why the chosen scrypt parameters should be tolerant of javascript-based decryptors).&lt;br /&gt;
&lt;br /&gt;
The preliminary values of 16384, 8, and 8 are hoped to offer the following properties:&lt;br /&gt;
* Encryption/decryption in javascript requiring several seconds per operation&lt;br /&gt;
* Use of the parallelization parameter provides a modest opportunity for speedups in environments where concurrent threading is available - such environments would be selected for processes that must handle bulk quantities of encryption/decryption operations.  Estimated time for an operation is in the tens or hundreds of milliseconds.&lt;br /&gt;
&lt;br /&gt;
==Reference implementation==&lt;br /&gt;
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:&lt;br /&gt;
&lt;br /&gt;
* via https: https://casascius.com/btcaddress-alpha.zip&lt;br /&gt;
* at github: https://github.com/casascius/Bitcoin-Address-Utility&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Tools&amp;quot; then &amp;quot;PPEC Keygen&amp;quot; (provisional name)&lt;br /&gt;
&lt;br /&gt;
==Test vectors==&lt;br /&gt;
&lt;br /&gt;
===No compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg&lt;br /&gt;
*Unencrypted (WIF): 5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PRNFFkZc2NZ6dJqFfhRoFNMR9Lnyj7dYGrzdgXXVMXcxoKTePPX1dWByq&lt;br /&gt;
*Unencrypted (WIF): 5HtasZ6ofTHP6HCwTqTkLDuLQisYPah7aUnSKfC7h4hMUVw2gi5&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===Compression, no EC multiply===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Encrypted: 6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo&lt;br /&gt;
*Unencrypted (WIF): L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP&lt;br /&gt;
*Unencrypted (hex): CBF4B9F70470856BB4F40F80B87EDB90865997FFEE6DF315AB166D713AF433A5&lt;br /&gt;
&lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Encrypted: 6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7&lt;br /&gt;
*Unencrypted (WIF): KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7&lt;br /&gt;
*Unencrypted (hex): 09C2686880095B1A4C249EE3AC4EEA8A014F11E6F986D0B5025AC1F39AFBD9AE&lt;br /&gt;
&lt;br /&gt;
===EC multiply, no compression===&lt;br /&gt;
&lt;br /&gt;
Test 1:&lt;br /&gt;
*Passphrase: TestingOneTwoThree&lt;br /&gt;
*Passphrase code: passphrasepxFy57B9v8HtUsszJYKReoNDV6VHjUSGt8EVJmux9n1J3Ltf1gRxyDGXqnf9qm&lt;br /&gt;
*Encrypted key: 6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX&lt;br /&gt;
*Bitcoin address: 1PE6TQi6HTVNz5DLwB1LcpMBALubfuN2z2&lt;br /&gt;
*Unencrypted private key (WIF): 5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2&lt;br /&gt;
*Unencrypted private key (hex): A43A940577F4E97F5C4D39EB14FF083A98187C64EA7C99EF7CE460833959A519&lt;br /&gt;
 &lt;br /&gt;
Test 2:&lt;br /&gt;
*Passphrase: Satoshi&lt;br /&gt;
*Passphrase code: passphraseoRDGAXTWzbp72eVbtUDdn1rwpgPUGjNZEc6CGBo8i5EC1FPW8wcnLdq4ThKzAS&lt;br /&gt;
*Encrypted key: 6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd&lt;br /&gt;
*Bitcoin address: 1CqzrtZC6mXSAhoxtFwVjz8LtwLJjDYU3V&lt;br /&gt;
*Unencrypted private key (WIF): 5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH&lt;br /&gt;
*Unencrypted private key (hex): C2C8036DF268F498099350718C4A3EF3984D2BE84618C2650F5171DCC5EB660A&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[List of address prefixes]]&lt;br /&gt;
&lt;br /&gt;
[[Category: BIP]]&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=File:Dense_Minikey_sample.png&amp;diff=33829</id>
		<title>File:Dense Minikey sample.png</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=File:Dense_Minikey_sample.png&amp;diff=33829"/>
		<updated>2012-12-16T18:07:57Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Contract_sample_language/Selling_precious_metals_for_Bitcoin&amp;diff=33805</id>
		<title>Contract sample language/Selling precious metals for Bitcoin</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Contract_sample_language/Selling_precious_metals_for_Bitcoin&amp;diff=33805"/>
		<updated>2012-12-15T18:30:12Z</updated>

		<summary type="html">&lt;p&gt;Casascius: Created page with &amp;quot;===Date===  The offer should be dated, since PGP signing doesn&amp;#039;t establish the date.   December 14, 2012.  ===Offer for a fixed amount=== An offer for a fixed amount is simple...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Date===&lt;br /&gt;
&lt;br /&gt;
The offer should be dated, since PGP signing doesn&#039;t establish the date.&lt;br /&gt;
&lt;br /&gt;
 December 14, 2012.&lt;br /&gt;
&lt;br /&gt;
===Offer for a fixed amount===&lt;br /&gt;
An offer for a fixed amount is simple to understand and doesn&#039;t require the buyer to worry about volatility.&lt;br /&gt;
&lt;br /&gt;
 I, &#039;&#039;&#039;insert name here&#039;&#039;&#039;, hereby offer to sell ten (10) one-ounce Austrian Philharmonic gold coins as described below,&lt;br /&gt;
 for 132 Bitcoins each per coin, which includes fully insured Registered Mail shipping to any US address.&lt;br /&gt;
 The coins can be bought in increments of a single coin - in other words, you do not have to buy all ten.&lt;br /&gt;
&lt;br /&gt;
===Offer for an amount relative to MtGox===&lt;br /&gt;
&lt;br /&gt;
 I, &#039;&#039;&#039;insert name here&#039;&#039;&#039;, hereby offer to sell ten (10) one-ounce Austrian Philharmonic gold coins as described below,&lt;br /&gt;
 for the Bitcoin equivalent of $1770 per coin, which includes fully insured Registered Mail shipping to any US address.&lt;br /&gt;
 The coins can be bought in increments of a single coin - in other words, you do not have to buy all ten.&lt;br /&gt;
&lt;br /&gt;
Any or all of the following conditions can be made part of the offer.  It will make the offer harder to accept, but also lessens the possibility of an opportunistic offer based on an unexpected surprise from MtGox.&lt;br /&gt;
&lt;br /&gt;
 The following restrictions apply to this offer.  If an attempt to accept this offer is made while invalid for a reason&lt;br /&gt;
 listed here, I reserve the right to elect to either issue a refund or complete the transaction regardless, without&lt;br /&gt;
 prejudice to my right to refuse to do so under the same conditions in the future.&lt;br /&gt;
 * This offer is only valid during periods of low volatility, defined as follows: the 24-hour MtGox high is less than&lt;br /&gt;
    105% of the 24-hour MtGox low.  &lt;br /&gt;
 * This offer is only valid so long as the MtGox data feed for the last 24 hours is available and believed to be&lt;br /&gt;
    substantially accurate.&lt;br /&gt;
 * This offer is only valid so long as the USD/BTC exchange rate is at least $13.50.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Describe what&#039;s for sale===&lt;br /&gt;
&lt;br /&gt;
 The 1 ounce Austrian Philharmonic gold coins for sale are brand new in an unopened mint tube of 10.&lt;br /&gt;
 If a single buyer purchases all ten coins, they will be shipped in the original unopened mint tube. &lt;br /&gt;
 More about the coin: http://www.monex.com/prods/gold_vienna.html&lt;br /&gt;
 I certify that these coins were acquired through a reputable precious metals dealer.&lt;br /&gt;
&lt;br /&gt;
===Describe how to accept the offer===&lt;br /&gt;
If requesting bitcoins to be sent directly to you:&lt;br /&gt;
 The Bitcoin address for this transaction is: &#039;&#039;&#039;insert bitcoin address here&#039;&#039;&#039;&lt;br /&gt;
 See activity: http://blockchain.info/address/&#039;&#039;&#039;insert bitcoin address here&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If this is an address under the control of an escrow agent:&lt;br /&gt;
 This Bitcoin address is under the combined control of me and an escrow agent as described below.&lt;br /&gt;
 A PGP-signed message from the escrow agent follows my message.&lt;br /&gt;
&lt;br /&gt;
For a fixed price offer:&lt;br /&gt;
 As long as this address has fewer than 1320 Bitcoins sent to it, my offer is valid and unclaimed.&lt;br /&gt;
&lt;br /&gt;
If not for a fixed price:&lt;br /&gt;
 I anticipate that if this offer is accepted, that the above Bitcoin address will have had at least 1200 bitcoins&lt;br /&gt;
 sent to it.&lt;br /&gt;
&lt;br /&gt;
 To accept this offer, send bitcoins in an even multiple of 132 bitcoins, but first:&lt;br /&gt;
&lt;br /&gt;
===Add a cancellation clause if necessary===&lt;br /&gt;
It is totally reasonable to be willing to cancel your unaccepted offer when necessary.  One way to cancel your offer is just to send enough of your own bitcoins to the address, essentially satisfying it yourself.  But if you can&#039;t do that:&lt;br /&gt;
&lt;br /&gt;
 I reserve the right to cancel this offer so long as it has not been accepted.  I will signal that I have&lt;br /&gt;
 cancelled my offer by sending 0.01 BTC from address XXXXXXX to the above address.  Any payment&lt;br /&gt;
 received after cancellation will be refunded.&lt;br /&gt;
&lt;br /&gt;
===Add instructions===&lt;br /&gt;
 1. Please check the address to ensure that the offer has not already been claimed in its entirety. &lt;br /&gt;
 2. You must be able to prove you are the owner of the Bitcoin address(es) that sent the payment.&lt;br /&gt;
 Either you need to be able to sign messages with it, or move an arbitrary number of coins sent to it&lt;br /&gt;
 upon request.&lt;br /&gt;
 3. You must be able to accept Registered Mail at an address in the US.&lt;br /&gt;
 4. The first person(s) who pay the above address (as determined by the BlockChain.info first-seen &lt;br /&gt;
 timestamp) are the person(s) to whom I am selling.  If I receive payments to purchase in excess of the ten&lt;br /&gt;
 offered coins, I reserve the right to either refund the excess payments, or to sell further coins at the same&lt;br /&gt;
 price, at my option.  The ten coins will be allocated in the order the payments for them arrive.&lt;br /&gt;
 5. This offer is for gold coins at a fixed price.  Any payment that is not a multiple of 132 BTC in a single transaction&lt;br /&gt;
 will not be deemed an acceptance of this offer.&lt;br /&gt;
 6. This offer unconditionally expires at 18:00 UTC on December 16, 2012 to the extent it is not accepted&lt;br /&gt;
 before then.&lt;br /&gt;
 -----BEGIN PGP SIGNATURE-----&lt;br /&gt;
 Version: XXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 &lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;br /&gt;
 -----END PGP SIGNATURE-----&lt;br /&gt;
&lt;br /&gt;
===Helpful info===&lt;br /&gt;
Stay safe!&lt;br /&gt;
Always verify the PGP signature of any signed offer asking you to send bitcoins.&lt;br /&gt;
Making a copy of the signed offer is a good idea too.&lt;br /&gt;
My PGP key is available from my bitcoin-otc profile.&lt;br /&gt;
http://bitcoin-otc.com/viewratingdetail.php?nick=casascius&amp;amp;sign=ANY&amp;amp;type=RECV&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33738</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33738"/>
		<updated>2012-12-14T04:27:45Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0a12ca9c6&lt;br /&gt;
** Constant for part b: 0x140bebc16ae0563b&lt;br /&gt;
* 1 byte: reserved, set this to 0 and reject an invitation that has something other than 0 here&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcba900182f plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 1 byte: reserved, must be 0&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if payment invitation was created by someone who knows the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 11 bytes: set to all 0&#039;s&lt;br /&gt;
&lt;br /&gt;
Payment confirmation generated by payee contains Gz and is 106 Base58 characters starting with &amp;quot;cfrmp&amp;quot;.  Its purpose is to prove the association of the generated Bitcoin address to the escrow agent, if needed, without giving away z, which would grant the ability to redeem funds.&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x12f4eff38f7d74f9 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 33 bytes: Gz&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if address confirmation was created by someone who knows the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 11 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33734</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33734"/>
		<updated>2012-12-14T00:09:27Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0a12ca9c6&lt;br /&gt;
** Constant for part b: 0x140bebc16ae0563b&lt;br /&gt;
* 1 byte: reserved, set this to 0 and reject an invitation that has something other than 0 here&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcba900182f plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if payment invitation was created by someone who knows the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33733</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33733"/>
		<updated>2012-12-13T23:47:26Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 1 byte: reserved, set this to 0 and reject an invitation that has something other than 0 here&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if payment invitation was created by someone who knows the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33732</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33732"/>
		<updated>2012-12-13T23:46:56Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 1 byte: reserved, set this to 0&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if payment invitation was created by someone who knows the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33731</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33731"/>
		<updated>2012-12-13T23:40:21Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: bitflags&lt;br /&gt;
** Bit with value 0x02: 0 if payment invitation was created with the &amp;quot;einva&amp;quot; invitation code, 1 if invitation was created with the &amp;quot;einvb&amp;quot; invitation code (assuming an app allows it)&lt;br /&gt;
** Bit with value 0x01: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
** all other bits: reserved and must be 0&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33728</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33728"/>
		<updated>2012-12-13T23:37:26Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as five or six characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33727</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33727"/>
		<updated>2012-12-13T23:35:18Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Base58 codes (draft) for 3-party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as four or five characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 8 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 8 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet, other values reserved for altcoins)&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 12 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33726</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33726"/>
		<updated>2012-12-13T23:28:47Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Base58 codes (draft) for 3-party scheme==&lt;br /&gt;
&lt;br /&gt;
An escrow invitation starts out with two random 256 bit numbers, x and y.  One party receiving the invitation will get Gx and y, the other gets Gy and x, they should both be able to calculate Gxy.  The identifier for the proposal is the hash of Gxy (compressed notation).&lt;br /&gt;
&lt;br /&gt;
We will use 31 bits of the proposal (four most significant bytes &amp;amp; 0x7fffffff) as the identifier.  This allows for the prefixes einva, einvb, einvc, as well as four or five characters following the prefixes to be the same for matching invitations.  This number will be referred to as &#039;&#039;identifier31&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Escrow invitation from escrow agent is 106 Base58 characters starting with &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot;.  It consists of the following bytes:&lt;br /&gt;
* 16 bytes: Int64 sum of a constant plus &#039;&#039;identifier31&#039;&#039;.  The constant depends on whether this is to create part a or b.  Using this value results in the &amp;quot;einva&amp;quot; or &amp;quot;einvb&amp;quot; prefix as well as several more identical characters when a set is matched.  In this case, &amp;quot;plus&amp;quot; refers to addition.&lt;br /&gt;
** Constant for part a: 0x140bebc0f619ffdd&lt;br /&gt;
** Constant for part b: 0x140bebc1bfcdac52&lt;br /&gt;
* 32 bytes: x or y (invitation part a gets x, invitation part b gets y)&lt;br /&gt;
* 33 bytes: Gx or Gy (invitation part a gets Gy, invitation part b gets Gx)&lt;br /&gt;
&lt;br /&gt;
Payment invitation generated by payee contains an additional 256-bit number z, and is 106 Base58 characters starting with &amp;quot;einvp&amp;quot; as follows:&lt;br /&gt;
* 16 bytes: Int64 sum of 0x140bebcbfded6e45 plus &#039;&#039;identifier31&#039;&#039; from the accepted escrow proposal&lt;br /&gt;
* 32 bytes: z&lt;br /&gt;
* 1 byte: 0 if bitcoin address to be paid will use an uncompressed public key, 1 if it will use a compressed public key.&lt;br /&gt;
* 1 byte: 0 to represent the type of coin (0=bitcoin, 111=testnet)&lt;br /&gt;
* 20 bytes: hash160 of expected bitcoin address&lt;br /&gt;
* 11 bytes: set to all 0&#039;s&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33495</id>
		<title>List of address prefixes</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33495"/>
		<updated>2012-12-10T00:24:47Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Blockchain-based currencies use addresses, which are a [[Base58Check encoding]] of some hash, typically that of a public key. The encoding includes a version byte, which affects the first character in the address. The following is a list of some prefixes which are in use.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Initial byte(s)&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Use&lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|Bitcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;12CPLrAUPvhVwjZqBgww3sLdEg4Z888R1j&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|3&lt;br /&gt;
|Bitcoin script hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|Litecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;LhK2kQwiaAvhjWY799cZvMyYwnQAcxkarr&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|Namecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;NATX6zEUNfxfvgVwz8qVnnw3hLhhYXhgQn&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|Fairbrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;fF6o8LeDAfswEpMbCW8BqaqmzMWS7TGgew&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|97&lt;br /&gt;
|g&lt;br /&gt;
|GeistGeld pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;gQ8YScyiMUTart6kUJpzhjPzAKfiYAwooc&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|i0coin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;jWmCr5cKeQjV4iyfUyipfLGwVML8MvXhF2&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|Bitcoin testnet pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;mkJ7Bf5chdfw61d1m7gnDVAQV3EQQAb8iz&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|Solidcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;sXNaMoYBocjcQJRLK53dkaQ5mWuKfvHB9f&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|127&lt;br /&gt;
|t&lt;br /&gt;
|Tenebrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;tUK2EQTMF6cN6vuNEfJtVf1BMqarvEZJBL&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|5&lt;br /&gt;
|Uncompressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;5Htn3FzuH3b1X5VF2zLTsAQzBcyzkZNJsa2egXN8ZFJTCqQm3Rq&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|K or L&lt;br /&gt;
|Compressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|138&lt;br /&gt;
|x&lt;br /&gt;
|ixcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;xoKDFH4uWpyzxUcCC5jCLFujRKayv3HHcV&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|196&lt;br /&gt;
|2&lt;br /&gt;
|Testnet script hash&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|9&lt;br /&gt;
|Uncompressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;91eWjgRmucdtYHpMdsHbn9h8UU8hdoMNSKj8p3QAj6VTLyBnjj6&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|c&lt;br /&gt;
|Compressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;cNJFgo1driFnPcBdBX8BrJrpxchBWXwXCvNH5SoSkdcF6JXXwHMm&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|0x142, 0x143&lt;br /&gt;
|6P&lt;br /&gt;
|Encrypted private key ([[BIP 0038|BIP 38]])&lt;br /&gt;
|&amp;lt;tt&amp;gt; 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg &amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following table shows the leading symbol(s) and address length(s) for 160 bit hashes for each of the possible decimal version values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Decimal version&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Address length&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|up to 34&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Q-Z, a-k, m-o&lt;br /&gt;
|33&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|o-z, 2&lt;br /&gt;
|33 or 34&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|2&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|2 or 3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|5-6&lt;br /&gt;
|3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|3 or 4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|4 or 5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|10-11&lt;br /&gt;
|5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|12&lt;br /&gt;
|5 or 6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|14&lt;br /&gt;
|6 or 7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|15-16&lt;br /&gt;
|7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|7 or 8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|18&lt;br /&gt;
|8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|19&lt;br /&gt;
|8 or 9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|20-21&lt;br /&gt;
|9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|22&lt;br /&gt;
|9 or A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|23&lt;br /&gt;
|A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|24&lt;br /&gt;
|A or B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|25-26&lt;br /&gt;
|B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|27&lt;br /&gt;
|B or C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|28&lt;br /&gt;
|C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|29&lt;br /&gt;
|C or D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|30-31&lt;br /&gt;
|D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|32&lt;br /&gt;
|D or E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|33&lt;br /&gt;
|E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|34&lt;br /&gt;
|E or F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|35-36&lt;br /&gt;
|F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|37&lt;br /&gt;
|F or G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|G or H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|40-41&lt;br /&gt;
|H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|42&lt;br /&gt;
|H or J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|43&lt;br /&gt;
|J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|44&lt;br /&gt;
|J or K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|45-46&lt;br /&gt;
|K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|47&lt;br /&gt;
|K or L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|49&lt;br /&gt;
|L or M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|50-51&lt;br /&gt;
|M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|53&lt;br /&gt;
|N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|54&lt;br /&gt;
|N or P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|55-56&lt;br /&gt;
|P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|57&lt;br /&gt;
|P or Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|58&lt;br /&gt;
|Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|59&lt;br /&gt;
|Q or R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|60-61&lt;br /&gt;
|R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|62&lt;br /&gt;
|R or S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|63&lt;br /&gt;
|S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|64&lt;br /&gt;
|S or T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|65-66&lt;br /&gt;
|T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|67&lt;br /&gt;
|T or U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|68&lt;br /&gt;
|U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|69&lt;br /&gt;
|U or V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|70-71&lt;br /&gt;
|V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|72&lt;br /&gt;
|V or W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|73&lt;br /&gt;
|W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|74&lt;br /&gt;
|W or X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|75-76&lt;br /&gt;
|X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|77&lt;br /&gt;
|X or Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|78&lt;br /&gt;
|Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|79&lt;br /&gt;
|Y or Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|80-81&lt;br /&gt;
|Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|82&lt;br /&gt;
|Z or a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|83&lt;br /&gt;
|a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|84&lt;br /&gt;
|a or b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|85&lt;br /&gt;
|b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|86&lt;br /&gt;
|b or c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|87-88&lt;br /&gt;
|c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|89&lt;br /&gt;
|c or d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|90&lt;br /&gt;
|d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|91&lt;br /&gt;
|d or e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|92-93&lt;br /&gt;
|e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|94&lt;br /&gt;
|e or f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|96&lt;br /&gt;
|f or g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|97-98&lt;br /&gt;
|g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|99&lt;br /&gt;
|g or h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|100&lt;br /&gt;
|h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|101&lt;br /&gt;
|h or i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|102-103&lt;br /&gt;
|i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|104&lt;br /&gt;
|i or j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|106&lt;br /&gt;
|j or k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|107-108&lt;br /&gt;
|k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|109&lt;br /&gt;
|k or m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|110&lt;br /&gt;
|m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|112-113&lt;br /&gt;
|n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|114&lt;br /&gt;
|n or o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|115&lt;br /&gt;
|o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|116&lt;br /&gt;
|o or p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|117-118&lt;br /&gt;
|p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|119&lt;br /&gt;
|p or q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|120&lt;br /&gt;
|q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|121&lt;br /&gt;
|q or r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|122-123&lt;br /&gt;
|r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|124&lt;br /&gt;
|r or s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|126&lt;br /&gt;
|s or t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|127-128&lt;br /&gt;
|t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|129&lt;br /&gt;
|t or u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|130&lt;br /&gt;
|u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|131&lt;br /&gt;
|u or v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|132-133&lt;br /&gt;
|v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|134&lt;br /&gt;
|v or w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|135&lt;br /&gt;
|w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|136&lt;br /&gt;
|w or x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|137-138&lt;br /&gt;
|x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|139&lt;br /&gt;
|x or y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|140&lt;br /&gt;
|y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|141&lt;br /&gt;
|y or z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|142-143&lt;br /&gt;
|z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|144&lt;br /&gt;
|z or 2&lt;br /&gt;
|34 or 35&lt;br /&gt;
|-&lt;br /&gt;
|145-255&lt;br /&gt;
|2&lt;br /&gt;
|35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33494</id>
		<title>List of address prefixes</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33494"/>
		<updated>2012-12-10T00:24:41Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Blockchain-based currencies use addresses, which are a [[Base58Check encoding]] of some hash, typically that of a public key. The encoding includes a version byte, which affects the first character in the address. The following is a list of some prefixes which are in use.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Initial byte(s)&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Use&lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|1&lt;br /&gt;
|Bitcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;12CPLrAUPvhVwjZqBgww3sLdEg4Z888R1j&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|3&lt;br /&gt;
|Bitcoin script hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|Litecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;LhK2kQwiaAvhjWY799cZvMyYwnQAcxkarr&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|Namecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;NATX6zEUNfxfvgVwz8qVnnw3hLhhYXhgQn&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|Fairbrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;fF6o8LeDAfswEpMbCW8BqaqmzMWS7TGgew&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|97&lt;br /&gt;
|g&lt;br /&gt;
|GeistGeld pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;gQ8YScyiMUTart6kUJpzhjPzAKfiYAwooc&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|i0coin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;jWmCr5cKeQjV4iyfUyipfLGwVML8MvXhF2&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|Bitcoin testnet pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;mkJ7Bf5chdfw61d1m7gnDVAQV3EQQAb8iz&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|Solidcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;sXNaMoYBocjcQJRLK53dkaQ5mWuKfvHB9f&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|127&lt;br /&gt;
|t&lt;br /&gt;
|Tenebrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;tUK2EQTMF6cN6vuNEfJtVf1BMqarvEZJBL&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|5&lt;br /&gt;
|Uncompressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;5Htn3FzuH3b1X5VF2zLTsAQzBcyzkZNJsa2egXN8ZFJTCqQm3Rq&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|K or L&lt;br /&gt;
|Compressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|138&lt;br /&gt;
|x&lt;br /&gt;
|ixcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;xoKDFH4uWpyzxUcCC5jCLFujRKayv3HHcV&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|196&lt;br /&gt;
|2&lt;br /&gt;
|Testnet script hash&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|9&lt;br /&gt;
|Uncompressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;91eWjgRmucdtYHpMdsHbn9h8UU8hdoMNSKj8p3QAj6VTLyBnjj6&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|c&lt;br /&gt;
|Compressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;cNJFgo1driFnPcBdBX8BrJrpxchBWXwXCvNH5SoSkdcF6JXXwHMm&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|0x142, 0x143&lt;br /&gt;
|6P&lt;br /&gt;
|Encrypted private key ([[BIP 0038|BIP 38]])&lt;br /&gt;
|&amp;lt;tt&amp;gt; 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg &amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following table shows the leading symbol(s) and address length(s) for 160 bit hashes for each of the possible decimal version values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Decimal version&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Address length&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|up to 34&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Q-Z, a-k, m-o&lt;br /&gt;
|33&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|o-z, 2&lt;br /&gt;
|33 or 34&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|2&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|2 or 3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|5-6&lt;br /&gt;
|3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|3 or 4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|4 or 5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|10-11&lt;br /&gt;
|5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|12&lt;br /&gt;
|5 or 6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|14&lt;br /&gt;
|6 or 7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|15-16&lt;br /&gt;
|7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|7 or 8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|18&lt;br /&gt;
|8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|19&lt;br /&gt;
|8 or 9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|20-21&lt;br /&gt;
|9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|22&lt;br /&gt;
|9 or A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|23&lt;br /&gt;
|A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|24&lt;br /&gt;
|A or B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|25-26&lt;br /&gt;
|B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|27&lt;br /&gt;
|B or C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|28&lt;br /&gt;
|C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|29&lt;br /&gt;
|C or D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|30-31&lt;br /&gt;
|D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|32&lt;br /&gt;
|D or E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|33&lt;br /&gt;
|E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|34&lt;br /&gt;
|E or F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|35-36&lt;br /&gt;
|F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|37&lt;br /&gt;
|F or G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|G or H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|40-41&lt;br /&gt;
|H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|42&lt;br /&gt;
|H or J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|43&lt;br /&gt;
|J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|44&lt;br /&gt;
|J or K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|45-46&lt;br /&gt;
|K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|47&lt;br /&gt;
|K or L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|49&lt;br /&gt;
|L or M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|50-51&lt;br /&gt;
|M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|53&lt;br /&gt;
|N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|54&lt;br /&gt;
|N or P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|55-56&lt;br /&gt;
|P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|57&lt;br /&gt;
|P or Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|58&lt;br /&gt;
|Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|59&lt;br /&gt;
|Q or R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|60-61&lt;br /&gt;
|R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|62&lt;br /&gt;
|R or S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|63&lt;br /&gt;
|S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|64&lt;br /&gt;
|S or T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|65-66&lt;br /&gt;
|T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|67&lt;br /&gt;
|T or U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|68&lt;br /&gt;
|U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|69&lt;br /&gt;
|U or V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|70-71&lt;br /&gt;
|V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|72&lt;br /&gt;
|V or W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|73&lt;br /&gt;
|W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|74&lt;br /&gt;
|W or X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|75-76&lt;br /&gt;
|X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|77&lt;br /&gt;
|X or Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|78&lt;br /&gt;
|Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|79&lt;br /&gt;
|Y or Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|80-81&lt;br /&gt;
|Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|82&lt;br /&gt;
|Z or a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|83&lt;br /&gt;
|a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|84&lt;br /&gt;
|a or b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|85&lt;br /&gt;
|b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|86&lt;br /&gt;
|b or c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|87-88&lt;br /&gt;
|c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|89&lt;br /&gt;
|c or d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|90&lt;br /&gt;
|d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|91&lt;br /&gt;
|d or e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|92-93&lt;br /&gt;
|e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|94&lt;br /&gt;
|e or f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|96&lt;br /&gt;
|f or g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|97-98&lt;br /&gt;
|g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|99&lt;br /&gt;
|g or h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|100&lt;br /&gt;
|h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|101&lt;br /&gt;
|h or i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|102-103&lt;br /&gt;
|i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|104&lt;br /&gt;
|i or j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|106&lt;br /&gt;
|j or k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|107-108&lt;br /&gt;
|k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|109&lt;br /&gt;
|k or m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|110&lt;br /&gt;
|m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|112-113&lt;br /&gt;
|n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|114&lt;br /&gt;
|n or o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|115&lt;br /&gt;
|o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|116&lt;br /&gt;
|o or p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|117-118&lt;br /&gt;
|p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|119&lt;br /&gt;
|p or q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|120&lt;br /&gt;
|q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|121&lt;br /&gt;
|q or r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|122-123&lt;br /&gt;
|r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|124&lt;br /&gt;
|r or s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|126&lt;br /&gt;
|s or t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|127-128&lt;br /&gt;
|t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|129&lt;br /&gt;
|t or u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|130&lt;br /&gt;
|u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|131&lt;br /&gt;
|u or v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|132-133&lt;br /&gt;
|v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|134&lt;br /&gt;
|v or w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|135&lt;br /&gt;
|w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|136&lt;br /&gt;
|w or x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|137-138&lt;br /&gt;
|x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|139&lt;br /&gt;
|x or y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|140&lt;br /&gt;
|y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|141&lt;br /&gt;
|y or z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|142-143&lt;br /&gt;
|z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|144&lt;br /&gt;
|z or 2&lt;br /&gt;
|34 or 35&lt;br /&gt;
|-&lt;br /&gt;
|145-255&lt;br /&gt;
|2&lt;br /&gt;
|35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33493</id>
		<title>List of address prefixes</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=List_of_address_prefixes&amp;diff=33493"/>
		<updated>2012-12-10T00:24:26Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Blockchain-based currencies use addresses, which are a [[Base58Check encoding]] of some hash, typically that of a public key. The encoding includes a version byte, which affects the first character in the address. The following is a list of some prefixes which are in use.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Initial byte(s)&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Use&lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|1&lt;br /&gt;
|Bitcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;12CPLrAUPvhVwjZqBgww3sLdEg4Z888R1j&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|3&lt;br /&gt;
|Bitcoin script hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|Litecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;LhK2kQwiaAvhjWY799cZvMyYwnQAcxkarr&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|Namecoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;NATX6zEUNfxfvgVwz8qVnnw3hLhhYXhgQn&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|Fairbrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;fF6o8LeDAfswEpMbCW8BqaqmzMWS7TGgew&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|97&lt;br /&gt;
|g&lt;br /&gt;
|GeistGeld pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;gQ8YScyiMUTart6kUJpzhjPzAKfiYAwooc&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|i0coin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;jWmCr5cKeQjV4iyfUyipfLGwVML8MvXhF2&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|Bitcoin testnet pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;mkJ7Bf5chdfw61d1m7gnDVAQV3EQQAb8iz&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|Solidcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;sXNaMoYBocjcQJRLK53dkaQ5mWuKfvHB9f&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|127&lt;br /&gt;
|t&lt;br /&gt;
|Tenebrix pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;tUK2EQTMF6cN6vuNEfJtVf1BMqarvEZJBL&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|5&lt;br /&gt;
|Uncompressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;5Htn3FzuH3b1X5VF2zLTsAQzBcyzkZNJsa2egXN8ZFJTCqQm3Rq&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|128&lt;br /&gt;
|K or L&lt;br /&gt;
|Compressed Bitcoin Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|138&lt;br /&gt;
|x&lt;br /&gt;
|ixcoin pubkey hash&lt;br /&gt;
|&amp;lt;tt&amp;gt;xoKDFH4uWpyzxUcCC5jCLFujRKayv3HHcV&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|196&lt;br /&gt;
|2&lt;br /&gt;
|Testnet script hash&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|9&lt;br /&gt;
|Uncompressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;91eWjgRmucdtYHpMdsHbn9h8UU8hdoMNSKj8p3QAj6VTLyBnjj6&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|239&lt;br /&gt;
|c&lt;br /&gt;
|Compressed Testnet Private key&lt;br /&gt;
|&amp;lt;tt&amp;gt;cNJFgo1driFnPcBdBX8BrJrpxchBWXwXCvNH5SoSkdcF6JXXwHMm&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|0x142, 0x0143&lt;br /&gt;
|6P&lt;br /&gt;
|Encrypted private key ([[BIP 0038|BIP 38]])&lt;br /&gt;
|&amp;lt;tt&amp;gt; 6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg &amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following table shows the leading symbol(s) and address length(s) for 160 bit hashes for each of the possible decimal version values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Decimal version&lt;br /&gt;
!Leading symbol&lt;br /&gt;
!Address length&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|up to 34&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Q-Z, a-k, m-o&lt;br /&gt;
|33&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|o-z, 2&lt;br /&gt;
|33 or 34&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|2&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|2 or 3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|5-6&lt;br /&gt;
|3&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|3 or 4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|4&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|4 or 5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|10-11&lt;br /&gt;
|5&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|12&lt;br /&gt;
|5 or 6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|6&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|14&lt;br /&gt;
|6 or 7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|15-16&lt;br /&gt;
|7&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|7 or 8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|18&lt;br /&gt;
|8&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|19&lt;br /&gt;
|8 or 9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|20-21&lt;br /&gt;
|9&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|22&lt;br /&gt;
|9 or A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|23&lt;br /&gt;
|A&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|24&lt;br /&gt;
|A or B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|25-26&lt;br /&gt;
|B&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|27&lt;br /&gt;
|B or C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|28&lt;br /&gt;
|C&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|29&lt;br /&gt;
|C or D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|30-31&lt;br /&gt;
|D&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|32&lt;br /&gt;
|D or E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|33&lt;br /&gt;
|E&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|34&lt;br /&gt;
|E or F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|35-36&lt;br /&gt;
|F&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|37&lt;br /&gt;
|F or G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|G&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|G or H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|40-41&lt;br /&gt;
|H&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|42&lt;br /&gt;
|H or J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|43&lt;br /&gt;
|J&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|44&lt;br /&gt;
|J or K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|45-46&lt;br /&gt;
|K&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|47&lt;br /&gt;
|K or L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|48&lt;br /&gt;
|L&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|49&lt;br /&gt;
|L or M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|50-51&lt;br /&gt;
|M&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|52&lt;br /&gt;
|M or N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|53&lt;br /&gt;
|N&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|54&lt;br /&gt;
|N or P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|55-56&lt;br /&gt;
|P&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|57&lt;br /&gt;
|P or Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|58&lt;br /&gt;
|Q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|59&lt;br /&gt;
|Q or R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|60-61&lt;br /&gt;
|R&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|62&lt;br /&gt;
|R or S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|63&lt;br /&gt;
|S&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|64&lt;br /&gt;
|S or T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|65-66&lt;br /&gt;
|T&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|67&lt;br /&gt;
|T or U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|68&lt;br /&gt;
|U&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|69&lt;br /&gt;
|U or V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|70-71&lt;br /&gt;
|V&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|72&lt;br /&gt;
|V or W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|73&lt;br /&gt;
|W&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|74&lt;br /&gt;
|W or X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|75-76&lt;br /&gt;
|X&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|77&lt;br /&gt;
|X or Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|78&lt;br /&gt;
|Y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|79&lt;br /&gt;
|Y or Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|80-81&lt;br /&gt;
|Z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|82&lt;br /&gt;
|Z or a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|83&lt;br /&gt;
|a&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|84&lt;br /&gt;
|a or b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|85&lt;br /&gt;
|b&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|86&lt;br /&gt;
|b or c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|87-88&lt;br /&gt;
|c&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|89&lt;br /&gt;
|c or d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|90&lt;br /&gt;
|d&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|91&lt;br /&gt;
|d or e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|92-93&lt;br /&gt;
|e&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|94&lt;br /&gt;
|e or f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|95&lt;br /&gt;
|f&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|96&lt;br /&gt;
|f or g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|97-98&lt;br /&gt;
|g&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|99&lt;br /&gt;
|g or h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|100&lt;br /&gt;
|h&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|101&lt;br /&gt;
|h or i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|102-103&lt;br /&gt;
|i&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|104&lt;br /&gt;
|i or j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|105&lt;br /&gt;
|j&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|106&lt;br /&gt;
|j or k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|107-108&lt;br /&gt;
|k&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|109&lt;br /&gt;
|k or m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|110&lt;br /&gt;
|m&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|m or n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|112-113&lt;br /&gt;
|n&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|114&lt;br /&gt;
|n or o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|115&lt;br /&gt;
|o&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|116&lt;br /&gt;
|o or p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|117-118&lt;br /&gt;
|p&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|119&lt;br /&gt;
|p or q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|120&lt;br /&gt;
|q&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|121&lt;br /&gt;
|q or r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|122-123&lt;br /&gt;
|r&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|124&lt;br /&gt;
|r or s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|125&lt;br /&gt;
|s&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|126&lt;br /&gt;
|s or t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|127-128&lt;br /&gt;
|t&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|129&lt;br /&gt;
|t or u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|130&lt;br /&gt;
|u&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|131&lt;br /&gt;
|u or v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|132-133&lt;br /&gt;
|v&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|134&lt;br /&gt;
|v or w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|135&lt;br /&gt;
|w&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|136&lt;br /&gt;
|w or x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|137-138&lt;br /&gt;
|x&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|139&lt;br /&gt;
|x or y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|140&lt;br /&gt;
|y&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|141&lt;br /&gt;
|y or z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|142-143&lt;br /&gt;
|z&lt;br /&gt;
|34&lt;br /&gt;
|-&lt;br /&gt;
|144&lt;br /&gt;
|z or 2&lt;br /&gt;
|34 or 35&lt;br /&gt;
|-&lt;br /&gt;
|145-255&lt;br /&gt;
|2&lt;br /&gt;
|35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33446</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33446"/>
		<updated>2012-12-08T23:57:25Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Initiation of Proposal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, one of the parties initiates an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33427</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33427"/>
		<updated>2012-12-08T16:10:46Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Four party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, any of the parties (other than Customer Charlie) can initiate an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.&lt;br /&gt;
* Bob creates private keys a and b.  He gives a and Gybx to Alice.  He gives Gab to Charlie.  He gives b and Gax to Eddie.&lt;br /&gt;
* Alice and Eddie don&#039;t create any private keys.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gybx.  She calculates the Bitcoin address as (Gybx)a.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gax, b and y.  He calculates the Bitcoin address as (Gax)by.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a will never known by Eddie or Charlie and this prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33419</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33419"/>
		<updated>2012-12-08T07:39:33Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* Four party scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, any of the parties (other than Customer Charlie) can initiate an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice and Eddie.  Even then, Alice would have sole control over the funds and would choose where they ultimately go - if they should automatically go back to Charlie, the three-party scheme would work better.  Alice is the alternate beneficiary - a third party entrusted to receive full control over the money in case Charlie and Eddie are certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without anyone else&#039;s help.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice; neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie must make the initial proposal, as everything else depends on keys produced by Charlie.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.  He gives Gx to Alice.&lt;br /&gt;
* Bob creates private key b.  He gives it to Eddie.  Bob has b, x, and Gy.  He gives Gbxy to Alice.&lt;br /&gt;
* Alice creates private key a.  She gives it to Bob.  Alice has a, Gx, and Gbxy.  She gives Gax to Eddie.&lt;br /&gt;
* Now that Bob knows a, he provides Gab to Charlie.&lt;br /&gt;
* Eddie doesn&#039;t create any private keys but knows y, b, and Gax.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gbxy.  She calculates the Bitcoin address as (Gxy)ab.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gabx and y.  He calculates the Bitcoin address as (Gabx)y.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a is never known by Eddie or Charlie and prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33418</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33418"/>
		<updated>2012-12-08T07:34:12Z</updated>

		<summary type="html">&lt;p&gt;Casascius: /* How the scheme works */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, any of the parties (other than Customer Charlie) can initiate an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him x (or Eddie&#039;s original record to him containing x and Gy).&lt;br /&gt;
* Bob can give Alice a refund by giving her y (or Eddie&#039;s original record to him containing y and Gx).&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her y (or the original record he gave to Bob).&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him x (or the original record he gave to Alice).&lt;br /&gt;
&lt;br /&gt;
====Four party scheme====&lt;br /&gt;
A four party scheme involves Charlie the customer paying Bob the beneficiary, with no chance that he could get his money back without the combined consent of Alice, Bob, and Eddie.  Alice is a third party entrusted to receive full control over the money in case Charlie is certain it must not go to Bob.&lt;br /&gt;
&lt;br /&gt;
In this scheme, Charlie can independently release the funds to Bob without needing help from Eddie.  Eddie can also release them to Bob without help from Charlie.  However, if Charlie and Eddie both agree that Bob shouldn&#039;t get the funds, then they can collectively agree to have the funds go to Alice, but neither Charlie nor Eddie can send the funds to Alice acting alone.&lt;br /&gt;
&lt;br /&gt;
Charlie or Alice must go first, because Bob needs something from both Charlie and Alice to give Eddie what he needs to do his job.&lt;br /&gt;
&lt;br /&gt;
* Charlie creates private keys x and y.  He gives x and Gy to Bob and y to Eddie.  He gives Gx to Alice.&lt;br /&gt;
* Bob creates private key b.  He gives it to Eddie.  Bob has b, x, and Gy.  He gives Gbxy to Alice.&lt;br /&gt;
* Alice creates private key a.  She gives it to Bob.  Alice has a, Gx, and Gbxy.  She gives Gax to Eddie.&lt;br /&gt;
* Now that Bob knows a, he provides Gab to Charlie.&lt;br /&gt;
* Eddie doesn&#039;t create any private keys but knows y, b, and Gax.&lt;br /&gt;
After all proposals and acceptances have been exchanged:&lt;br /&gt;
* Charlie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a and Gbxy.  She calculates the Bitcoin address as (Gxy)ab.&lt;br /&gt;
* Bob knows b, a, x, and Gy.  He calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Eddie knows Gabx and y.  He calculates the Bitcoin address as (Gabx)y.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Charlie pays, and then:&lt;br /&gt;
* Charlie can release the funds to Bob by giving him y (or the original record he gave to Eddie).&lt;br /&gt;
* Eddie can release the funds to Bob by giving him y (or the original record Charlie gave him).&lt;br /&gt;
* If Charlie and Eddie agree that Alice should get the funds, then Charlie gives her x and y, and Eddie gives her b.&lt;br /&gt;
And just so it&#039;s clear:&lt;br /&gt;
* x represents Charlie&#039;s control, ensures that Alice can&#039;t get funds without his consent.&lt;br /&gt;
* y represents Charlie&#039;s and Eddie&#039;s ability to decide if and when Bob gets the funds&lt;br /&gt;
* a is never known by Eddie or Charlie and prevents them from ever gaining access to the funds&lt;br /&gt;
* b represents Eddie&#039;s ability to override Bob and to consent to Alice getting the funds.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33417</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33417"/>
		<updated>2012-12-08T06:19:36Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, any of the parties (other than Customer Charlie) can initiate an escrow transaction proposal.  The second party creates a proposal that &amp;quot;seconds&amp;quot; the first.  The third party either &amp;quot;accepts&amp;quot; the proposal (if it&#039;s a three party transaction) or &amp;quot;thirds&amp;quot; it, and finally (if applicable), the fourth party accepts it.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (2), Thirding (3), or Acceptance (A)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
====Three party scheme====&lt;br /&gt;
&lt;br /&gt;
A three party scheme involves Alice paying Bob, and Eddie being the escrow agent.  Alice and Bob can release the funds to one another without Eddie&#039;s help, and Eddie can break a tie and force the funds to go to either Alice or Bob if the two of them don&#039;t agree.&lt;br /&gt;
&lt;br /&gt;
* Eddie creates private keys x and y.  He gives Alice x and Gy.  He gives Bob y and Gx.&lt;br /&gt;
* Alice creates private key a.  She gives Bob a.  She gives Eddie Gab if she knows b.&lt;br /&gt;
* Bob creates private key b.  He gives Alice b.  He gives Eddie Gab if he knows a. &lt;br /&gt;
After all proposals acceptances have been exchanged:&lt;br /&gt;
* Eddie knows x, y, and Gab.  He calculates the Bitcoin address as (Gab)xy.&lt;br /&gt;
* Alice knows a, b, x, and Gy.  She calculates the Bitcoin address as (Gy)abx.&lt;br /&gt;
* Bob knows a, b, y, and Gx.  She calculates the Bitcoin address as (Gx)aby.&lt;br /&gt;
Once all parties agree they have the same Bitcoin address, Alice pays, and then:&lt;br /&gt;
* Alice releases the funds to Bob by giving him Eddie&#039;s original record to him containing x and Gy.&lt;br /&gt;
* Bob can give Alice a refund by giving her Eddie&#039;s original record to him containing y and Gx.&lt;br /&gt;
* Eddie can force the funds to go to Alice by giving her the original record he gave to Bob.&lt;br /&gt;
* Eddie can force the funds to go to Bob by giving him the original record he gave to Alice.&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33415</id>
		<title>User:Casascius/Escrow scheme draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Casascius/Escrow_scheme_draft&amp;diff=33415"/>
		<updated>2012-12-08T03:18:08Z</updated>

		<summary type="html">&lt;p&gt;Casascius: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a draft for a three-party or four-party scheme that enables an escrow transaction using nothing more than standard (non-multi-signature) Bitcoin transactions.  This proposal contemplates the following features:&lt;br /&gt;
&lt;br /&gt;
# One shared Bitcoin address for the entire transaction&lt;br /&gt;
# All parties to the transaction can verify that the Bitcoin address belongs to the transaction they&#039;re participating in, and not one made up or taken from someone&#039;s own personal wallet&lt;br /&gt;
# Escrow agent can control the disposition of the funds but cannot take the funds&lt;br /&gt;
# Releasing the funds remains possible even if the escrow agent disappears&lt;br /&gt;
&lt;br /&gt;
The proposal contemplates up to four roles, defined as follows:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;B - Beneficiary Bob&#039;&#039;&#039; - Bob is the person providing the goods or services, and who will receive control the proceeds of the transaction if there is no dispute and the goods or services are delivered as promised.&lt;br /&gt;
* &#039;&#039;&#039;A - Alternate Beneficiary Alice (or Customer Alice)&#039;&#039;&#039;: Alice is the person who will receive the proceeds of the transaction if either the Bob or the Escrow Agent decide that the funds should not go to the Beneficiary.  Alice might or might not be the customer who is paying into the escrow transaction.  If Alice is the customer, then allowing the funds to go to Alice constitutes a refund.  If Alice is not the customer, then Alice is an alternate beneficiary who may be granted access to the funds by the Escrow Agent in the event they determine it should not go to Bob, and might be a person more able to settle a dispute than anyone else.&lt;br /&gt;
* &#039;&#039;&#039;E - Escrow Agent Eddie&#039;&#039;&#039; - This person gets the power to award control of the funds to either Alice or Bob if the two of them cannot agree who amongst themselves should get the funds.&lt;br /&gt;
* &#039;&#039;&#039;C - Customer Charlie (optional)&#039;&#039;&#039; - If Charlie is a party to the transaction, then Charlie is the person paying into the escrow account with no hope of receiving a refund.  Charlie has the power to grant the proceeds of the funds to Bob or Alice, but only if the Eddie doesn&#039;t do it first.  Charlie can also verify, with the help of a tool, that he is paying into an account under the control of Bob, Alice, and Eddie, rather than into someone&#039;s personal wallet.&lt;br /&gt;
&lt;br /&gt;
==How the scheme works==&lt;br /&gt;
&lt;br /&gt;
===Initiation of Proposal===&lt;br /&gt;
First, any of the parties (other than Customer Charlie) can initiate an escrow transaction proposal.  The second party creates a proposal that references the first.  The third party creates an acceptance.&lt;br /&gt;
&lt;br /&gt;
A proposal or acceptance is a Base58-encoded string whose prefix specifies who created the record and to whom it should be given.  The parties can initiate and accept in any order, with one exception: the escrow agent must be first or second.&lt;br /&gt;
&lt;br /&gt;
The prefixes for the strings are always four characters, that follow this format:&lt;br /&gt;
* First character: who created the string (B, A, or E)&lt;br /&gt;
* Second character: whether this is a Proposal (P), Seconding (S), Acceptance (A), or Confirmation (C)&lt;br /&gt;
* Third character: the number 4&lt;br /&gt;
* Fourth character: the intended recipient of the string (B, A, E, or C).&lt;br /&gt;
&lt;br /&gt;
As an example, if someone creates a proposal and selects that they intend to be the Escrow Agent, then their client will generate two strings: one starting with EP4A and the other starting with EP4B.&lt;br /&gt;
&lt;br /&gt;
Initiation involves generating cryptographic key(s), and creating two Base58-encoded records containing the applicable keys (public or private) and signaling the party&#039;s intentions.  One record is given to each other party.&lt;br /&gt;
&lt;br /&gt;
If a prospective Escrow Agent initiates a proposal, he generates two private keys we&#039;ll call x and y.  He emits two records with prefixes EP4A and EP4B.&lt;br /&gt;
* EP4A contains private key x and public key Gy.&lt;br /&gt;
* EP4B contains private key y and public key Gx.&lt;br /&gt;
* Both records contain a 32-bit proposal identifier (which is the first 32 bits of RIPEMD160(SHA256(Gxy))).&lt;br /&gt;
&lt;br /&gt;
If a prospective Beneficiary initiates a proposal, he generates a private key we&#039;ll call b.  He emits two records with prefixes BP4A and BP4E.&lt;br /&gt;
* BP4A contains private key b.&lt;br /&gt;
* BP4E contains public key Gb.&lt;br /&gt;
* Both records contain a 32-bit proposal identifier, the first 32 bits of RIPEMD160(SHA256(Gb)).&lt;br /&gt;
&lt;br /&gt;
If a prospective Alternate Beneficiary, or Customer who is also an Alternate Beneficiary, initiates a proposal, she generates a private key we&#039;ll call a.  She emits two records with prefixes AP4B and AP4E.&lt;br /&gt;
* AP4B contains private key a.&lt;br /&gt;
* AP4E contains public key Ga.&lt;br /&gt;
* Both records contain a 32-bit proposal identifier, the first 32 bits of RIPEMD160(SHA256(Ga)).&lt;br /&gt;
&lt;br /&gt;
===Intermediate acceptance and secondary proposal===&lt;br /&gt;
A party who receives an initial proposal as described above may Second the proposal and become the second party, producing an Acceptance record for the proposing party, and a Seconding record for the remaining party.&lt;br /&gt;
&lt;br /&gt;
Proposals can be created and accepted by the parties in any order, except the escrow agent cannot be last.&lt;br /&gt;
&lt;br /&gt;
If a prospective Escrow Agent seconds an initial proposal from a Beneficiary, then he generates private keys x and y, and emits an Acceptance record with prefix EA4B and a Seconding record with prefix ES4A.&lt;br /&gt;
* EA4B contains private key y and public key Gx.&lt;br /&gt;
* ES4A contains private key x and public key Gy.&lt;br /&gt;
* Both records use the same 32-bit proposal identifier that came from the Beneficiary, which is a hash based on Gb.&lt;br /&gt;
* The proposal record has bits set indicating that it is also the acceptance of a proposal by a prospective Beneficiary.&lt;br /&gt;
&lt;br /&gt;
If a prospective Escrow Agent accepts an initial proposal from an Alternate Beneficiary / Customer who is also an Alternate Beneficiary, the same method is employed as described above, except swap all a and b, and swap all x and y as applicable.&lt;br /&gt;
&lt;br /&gt;
If a prospective Beneficiary accepts an initial proposal created by an Escrow Agent, then he generates private key b, and emits an acceptance record BA4E and a secondary proposal record with prefix BP4A.&lt;br /&gt;
* BA4E contains public keys Gb and Gab.&lt;br /&gt;
* BP4A contains private key b.&lt;br /&gt;
* Both records use the same 32-bit proposal identifier that came from the Escrow Agent, which is a hash based on Gxy.&lt;br /&gt;
&lt;br /&gt;
If a prospective Alternate Beneficiary accepts an initial proposal created by an Escrow Agent, follow the same procedure for a Beneficiary, swapping a and b, and x and y.&lt;br /&gt;
&lt;br /&gt;
===Final acceptance===&lt;br /&gt;
A party in a position to issue a final acceptance will have received two proposals with identical proposal identifiers.  That party should generate its own private key(s) as defined in the other stages, and emit acceptance records for the benefit of the first two parties.  It is at this point that the accepting party knows the Bitcoin address for the entire arrangement.&lt;br /&gt;
* If the final acceptance happens by an Escrow Agent, he knows Gab, x, and y, and can calculate the Bitcoin address as (Gab)xy.&lt;br /&gt;
* If the final acceptance happens by a Beneficiary or Alternate Beneficiary, he/she knows or can calculate Gxy and knows a and b.  He or she can calculate the Bitcoin address as (Gxy)ab.&lt;br /&gt;
&lt;br /&gt;
Upon final acceptance, each party is in a position to issue a confirmation record for the benefit of Charlie the paying-only customer.  This confirmation permits Charlie to ensure he is paying an address that is participating in an escrow scheme.&lt;br /&gt;
&lt;br /&gt;
If confirmation is needed, each party shall issue one.  Charlie will need three records in order to receive a satisfactory confirmation.&lt;br /&gt;
* The Escrow Agent provides a confirmation record which starts with EC4C and contains:&lt;br /&gt;
* The Beneficiary provides a confirmation which starts with BC4C and contains:&lt;/div&gt;</summary>
		<author><name>Casascius</name></author>
	</entry>
</feed>