gitchain

command module
v0.0.0-...-b149aee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

README

Gitchain (revival-attempt)

Decentralized P2P Git Network using a private blockchain.

Build Status

To quote from git's own description:

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Gitchain is an application of ideas behind Bitcoin, Namecoin and DHT applied to Git hosting. Once you install it, it acts as a local proxy to the entire Gitchain P2P network.

Support the project on Kickstarter

Build

Make sure you have atleast go1.6.3 installed

$ make prepare # (only first time or whenever Godeps file is updated)
$ make

Run

Start the server using the provided test config:

$ gitchain --config testdata/1.conf server

Usage

  1. Create keypair

    gitchain keypair-generate testkey

  2. Create repository

    • Create name reservation

      gitchain name-reservation testkey test-repo

    • Create name allocation

      gitchain name-allocation testkey test-repo <random_number_from_above_cmd>

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
A fixed merkle tree implementation Example use: package main import ( "crypto/md5" "fmt" "github.com/xsleonard/go-merkle" "io/ioutil" ) func splitData(data []byte, size int) [][]byte { // Splits data into an array of slices of len(size) count := len(data) / size blocks := make([][]byte, 0, count) for i := 0; i < count; i++ { block := data[i*size : (i+1)*size] blocks = append(blocks, block) } if len(data)%size != 0 { blocks = append(blocks, data[len(blocks)*size:]) } return blocks } func main() { // Grab some data to make the tree out of, and partition data, err := ioutil.ReadFile("testdata") // assume testdata exists if err != nil { fmt.Println(err) return } blocks := splitData(data, 32) // Create & generate the tree tree := merkle.NewTree() err = tree.Generate(blocks, md5.New()) if err != nil { fmt.Println(err) return } fmt.Printf("Height: %d\n", tree.Height()) fmt.Printf("Root: %v\n", tree.Root()) fmt.Printf("N Leaves: %v\n", len(tree.Leaves())) fmt.Printf("Height 2: %v\n", tree.GetNodesAtHeight(2)) }
A fixed merkle tree implementation Example use: package main import ( "crypto/md5" "fmt" "github.com/xsleonard/go-merkle" "io/ioutil" ) func splitData(data []byte, size int) [][]byte { // Splits data into an array of slices of len(size) count := len(data) / size blocks := make([][]byte, 0, count) for i := 0; i < count; i++ { block := data[i*size : (i+1)*size] blocks = append(blocks, block) } if len(data)%size != 0 { blocks = append(blocks, data[len(blocks)*size:]) } return blocks } func main() { // Grab some data to make the tree out of, and partition data, err := ioutil.ReadFile("testdata") // assume testdata exists if err != nil { fmt.Println(err) return } blocks := splitData(data, 32) // Create & generate the tree tree := merkle.NewTree() err = tree.Generate(blocks, md5.New()) if err != nil { fmt.Println(err) return } fmt.Printf("Height: %d\n", tree.Height()) fmt.Printf("Root: %v\n", tree.Root()) fmt.Printf("N Leaves: %v\n", len(tree.Leaves())) fmt.Printf("Height 2: %v\n", tree.GetNodesAtHeight(2)) }
api
git
net
// Block Allocation Transaction (BAT) // Name Allocation Transaction (NAT) // Name Deallocation Transaction (NDT) // Name Reservation Transaction (NRT) Reference Update Transaction (RUT)
// Block Allocation Transaction (BAT) // Name Allocation Transaction (NAT) // Name Deallocation Transaction (NDT) // Name Reservation Transaction (NRT) Reference Update Transaction (RUT)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL