From: Alviro Iskandar Setiawan <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: GNU/Weeb Mailing List <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>
Subject: [RFC PATCH v1 0/1] GNU/Weeb Financial Transaction Record Design
Date: Tue, 28 Jun 2022 06:21:38 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
Hi,
In order to keep the transaction record consistent, we can use a
chaining hash system that generates the transaction ID by using its
parent ID and the current transaction details.
For example, to create a new transaction, we have several things to note, like:
1. date
2. description
3. commiter
4. amount
[ other metadata stuff may be included ]
We can then generate the transaction id by using a hash function,
let's say SHA1:
trx_info = date . description . commiter . amount . parent_trx_id
trx_id = SHA1(info)
SAVE(trx_id, date, description, commiter, amount, parent_trx_id)
Note that since the current trx ID uses its parent trx ID to generate
itself, it makes the situation impossible to rewrite the history
without breaking the whole chain. That's the point of the consistency
in this design. We can verify that the data is consistent by just
re-hashing the transaction info together with its parent trx id.
Also note that, for the first transaction, it doesn't have a parent
trx id. So only the first transaction doesn't use a parent trx id to
generate itself. Let's call it the genesis transaction.
Please comment!
tq
-- Viro
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
Alviro Iskandar Setiawan (1):
db: Create starting DDL for saving transaction
database.sql | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 database.sql
--
Alviro Iskandar Setiawan
next reply other threads:[~2022-06-28 6:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 6:21 Alviro Iskandar Setiawan [this message]
2022-06-28 6:21 ` [RFC PATCH v1 1/1] db: Create starting DDL for saving transaction Alviro Iskandar Setiawan
2022-06-28 7:27 ` Ammar Faizi
2022-06-28 7:31 ` Alviro Iskandar Setiawan
2022-06-28 7:47 ` Ammar Faizi
2022-06-28 7:49 ` Ammar Faizi
2022-06-28 8:03 ` Alviro Iskandar Setiawan
2022-06-28 8:07 ` Ammar Faizi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220628062139.262361-1-alviro.iskandar@gnuweeb.org \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox