Browse Source

library update (0d8920d) on Tue Jun 22 11:01:00 PM CEST 2021

master
Mindy C. Serl 3 years ago
committed by Brooke L. Rediker
parent
commit
01d846280e
  1. 1
      .gitattributes
  2. 2
      _data/timelog.yml
  3. 11
      config.yml
  4. 6
      genesis.yml
  5. 2
      lib
  6. 17
      notes.md
  7. BIN
      secrets/keys.yml
  8. 31
      t/cashash.t
  9. 3
      t/encode.t
  10. 7
      testing.pl

1
.gitattributes

@ -2,6 +2,7 @@
*.mbox filter=git-crypt diff=git-crypt
*.sec* filter=git-crypt diff=git-crypt
*.key* filter=git-crypt diff=git-crypt
#config.yml filter=git-crypt diff=git-crypt
secrets/** filter=git-crypt diff=git-crypt
*.asc !filter !diff
.gitattributes !filter !diff

2
_data/timelog.yml

@ -11,3 +11,5 @@
1624117500619195903: stop toptal -- /drg/toychain
1624171149798092491: start toptal -- /drg/toychain
1624219990488746675: stop toptal -- /drg/toychain
1624361700774728980: start toptal pow -- /drg/toychain
1624395286300684038: stop toptal -- /drg/toychain

11
config.yml

@ -1,10 +1,15 @@
--- # toychain's config
version: 1.01
chain: toychain
# p2p network = api+1
apis:
- 127.0.0.1:8091
- 127.0.0.2:8093
- 127.0.0.3:8095
- 127.0.0.4:8097
- 127.0.0.5:8099
# network = api+1
difficulty: 2
reward: 100
# block parameters :
bkver: 0
difficulty: 5
bkreward: 100

6
genesis.yml

@ -2,14 +2,14 @@
ver: 0
data:
seq: 0
payload: QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv
payload: /ipfs/QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv
comment: "This is the genesis block"
meta:
seed: 0xb3560762
salt: 442360558803467359 # used in address computation
salt: 442360558864191384 # used in address computation
txroot: ~
audit:
peerid: QmcfHufAK9ErQ9ZKJF7YX68KntYYBJngkGDoVKcZEJyRve
tics: 1623830817245864895
ip: 83.78.4.228
prev: ZgjNT5GbSC81KmUPncwhzQAGV3GUeAXafmkMPBw2GMHWM
prev: ZdtrjkYsAYUeBCs4DRjtVYwPevpxvHjGT2PRauANr3Vao

2
lib

@ -1 +1 @@
Subproject commit 9d739e5c4bb0b27babea7bdc441cfed6a85bb694
Subproject commit 0d8920d1f5b431c583a1a23d230b8ad0b0675c5d

17
notes.md

@ -27,8 +27,23 @@
- PoW is to slow down chainupdate to avois spam
- consensus is on the longest length
- /!\ maximal work is hackable
- /!\ maximal work is hackable (as pow is exponential to difficulties)
- sort of tx sequence can be done on node side
- block chain can store tx out of order (FIFO style)
- does mining really need to be conpetitive ?
- if mining is done by all node the recipient of txo will be willing to mine!
- if a .2% tax on transaction can replace/solve all VAT taxes
then mining rewards is "artificially" inflated to compensate for a wasteful
technology
- nano-trading is stealing (i.e. taking advantage of who has the power to be informed fast)
on need to put a "lowpass" filter on trading :
speculation is necessary for long term protection against future uncertainty...
short term predicition make no sense !
long unpredictable queue time (mempools) can deter speculator as it would be like "lotery"
lotery is a "gamified" tax extractor.

BIN
secrets/keys.yml

31
t/cashash.t

@ -0,0 +1,31 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed qw(getsalt);
seed::setseed(0x1245356);
use encode qw(decode_base58f encode_base58f);
use CAStore qw(cashash CASWrite);
printf "v16: %s\n",unpack'H*',decode_base58f('TxG4cMYVXUM4T8GdwCyauYe4UkKYWnrkFsZVxe3KRfg');
printf "v58: %s\n",encode_base58f(pack'H*','0d347435dc89c141487f8ec816d71bdc05341b52f40b53fb6bd8469885bcee57');
printf "v58: %s\n",encode_base58f(pack'H*','0d34000000000000000000000000000000000000000000000000000000000000');
printf "len: %d\n",length('TxG4cMYVXUM4T8GdwCyauYe4UkKYWnrkFsZVxe3KRfg');
my $type = 'Txi';
my $salt = &getsalt();
printf "type: %s\n",$type;
my ($addr,$pow) = cashash('SHA256','~',$salt,$type,5);
printf "addr16: f%s\n",unpack'H*',$addr;
printf "addr58: %s\n",encode_base58f($addr);
$addr = CASWrite(undef,$salt,$type,5);
printf "addr: %s\n",$addr;
exit $?;
1;

3
t/encode.t

@ -6,11 +6,12 @@ my @msg = (
'no work yet !',
'genesis nonce',
'default nonce for block address',
'CAStore nonce',
'initial nonce'
);
for my $msg (@msg) {
print "msg: $msg\n";
my $nonce = unpack 'Q',&decode_basen($msg,29);
my $nonce = unpack 'Q',&decode_basen(lc($msg),29);
printf "nonce: %s\n",$nonce;
printf "nonce16: %s\n",unpack'H*',pack('Q',$nonce);
printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29);

7
testing.pl

@ -13,7 +13,7 @@ BEGIN { print "// ToyChain !\n"; }
use lib 'lib';
use seed qw(rand64);
use misc qw(khash $ZNull);
use misc qw(khash $Zempty);
use toychain;
use encode qw(mbase58);
@ -30,6 +30,7 @@ printf "genesis: %s\n",$headhash;
print "// testing getTxMeta\n";
my $txblock = getTxMeta();
print "// testing blockCreation\n";
# createBlock(seed,payload,txblock,comment)
my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block');
@ -37,11 +38,13 @@ displayBlock($block);
print "// testing insertBlock:\n";
my $chain = &insertBlock($toychain::HEADs[0],$block);
createDot($toychain::chain);
displayChain($toychain::chain);
#$head = newBlock(1,'this is a playload',$ZNull,$head,$salt);
#$head = newBlock(1,'this is a playload',$Zempty,$head,$salt);
#printf "head: %s\n",mbase58($head);
exit $?;

Loading…
Cancel
Save