Skip to main content

de-centrailized git

Project description

De-Github

Setup

We are using Python 3.8 for development.

Install required packages by running

pip install -r requirements.txt

We are using Ganache to create a blockchain network at local environment for development and testing.

Please head to the Ganache website and download it.

Once you have installed Ganache, you can simple click on quickstart and you should be able to call degit functions.

Remember to define the RPC_SERVER environment variable, by default the value is http://127.0.0.1:7545 which is the default network of Ganache.

Also please put your private key in the .key file. Degit will automatically load the key and use it for git operations.

How to run tests

We have prepare a test.py for your convenient.

Before you run the tests, you must put in two different private key to .key and .second_user_key (you can randomly pick 2 from Ganache).

Then run:

python test.py

You should obtain a console output similar to this one:

Owner's Log:
File last modified time on Owner machine: 2022-05-08 12:25:00
Initialized Repository. State file created in current directory.
Committed files:


Staged files:

	test.txt

Commit 076bb1b40881a287b47ca56d7d17d2c54815dd36 was successful.
Contract deployed to chain, contract address: 0x7B9ef343909fD32b8Ad7c9667Dc49Dd4034e4742. 
Pushed commits "076bb1b40881a287b47ca56d7d17d2c54815dd36" to repository "test".
Whitelisted user of address: 0xbe2545A975e8A6Efd0BA5c4600aE4CfA228DA8b5
Dumped repository config to ./repo_config.pkl.

Friend's Log:
Loaded repository config from ./repo_config.pkl
Replace your repository by commit 076bb1b40881a287b47ca56d7d17d2c54815dd36
File last modified time on friend machine: 2022-05-08 12:25:07


Process finished with exit code 0

This test.py mimic two users (1 owner and 1 collaborator):

  1. The owner has written some code in test.txt
  2. The owner runs degit init test (test is the repository name)
  3. The owner runs degit add test.txt
  4. The owner runs degit commit
  5. The owner runs degit push to push test.txt to the blockchain network
  6. The owner gets his friend account address and runs degit whitelist_add_user <friend_address>
  7. The owner runs degit dump_repository_config
  8. The friend runs degit load_repository_config
  9. The friend runs degit pull
  10. The friend now has the test.txt in his machine

The printed file last modified time shows that the file is truly replaced by the one pulled from the repository.

FileStorage

At the moment we are using HKUST provided endpoint to upload file and download file.

In the future, we might deploy a smart contract ourselves as a decentralized filestorage.

Smart Contract

At the moment we have ./contracts/Repository.sol only.

This is the template repository we defined to allow user to create repository with access control.

Limited Functions

It is unfortunate that due to limited time and team members, we are unable to replicate git fully.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

degit-0.0.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

degit-0.0.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file degit-0.0.1.tar.gz.

File metadata

  • Download URL: degit-0.0.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for degit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f24c63f9d4a5a55b4da2232f93d48f41685b490cdb8a08712ea4d855d04a4eea
MD5 9a024edc842f486404e748815aed7e4e
BLAKE2b-256 cb89b49c374ec9c057eea3e953a583ce6ee3781a926e2842342144cdc56de539

See more details on using hashes here.

File details

Details for the file degit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: degit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for degit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b3c21912777529b0c88183bafe73563fe3b8b8d04d77b5926d4226a771ade07
MD5 01fb36be4da88db3f82dae5cbda2f80e
BLAKE2b-256 24a8af137c237ba97f88616d25fd7ca1807d50c65ad82c2008fab512601a3892

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page