diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2023-03-29 23:45:49 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2023-03-29 23:45:49 +0300 |
commit | 286b71a6ead8c7234cfbc0b8ece05c8239a4f32c (patch) | |
tree | f4662c1517fe14018d93c5503a72b8ba9da0c674 /bin/ak-transactions | |
parent | b5394a6bd9f0b9fbd9bafc3e963dafbbc87f2ed2 (diff) | |
download | arching-kaos-tools-286b71a6ead8c7234cfbc0b8ece05c8239a4f32c.tar.gz arching-kaos-tools-286b71a6ead8c7234cfbc0b8ece05c8239a4f32c.tar.bz2 arching-kaos-tools-286b71a6ead8c7234cfbc0b8ece05c8239a4f32c.zip |
Renamed everything
Diffstat (limited to 'bin/ak-transactions')
-rwxr-xr-x | bin/ak-transactions | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/ak-transactions b/bin/ak-transactions new file mode 100755 index 0000000..546082c --- /dev/null +++ b/bin/ak-transactions @@ -0,0 +1,50 @@ +#!/bin/bash +PROGRAM="$(basename $0)" +usage(){ + echo "$PROGRAM from to amount" +} + +logit(){ + logthis "<$PROGRAM>" "$1" "$2" +} + +main(){ + logit "[INFO]" "$FROM_ADDRESS to $TO_ADDRESS value sent: $AMOUNT" + cat > transaction_file <<EOF +$FROM_ADDRESS +$TO_ADDRESS +$AMOUNT +$FEE +EOF + TRANSACTION_FILE="transaction_file" + FILE_IPFS_HASH=$(ipfs add -q $TRANSACTION_FILE) + + SIGN_FILE=$TRANSACTION_FILE".asc" + gpg2 --detach-sign --sign-with $FINGERPRINT --armor --output $SIGN_FILE $TRANSACTION_FILE + + FILE_SIGNATURE=$(ipfs add -q $SIGN_FILE) + + cat > data <<EOF +{ + "timestamp":"$(date -u +%s)", + "input":"$FROM_ADDRESS", + "output":"$TO_ADDRESS", + "amount":"$AMOUNT", + "ipfs":"$FILE_IPFS_HASH", + "detach":"$FILE_SIGNATURE" +} +EOF + +} + +if [ ! -z $3 ]; +then + PWD="$(pwd)" + FROM_ADDRESS="$1" + TO_ADDRESS="$2" + AMOUNT="$3" + main + cat $PWD/data | json_pp + # sh pack_z_block.sh mixtape/add $PWD/data +else usage +fi |