Skip to content

Git could be a decent blockchain, if you just add this small pre-receive hook.

Notifications You must be signed in to change notification settings

cederlys/git-as-a-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Git is basically a blockchain.  The only thing that is missing is the
proof-of-work bit.  We can easily add that to git using a pre-receive
hook.  This repository contains a sample pre-receive hook.

Unless you are really lucky, you might want to run something like this
instead of "git push":

    until git push origin main
    do
        sleep 1
	git commit --amend --reset-author --no-edit
    done

However, if you attempt to push multiple commits at once, you need
something more elaborate.  And if you have more than 8 commits in the
repository (after your push), and don't want to wait a very long time,
you also need something more elaborate.  This is left as an exercise
for the reader.

See githooks(1) for information on how to install this as a
pre-receive hook.

About

Git could be a decent blockchain, if you just add this small pre-receive hook.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages