Assuming a popular standard transactional database, PostGreSQL for example, you could have a checksum column and a column containing the reference to the previous row primary key. The checksum value could be computed from the previous row checksum and the new row data. You would have to insert data sequentially though, so you would probably need something in front of the database to do that sequentially, and you would probably need some trigger to fail a transaction if the another row exists with a reference to the previous row so you are sure you don't have branches in your tree. All of this would require some PL/pgSQL.