You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aaron J. Milius
e46b877c03
|
3 years ago | |
---|---|---|
_data | 3 years ago | |
admin | 3 years ago | |
api | 3 years ago | |
bin | 3 years ago | |
docs | 3 years ago | |
images | 3 years ago | |
lib@d1fd3ef3a8 | 3 years ago | |
nodes | 3 years ago | |
salts | 3 years ago | |
secrets | 3 years ago | |
t | 3 years ago | |
templ | 3 years ago | |
txpool | 3 years ago | |
.gitattributes | 3 years ago | |
.gitignore | 3 years ago | |
.gitmodules | 3 years ago | |
INSTALL.md | 3 years ago | |
README.md | 3 years ago | |
config.yml | 3 years ago | |
curltest.sh | 3 years ago | |
execution-notes.md | 3 years ago | |
init.sh | 3 years ago | |
install.sh | 3 years ago | |
local.key.asc | 3 years ago | |
modules.deps | 3 years ago | |
post.sh | 3 years ago | |
project.mbox | 3 years ago | |
rc.sh | 3 years ago | |
testapi.pl | 3 years ago | |
testing.pl | 3 years ago |
README.md
layout |
---|
simple |
A toy chain
The chain should have these properties:
- Running on at least 2 pre-defined nodes (IP addresses given in a config file / no additional discovery necessary)-
- PoW, with every node a miner-
- The difficulty is fixed (i.e., block time is not), each block rewards 100 coins-
- ECDSA cryptography; addresses may be pure public keys-
- Protect against double spending
- Transactions can have additional data payload, signed by the sender (and there needs to be a way to set it)
- Blocks can have additional data payload (and there needs to be a way to set it)
- Implement a simple REST-like web service API which implements the following services and returns JSON data:
- Query the block count.
- Query a single block and return all its transaction data.
- Query a single transaction and return all its data.
- Create a transaction from JSON data and accept it for mining.
Example of curl commands
# getting block count
curl http://127.0.0.1:8089/api/0.0/getheight
# getting 4th block
curl http://127.0.0.1:8089/api/0.0/getblock?n=4
# getting transaction Ztxrms5c5oKqb9Zof3xeC5Q2ZQjSaWv7FU4rAxe2s3sP
curl http://127.0.0.1:8089/api/0.0/gettx?txaddr=Ztxrms5c5oKqb9Zof3xeC5Q2ZQjSaWv7FU4rAxe2s3sP
# posting a transaction
cat txpool/tx.yml | sed -e "s/$/%0a/g" | curl -s -X POST http://127.0.0.1:8089/api/0.0/settx -d @-
# processing the txpool (mining)
curl http://127.0.0.1:8089/api/0.0/minepool
Security Warning
Blockchains are transparent and public so we encrypt private keys and other sensitive data, however as it is just a toy, we expose all the files for educational purpose.
** PLEASE DO NOT USE IN A PRODUCTION ENVIRONMENT **
note: sensitive data are encrypted w/ git-crypt; please send us your public key if you need access or ask for a shared DH secret
decrypt can be done with the command :
export GPG_ASKPASS=ssh-askpass
git-crypt unlock
#gpg --decrypt local.key.asc | git-crypt unlock -