Ok, then here is the client code: #!/bin/bash
# server address (todo: add an option to set it on command line) server=127.0.0.1/stockmarket-server.cgi
# private key # you can generate one with: openssl genrsa -out rsa-test 2048 # public key can be obtained with: openssl rsa -pubout -in rsa-test privkey="rsa-test"
# message is given on command line message="$@"
# Message authentication code is a random number appended to unix EPOC mac=$(bc <<<"$(date +%s)+$RANDOM")
# base64 JSON data data="$(base64 -w 0 <<<"{ \"message\": \"$message\", \"mac\": $mac }")"
# base64 whirlpool signature signature="$(openssl dgst -whirlpool -sign $privkey <<< "$data" |base64 -w 0)"
# sending via POST method wget -q -O - --post-data "data=\"$data\" signature=\"$signature\" pubkey=\"$(openssl rsa -pubout -in $privkey)\"" http://$server
And here is the code for the server (a CGI script): #!/bin/bash
echo "Content-type: text/plain" echo
echo stock market exchange server echo
if [[ "$REQUEST_METHOD" = "POST" ]] && [[ "$CONTENT_LENGTH" -gt 0 ]] then read -N $CONTENT_LENGTH POST_DATA <&0
# todo: retrieve post data more securely than using "eval" eval "$POST_DATA"
if openssl dgst -whirlpool -signature <(base64 -d <<<"$signature") -verify <(echo "$pubkey") <<<"$data" 2>&1 then data="$(base64 -d <<<"$data")" echo "$data" else echo wrong signature fi
else echo no data received fi
Several aspects of your specification for the server depend on the kind of database you want to use. Would you consider using mongodb?
|
|
|
I haven't found anyone interested in my 0.50 BTC shells either...
I may have missed that. Please give me a link. Do you offer web service with CGI?
|
|
|
Yes, you're right. The "signature" in a whirlpool hash of the data that's encrypted by the private key.
I forgot to say that.
openssl doesn't do whirlpool for signed digest. hash options for dgst are: [-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1]
|
|
|
The client part is very easy: #!/bin/bash
# server address (todo: add an option to set it on command line) server=127.0.0.1
# private key # you can generate one with: openssl genrsa -out rsa-test 2048 # public key can be obtained with: openssl rsa -pubout -in rsa-test privkey="rsa-test"
# message is given on command line message="$@"
# Message authentication code is a random number appended to unix EPOC mac=$(bc <<<"$(date +%s)+$RANDOM")
data="$(base64 <<<"{ \"message\": \"$message\", \"mac\": $mac }")"
signature="$(openssl rsautl -sign -inkey $privkey -in <(echo "$data") |base64)"
wget -O - --post-data "data=$data&signature=$signature" http://$server
Notice that the signature process will fail if the message is too long. In that case, a hash of the message should be used instead of the message itself. We might then consider using dgst instead of rsautl. I think the client should also send its public key, otherwise I don't know how the server can guess it ![Wink](https://bitcointalk.org/Smileys/default/wink.gif) So basically, the last line should rather be: wget -O - --post-data "data=$data&signature=$signature&pubkey=$(openssl rsa -pubout -in $privkey)" http://$server
|
|
|
I installed the package on my server, but I have no idea where the program was installed. I'm a bit of a Debian newb, so maybe it is obvious, but how do I run bitcoind and set up the config file like it talks about here: https://en.bitcoin.it/wiki/API_tutorial_%28JSON-RPC%29Thanks to anyone who can help me ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) Personnally I stick with the bitcoin.org tarball install, but I guess that once you've installed the bitcoin-cli package, all you have to do is to run "bitcoind". What message do you get when you try that?
|
|
|
Some people will NEVER sell their bitcoin to the gov...like me! ![Cheesy](https://bitcointalk.org/Smileys/default/cheesy.gif) Me too!!! NEVER NEVER NEVER ![Cheesy](https://bitcointalk.org/Smileys/default/cheesy.gif) Well, I might sell them a few bitcoins. If the government is giving me 1kg of gold per BTC.
|
|
|
I think it is wrong to call bitcoin a "private" currency.
On the contrary, imo bitcoin is much more of a public currency that any national currency is.
|
|
|
I keep thinking Satoshi Nakamoto is his real name.
|
|
|
What is it with you and bash scripts? ![Roll Eyes](https://bitcointalk.org/Smileys/default/rolleyes.gif) Can you do nothing else? Well actually, no, I can't. I'm not good at anything else indeed. I'm not a very good programmer and bash is the only language in which I manage to do usefull stuffs.
|
|
|
I'd like to show off my own bash script: #!/bin/bash
name=grondilu sftp_address=grondilu@somewhere.fr email=grondilu@nospam.fr bluetoothaddr="00:XX:YY:ZZ:UU:TT"
private="$HOME/Private" backup="wallet-$(date +%s).dat"
error() { echo $1 returned error code $2 rm -f $private/"$backup"{,.gpg} exit $2 }
if echo -n "making backup file..." bitcoind backupwallet "$private/$backup" r=$? ; ((r != 0)) then error bitcoind $r elif echo ok cd $private echo -n "encrypting..." gpg -e -r $name "$backup" r=$? ; ((r != 0)) then error gpg $r elif echo ok rm "$backup" echo -n "copying to distant server..." scp "$backup.gpg" $sftp_address: r=$? ; ((r != 0)) then error scp $r elif echo ok echo -n "adding to distant archive..." ssh $sftp_address <<< "tar rf wallet-backup.tar $backup.gpg && rm $backup.gpg" r=$? ; ((r != 0)) then error ssh $r elif echo ok echo -n "copying to smartphone..." obexftp -b "$bluetoothaddr" -c /Data/backups -p "$backup.gpg" r=$? ; ((r != 0)) then error obexftp $r elif echo ok echo -n "sending backup via email..." mutt $email -s backup -a $backup.gpg < /dev/null r=$? ; ((r != 0)) then error mutt $r else echo ok rm "$backup.gpg" fi
|
|
|
I know a bit about this software and I think it's pretty cool. I really would like to see an implementation of bitcoin using this as a database handler. One of the reason why I think it would fit bitcoin nicely is the fact that mongodb uses JSON directly to represent data. An other reason is that it is very easy to connect to an other mongodb on the net. Thus, the network handling would be easy. Also, it's very easy to handle from a bash script. www.mongodb.org
|
|
|
Ok, that's cool. How can I do CGI?
|
|
|
No one has any obligation to tell the world the size of their trades after the fact let alone before.
+1
|
|
|
I see that you don't run any web server. Could you, please?
If you don't want to run Apache, please consider installing thttpd, which is pretty easy and fast to install.
Then I guess it would be easy to serve any www directory for each user.
|
|
|
The amount of money you own is definitely NOT related to your wealth. Rich people don't hoard large amounts of cash, unless they are stupid.
The golden rule in finance is diversification. Rich people own things that money can buy, not money itself.
I'm a huge fan of bitcoin, and yet I don't own 5,400 BTC, though such an amount has probably passed through my wallet.
|
|
|
I'm interested.
I understand we can't mine, but can we run a bitcoin client?
|
|
|
This is my current project.
Basically it will be a trading plateform where your GnuPG key is used to send orders.
For instance, when you want to see your balance, you just enter your GnuPG ID, and the webserver returns the info ASCII encrypted. This should also make automation very easy.
To make an order, you'll basically just have to sign a phrase such as:
SELL 1000 BTC @ 0.6 EUR/BTC
And post it in a textarea.
The webserver will NOT do any actual bitcoin or banking transfer. It would be account based.
Deposit and withdrawal of bitcoins will be free but will have to be done manually. Idem for withdrawals of Euros (I won't do USD). You will NOT be able to deposit in euros, though.
To withdraw euros, you'll have to post your signed banking coordinates first. You may also post a signed postal address, so that you receive bank notes in mail. There might a small fee for this option.
I'll try to keep it as simple as possible, in the same style that my BTC/EUR exchange site.
I write it all in a bash CGI script. Because I don't like PHP and I suck at any other web programming language. Also, bash is universal, for almost everyone has one on his linux box.
|
|
|
I've replied to both emails. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) Just want to let everyone know that I've received the card. Haven't tried it yet, though.
|
|
|
Hopefully someone will soon compile bitcoin on a smartcard.
|
|
|
Interesting concept of a "bitcoin note". I also like the design you suggested.
However, such a note is different from usual bank notes, since it has value only during a limited period of time. Basically until someone redeem the bitcoin on the address and transfer it to an other address.
That's why I think there should be a note saying what exactly this is.
Something like:
<< This is a private key of a bitcoin address which was holding 1 BTC at block number NNNN. >>
|
|
|
|