Package: git3Client
GIT 3The idea behind Git3 is to combine the power of git and blockchain: Storing code in a decentralized manner and receive payments without the need of a third party.Each repository is represented by a smart contract, which stores all managing information and receives the payments, like tips or bounties for issues.The content of the repository is stored on IPFS using a data structure, very similar to git's internal objects.In order to be able to use git3, a git3 client is created, which is similar to git. This makes the switch to git3 easier.Private keyIn order to be able to use the git3 client, a private key for the Matic network is required. There are two possibilities:You generate an account in MetaMask and export the private key and create a pem fileYou use openssl in your terminal to generate a keyPrivate key using opensslIn order to generate a new private key use the following command:ssh-keygen-tecdsa-b256-mpemOnce you run the command, two files are generated. The file with the.pubextension contains the public key and the file without an extension the private key.If you want to export the key and import it in MetaMask, useopensslec-outformder-inprivate_key_file|hdThis command takes the file containing the private key, which is in the PEM format and outputs it in the DER format. Your output should look like this:00000000  30 77 02 01 01 04 20 XX  XX XX XX XX XX XX XX XX  |0w.... L.-.8&..P|
00000010  XX XX XX XX XX XX XX XX  XX XX XX XX XX XX XX XX  |.ctx.!.l...x5bXY|
00000020  XX XX XX XX XX XX XX a0  0a 06 08 2a 86 48 ce 3d  |......(....*.H.=|
...The0x20at position 6 says, that the following data is 32 bytes long and this is our generated private key, here represented as XX. Copy this key into MetaMask and you are good to go :)Better tooling is still required :)Import private key from MetaMaskI believe this steps should work.https://rchain.atlassian.net/wiki/spaces/CORE/pages/426311681/Ethereum+private+public+keys+addresses+and+PEM+certificatesGit config fileThe git3 client needs to know the author's name, email address and where to find the private key. Therefore you can use either the global.gitconfigfile or a config file stored in the repository in the.gitfolder ([repositoryName]/.git/config).GitconfigHere is how the contant of the~/.gitconfigfile looks like[user]email=authoremailname=authornameIdentityFile=pathtoprivatekeyinpemformat.Ithastobetheabsolutepath!No$HOMEorsimilarstuffinitWeb3StorageApiKey=APIKeySet the values according to your needs.
TheWeb3StorageApiKeycan be obtained fromhttps://web3.storage/. Just create an account and copy the API key from the settings page.Repository configIf you want to use a different configuration for each repository, just add aconfigfile into the.git/in your repository and add the same entries as in the~/.gitconfigfile.Git CommandsGit initTo create a new local repository, you have to callgit3 init [name]You can either provide a name for the repository or just call it without a name. In case you don't provide a name, the repository is initialized in the current directory you are in.Git get-addressIn case you want to know the Ethereum based address derived form yuor private key, use thegit3 get-addresscommand. It will derive the Ethereum address from the IdentityFile specified in the config file and show it to you.Git addTo add a file to your repository, just usegit3 add file_nameGit commitIn order to commit your current repository, just usegit3 commit -m "Message you want to add"Git pushIf you want to push your repository, just usegit3 push .In order to be able to push, a smart contract is required. If you haven't registered your repository yet, usegit3 createGit createIn order to have a remote repository, you have to register your repository. Use thegit3 createcommand. It sends a transaction to the factory contract, which deployes a new smart contract for your repository. Once this is done, you are able to push your repository.Git clonegit3 clone 0xE838bC8b2D069CE43894143836fA974643646291/newTestRepoGit fetchIn order to download the remote state, usegit3 fetch.Git mergeIf you want to merge the state after doing a fetch, just usegit3 merge. It will take the reference from the fetch.The very first mainnet repoUser address:0x0539E6a1093a359C5720d053DB5e3D277F1762B6Repository name:firstMainNetRepoLocal developmentCreate local environmentUbuntuI usedvirtualenvto create a virtual environment:virtualenv --python path/to/python/3.8 [name]Activate the virtual environment:source [name]/bin/activateInstall requirements:pip install -r requirements.txtInstall the git3 client in the virtual environment:python setup.py installorpip install .To deactivate the virtual environment, just typedeactivateMacOS Monterey V12.2Here an alternative, which worked for me:I usedvirtualenvto create a virtual environment:python3 -m virtualenv --python path/to/python/3.8 [name]Activate the virtual environment:source [name]/bin/activateInstall requirements:arch -x86_64 pip install -r requirements.txtInstall the git3 client in the virtual environment:pip install .To deactivate the virtual environment, just typedeactivateCoverage:coverage run -m pytestRead coverage report:coverage report -mTest:python -m pytest -sHow to push to PyPiIn the active virtual env, execute the following:python setup.py sdist bdist_wheelThis will create a dist folder. Once done, you can publish to Pypi using twine (pip3 install twine)twine upload dist/*- enter credentials and that's it. After that you should be able to install your package
using pip3 install [name]