You can receive some bitcoins without even installing the client. You can also use this method to export some bitcoins into a file, without worrying about your backup file being altered later (after creation of new addresses in your wallet for instance).
Enter the following bash functions in your command line:
#!/bin/bash
#
base58=({1..9} {A..H} {J..N} {P..Z} {a..k} {m..z})
bitcoinregex="^[$(printf "%s" "${base58[@]}")]{34}$"
decodeBase58() {
local s=$1
for i in {0..57}
do s="${s//${base58[i]}/ $i}"
done
dc <<< "16o0d${s// /+58*}+f"
}
encodeBase58() {
# 58 = 0x3A
bc <<<"ibase=16; n=${1^^}; while(n>0) { n%3A ; n/=3A }" |
tac |
while read n
do echo -n ${base58[n]}
done
}
checksum() {
xxd -p -r <<<"$1" |
openssl dgst -sha256 -binary |
openssl dgst -sha256 -binary |
xxd -p -c 80 |
head -c 8
}
checkBitcoinAddress() {
if [[ "$1" =~ $bitcoinregex ]]
then
h=$(decodeBase58 "$1")
checksum "00${h::${#h}-8}" |
grep -qi "^${h: -8}$"
else return 2
fi
}
hash160() {
openssl dgst -sha256 -binary |
openssl dgst -rmd160 -binary |
xxd -p -c 80
}
hash160ToAddress() {
printf "%34s\n" "$(encodeBase58 "00$1$(checksum "00$1")")" |
sed "y/ /1/"
}
publicKeyToAddress() {
hash160ToAddress $(
openssl ec -pubin -pubout -outform DER |
tail -c 65 |
hash160
)
}
Then you generate and encrypt a new private ellyptic curve (replace grondilu by your GPG id):
openssl ecparam -genkey -name secp256k1 |
gpg -ae -r grondilu |
tee wallet.pem.asc
This saves and prints the encrypted private key:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11 (GNU/Linux)
hQIOA9o1PxP9fpBoEAgAofklK3zqQTYAL4bFOTix3reoHlp1yFBEaJdvKVq6uQn0
i4xIkgKXs36Yp0w4qqtwvDx54nen811EcqLsaHRZgFNISnnk9x9XvJSyMGpZ7xM4
iu57yb8U3p0iY9gZDdjeokgFj1B6YYwpUKpmEPER3jL/Vm+x6mPlD3WKRSzILD2K
WGjxvhExfRU6JpIJsUm9tYGL2Rm6YipQvw1/hteYoOsaoBWM8F+8M2VXJ6i2brTp
AK5QVhatcsI0gtFnS3sUKnpSsebPhIbjd8qT8nSJnQ2K1TK7t97NNWejzs7pr2pI
kupcCBSty+dyRU94ZuIWv82cWwRgtWYhyqnmxrnuEwgAgNwBdtXQbDuIkzbR+S2x
bx5kbOM5KSIk1KItWu1lA+11/eUHuBSGGGLiFlepkJNQNrReiORilz1vp+9wFaGV
Ol/pMsd6bLeHYy+twQ8lQ27IXdJcjTfCQ8TDBbikKw1Xw4hFs9iIsICsGpXz9QXD
v2xFxigLEPJUEPJw03Tv/iKyTE9wMX1ASPYW48GYwUA1b/3KxA3KXW2zs6MiTHFE
BpTb0t8xBXo1u8J6NRzGTOl7Irr75fZSOOMNsjJNi4jMWXk/JeR9ktjuY9tda5he
9CpBTuVteVQ1UATATnpvcfVXYMmkXAe1umshZIO+u/5YFOg8CJgpQ8AhirCkVeEa
ZtLAVAEX+GsQJEqc6XiHmIUhvJQ06xXmmMZRzXx08MoKDpo+eb9+eteC/vS2/6GT
PhD+jbnVxjEnlFvdNT9oAYVEzUId0beSfNGSszMXl8zLdLfK1RrqIHLJe7eMxsVZ
1EB6ccqt3Sby8hWECG1pkwT30I4BGjV7iMrejEZEtbs4JSUTxLmieoVDTnyT9/CX
tNNBOQmHGNpX9Fan+01yqaWeHW9IDJF3hZPVPWU22BzPsYqmCuu+bAzqwqYYoanD
GRsHguwru7bwspN65e8wAgAUInSTNiaeod3V6qWAiD3e6K9rHIqzkgJRB+eWP1ql
db8hsVj4HoLjhq0Vfey0lYjPIJLRIFdbK/9EgTg4mz/nectoI0pL7g==
=P2mb
-----END PGP MESSAGE-----
To see the corresponding bitcoin address, just run:
gpg < wallet.pem.asc |
openssl ec -pubout |
publicKeyToAddress
This gives me this:
1QAVk6rZ8Tzj6665X3v1yPGfKwNHFjGV4y
And basically this is a bitcoin address where you can send the money you want to save.
I don't know yet how you can retrieve those bitcoins later. But it doesn't really matter if you want to save it long term "burrying your bitcoins". It surely is possible to retrieve them, though.
PS. If you think this message is useful, you can send some cents to the above address