Twetch+Git :: Developer Notes : 8/10/19

Twetch ·

Twetch+Git :: Developer Notes : 8/10/19

Replies

Twetch ·

Git can expose each namespace as an independent repository to pull from and push to, while sharing the object store, and exposing all the refs to operations.

Twetch ·

I think I've figured out

Twetch ·

For instance, I have always wanted a unified Bitcoin repo... Namespaces can provide that.

Twetch ·

Git supports dividing the refs of a single repository into multiple namespaces, each of which has its own branches, tags, and HEAD.

Twetch ·

like where you're going here

Twetch ·

#git is an amazing tool

Twetch ·

git namespace example :: makefile : [https://bico.media/b1d62c18109da231edada09105cd4f0ab9568d885816f3139ec56107a6d24f3b]

Twetch ·

$ cd test/
> ~/de/test

Twetch ·

$ git init test
> Initialized empty Git repository in ~/de/test/.git/

Twetch ·

$ find .git/objects
> .git/objects
> .git/objects/pack
> .git/objects/info

Twetch ·

$ find .git/objects -type f
> .git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4

Twetch ·

$ echo 'test content' | git hash-object -w --stdin
> d670460b4b4aece5915caf5c68d12f560a9fe3e4

Twetch ·

[7] : find .git/objects -type f
.git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4

Twetch ·

[6] : echo 'test content' | git hash-object -w --stdin
d670460b4b4aece5915caf5c68d12f560a9fe3e4

Twetch ·

[1] : rm -rf test

[2] : git init test
Initialized empty Git repository in ~a/1565488680/test/.git/

[3] : cd test

[4] : find .git/objects
.git/objects
.git/objects/pack
.git/objects/info

[5] : find .git/objects -type f

Twetch ·

[8] : git cat-file -p d670460b4b4aece5915caf5c68d12f560a9fe3e4
test content

Twetch ·

makefile :: [https://bico.media/0894c51e51ab6804cb83f62303a9c6ee87b38ecf0d12ab61c16ddb612f30a939] : make all

Twetch ·

[20] : mkdir lib && cd lib && touch .deosnone

[21] : git add . && git commit -m "test : cat-file -p master^{tree}"
[master 9166b09] test : cat-file -p master^{tree}
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 lib/.deosnone

Twetch ·

[23] : git cat-file -p 12e716743759911458f30aa4624e9a9eae3ee817
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 .deosnone

Twetch ·

[22] : git cat-file -p master^{tree}
040000 tree 12e716743759911458f30aa4624e9a9eae3ee817 lib
100644 blob 83baae61804e65cc73a7201a7252750c76066a30 test.txt

Twetch ·

All the content is stored as tree and blob objects, with trees corresponding to UNIX directory entries and blobs corresponding more or less to inodes or file contents.

Twetch ·

[13] : find .git/objects -type f
.git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4
.git/objects/1f/7a7a472abf3dd9643fd615f6da379c4acb3e3a
.git/objects/83/baae61804e65cc73a7201a7252750c76066a30

Twetch ·

Great work

Twetch ·

[14] : rm test.txt

[15] : git cat-file -p 83baae61804e65cc73a7201a7252750c76066a30 > test.txt

[16] : cat test.txt
version 1

Twetch ·

A single tree object contains one or more entries, each of which is the SHA-1 hash of a blob or subtree with its associated mode, type, and filename.

Twetch ·

Tree Objects
The next type of Git object we’ll examine is the tree, which solves the problem of storing the filename and also allows you to store a group of files together. Git stores content in a manner similar to a UNIX filesystem, but a bit simplified.

Twetch ·

[17] : git cat-file -t 1f7a7a472abf3dd9643fd615f6da379c4acb3e3a
blob

Twetch ·

[19] : git cat-file -p master^{tree}
100644 blob 83baae61804e65cc73a7201a7252750c76066a30 test.txt

Twetch ·

[18] : git add . && git commit -m "test : cat-file -p master^{tree}"
[master (root-commit) 42b6713] test : cat-file -p master^{tree}
1 file changed, 1 insertion(+)
create mode 100644 test.txt

Twetch ·

[9] : echo 'version 1' > test.txt

[10] : git hash-object -w test.txt
83baae61804e65cc73a7201a7252750c76066a30

[11] : echo 'version 2' > test.txt

[12] : git hash-object -w test.txt
1f7a7a472abf3dd9643fd615f6da379c4acb3e3a

Twetch ·

Great thread**2! #bsvpush allows you to put a repo on BSV as metaneta nodes! I've been working on it 2: GitCHA.IN.
#GitChA.IN#(bitcoin-sv, 0.2.1) => #{
https://codeonchain.network/?tx=4bec3dc8e12fce17315084e01affd0b607fa11a857ecf7eed09caee06d74481d }#}#

Twetch ·

var blockchain = BlockGenerator<Tuple<int, System.DateTime, string>>.Generate(0x00001111, datadir: "d:\\zillionData");
blockchain.ManySelect(o => Qactive.Qbservable2.ServeQbservable(o, new QactiveTcpProviderFactory().Create())); // broadcast

Twetch ·

If you'd like use GitCha.IN, I planned on making it OSS; if you want it, it's yours, if I get to work on it too. :-)

Twetch ·

Then you can easily compose queries like:
from block in blockchain.Skip(2).Take(3)
select block;

Twetch ·

I'm working on a set of base libraries for the services needed to support a p2p software development ecosystem.

Twetch ·

Making a Block<T> and BlockGenerator<T> means blockchains are first class citizens. Next-level immutable data structures that you can use hash power to secure as much as the requirements dictate.

Twetch ·

So, if you are well into this part, I would be glad to build on it, and contribute, or, and maybe also, integrate with codeonchain.network. I thought about just forwarding to codeonchain.network as well. Not sure yet.

Twetch ·

For security and reliability and to enable purely functional programming, with purely functional data structures. This is still a work in progress. Transaction messaging is not yet completed.

Twetch ·

A Tuple<int, System.DateTime, string> to be precise, and it's generated by the BlockGenerator<T>:

Twetch ·

So, the sample above is used secure a Tuple, with it's datadirectory - providers later could map to onchain storage, or a SQL server or whatever else.

Twetch ·

Say you just want a secured, immutable string in your program.
var stringChain = BlockGenerator<string>.Generate();
stringChain.Subscribe((newStringBlock) => Console.Writeline(stringBlock)); // subscribes to Rx Observable<Block<String>> OnNext events

Twetch ·

This should easily be modified now, to define Transaction : Block<Block<T>> or Block<Blockchain<T>>.

Twetch ·

If there is an observer given, then it sends transactions to be added as a data value.
At the moment a transaction is simply represented as a string being passed into the next block, and there's only one string per block, so, only one transaction per block

Twetch ·

or Blockchain<Block<IObservable<Block<string>>>>

Twetch ·

The definition for Blockchain<T> is currently Blockchain<T> : IObservable<Block<T>>

Twetch ·

https://twetch.app/t/eaacb043b0e65c121acc7c1c1a81bfc93ce2d42e42ed09b99937dcd489a83ebd