Duke Leto
4 years ago
160 changed files with 582 additions and 6597 deletions
@ -1,72 +0,0 @@ |
|||
#!/bin/bash |
|||
# Copyright ? various authors too lazy to put a copyright header |
|||
# Copyright 2019 The Hush Developers |
|||
|
|||
PACKAGE_DIR="$@" |
|||
mkdir ${PACKAGE_DIR} |
|||
echo "Created ${PACKAGE_DIR}" |
|||
|
|||
binaries=("komodo-cli" "komodod") |
|||
alllibs=() |
|||
for binary in "${binaries[@]}"; |
|||
do |
|||
echo "Processing binary ${binary}" |
|||
# do the work in the destination directory |
|||
cp src/${binary} ${PACKAGE_DIR} |
|||
# find the dylibs to copy for komodod |
|||
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` |
|||
echo "copying ${DYLIBS} to ${PACKAGE_DIR}" |
|||
# copy the dylibs to the srcdir |
|||
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; done |
|||
done |
|||
|
|||
libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.dylib") |
|||
|
|||
for binary in "${libraries[@]}"; |
|||
do |
|||
echo "Processing binary ${binary}" |
|||
# find the dylibs to copy for komodod |
|||
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` |
|||
echo "copying ${DYLIBS} to ${PACKAGE_DIR}" |
|||
# copy the dylibs to the srcdir |
|||
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done |
|||
done |
|||
|
|||
indirectlibraries=("libintl.8.dylib" "libunistring.2.dylib") |
|||
|
|||
for binary in "${indirectlibraries[@]}"; |
|||
do |
|||
echo "Processing binary ${binary}" |
|||
# Need to undo this for the dylibs when we are done |
|||
chmod 755 src/${binary} |
|||
# find the dylibs to copy for komodod |
|||
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` |
|||
echo "copying indirect ${DYLIBS} to ${PACKAGE_DIR}" |
|||
# copy the dylibs to the dest dir |
|||
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done |
|||
done |
|||
|
|||
for binary in "${binaries[@]}"; |
|||
do |
|||
echo "Processing binary ${binary}" |
|||
# modify komodod to point to dylibs |
|||
echo "modifying ${binary} to use local libraries" |
|||
for dylib in "${alllibs[@]}" |
|||
do |
|||
echo "Next lib is ${dylib} " |
|||
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary} |
|||
done |
|||
chmod +x ${PACKAGE_DIR}/${binary} |
|||
done |
|||
|
|||
for binary in "${libraries[@]}"; |
|||
do |
|||
echo "Processing binary ${binary}" |
|||
# modify libraries to point to dylibs |
|||
echo "modifying ${binary} to use local libraries" |
|||
for dylib in "${alllibs[@]}" |
|||
do |
|||
echo "Next lib is ${dylib} " |
|||
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary} |
|||
done |
|||
done |
@ -1,12 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
for f in $(git diff --name-only --diff-filter=U | cat); do |
|||
echo "Resolve conflict in $f ..." |
|||
git checkout --theirs $f |
|||
done |
|||
|
|||
for f in $(git diff --name-only --diff-filter=U | cat); do |
|||
echo "Adding file $f ..." |
|||
git add $f |
|||
done |
|||
|
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=AXO $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BEER $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BET $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BNTN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BOTS $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BTCH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CCL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CEAL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CHAIN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=COQUICASH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CRYPTO $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DEX $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DION $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DSEC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=EQL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ETOMIC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=GLXT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=HODL $1 $2 $3 $4 $5 $6 |
@ -1,3 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ILN $1 $2 $3 $4 $5 $6 |
|||
|
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ILN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=JUMBLR $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=K64 $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KMDICE $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KOIN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KSB $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KV $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MESH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MGNX $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MGW $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MNZ $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MORTY $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MSHARK $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=NINJA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=OOT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=OUR $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PANGEA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PGT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PIRATE $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PIZZA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PRLPAY $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=REVS $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=RICK $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=SUPERNET $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=THC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=VOTE2018 $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=VOTE2019 $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=WLC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ZEXO $1 $2 $3 $4 $5 $6 |
@ -1,337 +0,0 @@ |
|||
[ |
|||
{ |
|||
"ac_name": "REVS", |
|||
"ac_supply": "1300000" |
|||
}, |
|||
{ |
|||
"ac_name": "SUPERNET", |
|||
"ac_supply": "816061" |
|||
}, |
|||
{ |
|||
"ac_name": "DEX", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "PANGEA", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "JUMBLR", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "BET", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "CRYPTO", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "HODL", |
|||
"ac_supply": "9999999" |
|||
}, |
|||
{ |
|||
"ac_name": "MSHARK", |
|||
"ac_supply": "1400000" |
|||
}, |
|||
{ |
|||
"ac_name": "BOTS", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "MGW", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "COQUICASH", |
|||
"ac_supply": "72000000", |
|||
"ac_reward": "7200000000", |
|||
"ac_staked": "50", |
|||
"ac_halving": "420000", |
|||
"ac_cc": "2", |
|||
"ac_ccenable": "227,235,236,241", |
|||
"addnode": [ |
|||
"78.47.108.168" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "WLC", |
|||
"ac_supply": "210000000" |
|||
}, |
|||
{ |
|||
"ac_name": "KV", |
|||
"ac_supply": "1000000" |
|||
}, |
|||
{ |
|||
"ac_name": "CEAL", |
|||
"ac_supply": "366666666" |
|||
}, |
|||
{ |
|||
"ac_name": "MESH", |
|||
"ac_supply": "1000007" |
|||
}, |
|||
{ |
|||
"ac_name": "AXO", |
|||
"ac_supply": "200000000", |
|||
"ac_ccactivate": "130000" |
|||
}, |
|||
{ |
|||
"ac_name": "ETOMIC", |
|||
"ac_supply": "100000000" |
|||
}, |
|||
{ |
|||
"ac_name": "BTCH", |
|||
"ac_supply": "20998641" |
|||
}, |
|||
{ |
|||
"ac_name": "NINJA", |
|||
"ac_supply": "100000000" |
|||
}, |
|||
{ |
|||
"ac_name": "OOT", |
|||
"ac_supply": "216000000", |
|||
"ac_sapling": "5000000" |
|||
}, |
|||
{ |
|||
"ac_name": "BNTN", |
|||
"ac_supply": "500000000" |
|||
}, |
|||
{ |
|||
"ac_name": "CHAIN", |
|||
"ac_supply": "999999" |
|||
}, |
|||
{ |
|||
"ac_name": "PRLPAY", |
|||
"ac_supply": "500000000" |
|||
}, |
|||
{ |
|||
"ac_name": "DSEC", |
|||
"ac_supply": "7000000" |
|||
}, |
|||
{ |
|||
"ac_name": "EQL", |
|||
"ac_supply": "500000000", |
|||
"ac_ccactivate": "205000" |
|||
}, |
|||
{ |
|||
"ac_name": "ZILLA", |
|||
"ac_supply": "11000000", |
|||
"ac_sapling": "5000000", |
|||
"addnode": [ |
|||
"51.68.215.104" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "RFOX", |
|||
"ac_supply": "1000000000", |
|||
"ac_reward": "100000000" |
|||
}, |
|||
{ |
|||
"ac_name": "SEC", |
|||
"ac_supply": "1000000000", |
|||
"ac_cc": "333" |
|||
}, |
|||
{ |
|||
"ac_name": "CCL", |
|||
"ac_supply": "200000000", |
|||
"ac_end": "1", |
|||
"ac_cc": "2", |
|||
"addressindex": "1", |
|||
"spentindex": "1", |
|||
"addnode": [ |
|||
"142.93.136.89", |
|||
"195.201.22.89" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "PIRATE", |
|||
"ac_supply": "0", |
|||
"ac_reward": "25600000000", |
|||
"ac_halving": "77777", |
|||
"ac_private": "1", |
|||
"addnode": [ |
|||
"136.243.102.225" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "PGT", |
|||
"ac_supply": "10000000", |
|||
"ac_end": "1", |
|||
"addnode": [ |
|||
"190.114.254.104" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "DION", |
|||
"ac_supply": "3900000000", |
|||
"ac_reward": "22260000000", |
|||
"ac_staked": "100", |
|||
"ac_cc": "1", |
|||
"ac_end": "4300000000", |
|||
"addnode": [ |
|||
"51.75.124.34" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "KMDICE", |
|||
"ac_supply": "10500000", |
|||
"ac_reward": "2500000000", |
|||
"ac_halving": "210000", |
|||
"ac_cc": "2", |
|||
"addressindex": "1", |
|||
"spentindex": "1", |
|||
"addnode": [ |
|||
"144.76.217.232" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "KSB", |
|||
"ac_supply": "1000000000", |
|||
"ac_end": "1", |
|||
"ac_public": "1", |
|||
"addnode": [ |
|||
"37.187.225.231" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "OUR", |
|||
"ac_reward": "1478310502", |
|||
"ac_halving": "525600", |
|||
"ac_cc": "42", |
|||
"ac_supply": "100000000", |
|||
"ac_perc": "77700", |
|||
"ac_staked": "93", |
|||
"ac_pubkey": "02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c", |
|||
"ac_public": "1", |
|||
"addnode": [ |
|||
"51.255.195.65", |
|||
"217.182.129.38", |
|||
"37.187.225.231" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "ILN", |
|||
"ac_supply": "10000000000", |
|||
"ac_cc": "2", |
|||
"addnode": ["51.75.122.83"] |
|||
}, |
|||
{ |
|||
"ac_name": "RICK", |
|||
"ac_supply": "90000000000", |
|||
"ac_reward": "100000000", |
|||
"ac_cc": "3", |
|||
"ac_staked": "10", |
|||
"addnode": [ |
|||
"138.201.136.145", |
|||
"95.217.44.58" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "MORTY", |
|||
"ac_supply": "90000000000", |
|||
"ac_reward": "100000000", |
|||
"ac_cc": "3", |
|||
"ac_staked": "10", |
|||
"addnode": [ |
|||
"138.201.136.145", |
|||
"95.217.44.58" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "KOIN", |
|||
"ac_supply": "125000000", |
|||
"addnode": ["3.0.32.10"] |
|||
}, |
|||
{ |
|||
"ac_name": "ZEXO", |
|||
"ac_reward": "1478310502", |
|||
"ac_halving": "525600", |
|||
"ac_cc": "42", |
|||
"ac_ccenable": "236", |
|||
"ac_supply": "100000000", |
|||
"ac_perc": "77700", |
|||
"ac_staked": "93", |
|||
"ac_pubkey": "02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc", |
|||
"ac_public": "1", |
|||
"addnode": [ |
|||
"195.201.20.230", |
|||
"80.240.17.222" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "K64", |
|||
"ac_reward": "0", |
|||
"ac_supply": "64000777", |
|||
"ac_staked": "10", |
|||
"addnode": ["18.197.20.21"] |
|||
}, |
|||
{ |
|||
"ac_name": "HUSH3", |
|||
"ac_sapling": "1", |
|||
"ac_founders": "1", |
|||
"ac_reward": "0,1125000000,562500000", |
|||
"ac_end": "128,340000,5422111", |
|||
"ac_blocktime": "150", |
|||
"ac_supply": "6178674", |
|||
"ac_halving": "129,340000,840000", |
|||
"ac_cc": "2", |
|||
"ac_cclib": "hush3", |
|||
"ac_ccenable": "228,234,235,236,241", |
|||
"ac_perc": "11111111", |
|||
"ac_eras": "3", |
|||
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac", |
|||
"clientname": "GoldenSandtrout", |
|||
"addnode": [ |
|||
"188.165.212.101", |
|||
"136.243.227.142", |
|||
"5.9.224.250" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "THC", |
|||
"ac_supply": "251253103", |
|||
"ac_reward": "360000000,300000000,240000000,180000000,150000000,90000000,0", |
|||
"ac_staked": "100", |
|||
"ac_eras": "7", |
|||
"ac_end": "500001,1000001,1500001,2000001,2500001,4500001,0", |
|||
"ac_perc": "233333333", |
|||
"ac_cc": "2", |
|||
"ac_ccenable": "229,236,240", |
|||
"ac_script": "2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8", |
|||
"ac_founders": "150", |
|||
"ac_cbmaturity": "1", |
|||
"ac_sapling": "1", |
|||
"earlytxid": "7e4a76259e99c9379551389e9f757fc5f46c33ae922a8644dc2b187af2a6adc1", |
|||
"addnode": [ |
|||
"157.230.45.184", |
|||
"165.22.52.123" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "COMMOD", |
|||
"ac_supply": "0", |
|||
"ac_reward": "204800000000,100000000", |
|||
"ac_end": "482130,0", |
|||
"ac_halving": "43830,525960", |
|||
"ac_decay": "50000000,10000000", |
|||
"ac_eras": "2", |
|||
"ac_cc": "777", |
|||
"ac_public": "1", |
|||
"addnode": [ |
|||
"34.246.186.176", |
|||
"34.251.151.148" |
|||
] |
|||
}, |
|||
{ |
|||
"ac_name": "WLC21", |
|||
"ac_supply": "21000000", |
|||
"ac_reward": "190258751", |
|||
"ac_staked": "90", |
|||
"ac_public": "1", |
|||
"addnode": [ |
|||
"37.187.225.231", |
|||
"51.38.38.134" |
|||
] |
|||
} |
|||
] |
@ -1,55 +0,0 @@ |
|||
#!/bin/bash |
|||
set -x |
|||
delay=60 |
|||
source pubkey.txt |
|||
echo $pubkey |
|||
|
|||
./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=COQUICASH -ac_supply=72000000 -ac_reward=7200000000 -ac_staked=50 -ac_halving=420000 -ac_cc=2 -ac_ccenable=227,235,236,241 -addnode=78.47.108.168 & |
|||
./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=95.213.238.98 $1 & |
|||
./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -ac_ccactivate=130000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=95.213.238.98 & |
|||
#./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=95.213.238.98 & |
|||
#./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=NINJA -ac_supply=100000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_sapling=5000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=BNTN -ac_supply=500000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=CHAIN -ac_supply=999999 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=PRLPAY -ac_supply=500000000 -addnode=13.250.226.125 & |
|||
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 & |
|||
#./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 & |
|||
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 & |
|||
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -ac_sapling=5000000 -addnode=51.68.215.104 & |
|||
./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 & |
|||
./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 & |
|||
./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=178.63.77.56 & |
|||
#./komodod -pubkey=$pubkey -ac_name=MGNX -ac_supply=12465003 -ac_staked=90 -ac_reward=2000000000 -ac_halving=525960 -ac_cc=2 -ac_end=2629800 -addnode=142.93.27.180 & |
|||
./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 & |
|||
./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 & |
|||
./komodod -pubkey=$pubkey -ac_name=DION -ac_supply=3900000000 -ac_reward=22260000000 -ac_staked=100 -ac_cc=1 -ac_end=4300000000 -addnode=51.75.124.34 & |
|||
./komodod -pubkey=$pubkey -ac_name=KSB -ac_supply=1000000000 -ac_end=1 -ac_public=1 -addnode=37.187.225.231 & |
|||
./komodod -pubkey=$pubkey -ac_name=OUR -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_supply=100000000 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c -ac_public=1 -addnode=51.255.195.65 -addnode=217.182.129.38 -addnode=37.187.225.231 & |
|||
./komodod -pubkey=$pubkey -ac_name=ILN -ac_supply=10000000000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=51.75.122.83 & |
|||
./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & |
|||
./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & |
|||
./komodod -pubkey=$pubkey -ac_name=VOTE2019 -ac_supply=123651638 -ac_public=1 -addnode=95.213.238.98 & |
|||
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 & |
|||
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 & |
|||
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 & |
|||
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac & |
|||
./komodod -pubkey=$pubkey -ac_name=THC -ac_supply=251253103 -ac_reward=360000000,300000000,240000000,180000000,150000000,90000000,0 -ac_staked=100 -ac_eras=7 -ac_end=500001,1000001,1500001,2000001,2500001,4500001,0 -ac_perc=233333333 -ac_cc=2 -ac_ccenable=229,236,240 -ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8 -ac_founders=150 -ac_cbmaturity=1 -ac_sapling=1 -addnode=157.230.45.184 -addnode=165.22.52.123 -earlytxid=7e4a76259e99c9379551389e9f757fc5f46c33ae922a8644dc2b187af2a6adc1 & |
@ -1,16 +1,17 @@ |
|||
# Copyright 2020 The Hush Developers
|
|||
# just type make to compile all dapps
|
|||
all: zmigrate oraclefeed |
|||
# Just type make to compile all dat dapp code, fellow cypherpunk
|
|||
|
|||
subatomic: |
|||
$(CC) subatomic.c -o subatomic -lm |
|||
# we no longer build zmigrate by default, nobody uses that fucking code
|
|||
all: hushdex |
|||
|
|||
hushdex: |
|||
$(CC) hushdex.c -o hushdex -lm |
|||
|
|||
# Just for historical knowledge, to study how fucking stupid
|
|||
# ZEC+KMD were to still support sprout, to this day!!!!!!!!
|
|||
zmigrate: |
|||
$(CC) zmigrate.c -o zmigrate -lm |
|||
|
|||
oraclefeed: |
|||
$(CC) oraclefeed.c -o oraclefeed -lm |
|||
|
|||
clean: |
|||
rm zmigrate oraclefeed |
|||
rm zmigrate |
|||
|
|||
|
@ -0,0 +1,19 @@ |
|||
{ |
|||
"authorized": [ |
|||
{"dukeleto":"030554bffcf6dfcb34a20c486ff0a5be5546b9cc16fba969216527263f8e98c4af" }, |
|||
{"gilardh":"020554bffcf6dfcb34a20c486ff5a5be5546b9cc06fba9692165272b3f8e98c448" }, |
|||
{"nhdigitalcash":"030554bffcf6dfcb34a20c086ff5a5be5546b9cc16fba9692105272b3f8e98c4a0" }, |
|||
{"miodrag":"02b25de3ee5335518b06f69f4fbabb029cfc737603b100996841d5532b324a5a61" } |
|||
], |
|||
"tokens":[ |
|||
], |
|||
"files":[ |
|||
{"filename":"hushd","prices":[{"HUSH":0.1}, {"ZEC":1}]} |
|||
], |
|||
"externalcoins":[ |
|||
{ "BTC":"bitcoin-cli" }, |
|||
{ "HUSH":"hush-cli" }, |
|||
{ "ZEC":"zcash-cli" } |
|||
] |
|||
} |
|||
|
File diff suppressed because it is too large
@ -1,27 +0,0 @@ |
|||
{ |
|||
"authorized": [ |
|||
{"chmex":"030754bffcf6dfcb34a20c486ff5a5be5546b9cc16fba9692165272b3f8e98c4af" }, |
|||
{"SHossain":"03c8657bd57b6ceb14514a10e99fe8a0cec5a9bc24592df7f66f050e670e4f6bac" }, |
|||
{"satinder":"03732f8ef851ff234c74d0df575c2c5b159e2bab3faca4ec52b3f217d5cda5361d" }, |
|||
{"ml777":"02453d028c74cb9551e1aaf35113383b6ecbd9f06ff23a4ab1a953429b9763e345" }, |
|||
{"tonylhub":"0218e0f435d4544404c25a7759b7f7174d821215085ef936218c5569d975af468b" }, |
|||
{"gthub":"036c7de9a5090fbad78b9eea41549ccacc07bd0e9e7f8d290c88f470f3569e1a35" }, |
|||
{"zkTrader":"026c6b0b35ec0adc2f8a5c648da1fce634f798c69d5e9fe518400447e88398b830" }, |
|||
{"nutellalicka":"03aee08860e0340f0f490a3ef3718d6676882f2d63d4f536dfebb1d348b82c79ee" }, |
|||
{"gcharang":"02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567" }, |
|||
{"jl777":"02b27de3ee5335518b06f69f4fbabb029cfc737613b100996841d5532b324a5a61" } |
|||
], |
|||
"tokens":[ |
|||
{"RICK.demo":"2b1feef719ecb526b07416dd432bce603ac6dc8bfe794cddf105cb52f6aae3cd"} |
|||
], |
|||
"files":[ |
|||
{"filename":"hushd","prices":[{"HUSH":0.1}, {"PIRATE":1}]} |
|||
], |
|||
"externalcoins":[ |
|||
{ "BTC":"bitcoin-cli" }, |
|||
{ "KMD":"komodod-cli" }, |
|||
{ "CHIPS":"chips-cli" }, |
|||
{ "PIRATE":"pirate-cli" } |
|||
] |
|||
} |
|||
|
@ -1,9 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
args="$@" |
|||
komodo_cli='./komodo-cli' |
|||
|
|||
./listassetchains | while read chain; do |
|||
echo $chain |
|||
$komodo_cli --ac_name=$chain $args |
|||
done |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=AXO $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BEER $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BET $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BNTN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BOTS $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=BTCH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CCL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CEAL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CHAIN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=COQUICASH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=CRYPTO $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DEX $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DION $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=DSEC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=EQL $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ETOMIC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=GLXT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=HODL $1 $2 $3 $4 $5 $6 |
@ -1,3 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ILN $1 $2 $3 $4 $5 $6 |
|||
|
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ILN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=JUMBLR $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=K64 $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KMDICE $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KOIN $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KSB $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=KV $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MESH $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MGNX $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MGW $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MNZ $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MORTY $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MSHARK $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=NINJA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=OOT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=OUR $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PANGEA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PGT $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PIRATE $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PIZZA $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=PRLPAY $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=REVS $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=RFOX $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=RICK $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=SEC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=SUPERNET $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=THC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=WLC $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ZEXO $1 $2 $3 $4 $5 $6 |
@ -1,2 +0,0 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=ZILLA $1 $2 $3 $4 $5 $6 |
@ -1,27 +0,0 @@ |
|||
About |
|||
----- |
|||
Komodo SudokuCC GUI |
|||
|
|||
Just solve Sudoku and earn SUDOKU coins! |
|||
|
|||
![alt text](https://i.imgur.com/std99XW.png) |
|||
|
|||
To run you need up and running SUDOKU chain daemon built from latest https://github.com/jl777/komodo/tree/FSM and started with valid for your wallet pubkey in `-pubkey=` param. |
|||
|
|||
SUDOKU chain params: |
|||
```./komodod -ac_name=SUDOKU -ac_supply=1000000 -pubkey=<yourpubkey> -addnode=5.9.102.210 -gen -genproclimit=1 -ac_cclib=sudoku -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60000 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc &``` |
|||
|
|||
1) install dependencies: |
|||
|
|||
``` |
|||
$ sudo apt-get install python-pygame libgnutls28-dev |
|||
$ pip install requests wheel slick-bitcoinrpc pygame |
|||
``` |
|||
|
|||
2) and then start: |
|||
|
|||
``` |
|||
$ git clone https://github.com/tonymorony/Komodoku |
|||
$ cd Komodoku |
|||
$ python Sudoku.py |
|||
``` |
Binary file not shown.
@ -1,362 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
|
|||
# Copyright (C) 2010 Paul Bourke <pauldbourke@gmail.com> |
|||
# Copyright (C) 2019 Anton Lysakov <tlysakov@gmail.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation, either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
import pygame |
|||
import sys |
|||
import random |
|||
import sudoku_kmdlib |
|||
import time |
|||
|
|||
class PyGameBoard(): |
|||
"""Represents the game's frontend using pygame""" |
|||
|
|||
def __init__(self, engine, windowSize, gridValues, timestampValues): |
|||
pygame.init() |
|||
pygame.display.set_caption('Sudoku') |
|||
self.__engine = engine |
|||
self.__gridValues = gridValues |
|||
self.__timestampValues = timestampValues |
|||
self.__screen = pygame.display.set_mode(windowSize) |
|||
background = pygame.image.load(sys.path[0] + '/background.png').convert() |
|||
board = pygame.image.load(sys.path[0] + '/board.png') |
|||
boardX = boardY = 10 |
|||
self.__screen.blit(background, (0, 0)) |
|||
self.__screen.blit(board, (boardX, boardY)) |
|||
self.__tiles = self.__createTiles(boardX, boardY) |
|||
self.__drawUI() |
|||
self.__draw() |
|||
|
|||
def __draw(self): |
|||
"""Handles events and updates display buffer""" |
|||
while True: |
|||
for event in pygame.event.get(): |
|||
if event.type == pygame.QUIT: |
|||
sys.exit() |
|||
elif event.type == pygame.MOUSEBUTTONUP and event.button == 1: |
|||
self.__handleMouse(event.pos) |
|||
elif (event.type == pygame.KEYUP): |
|||
self.__handleKeyboard(event.key) |
|||
pygame.display.flip() |
|||
|
|||
def __drawUI(self): |
|||
'''Draws the text buttons along the right panel''' |
|||
font = pygame.font.Font(sys.path[0] + '/Roboto-Light.ttf', 28) |
|||
font.set_underline(True) |
|||
self.__titleText = font.render('Sudoku', 1, (0, 0, 0)) |
|||
self.__titleTextRect = self.__titleText.get_rect() |
|||
self.__titleTextRect.centerx = 445 |
|||
self.__titleTextRect.centery = 30 |
|||
self.__screen.blit(self.__titleText, self.__titleTextRect) |
|||
|
|||
font = pygame.font.Font(sys.path[0] + '/Roboto-Light.ttf', 14) |
|||
self.__titleText = font.render('TonyL 2019', 1, (0, 0, 0)) |
|||
self.__titleTextRect = self.__titleText.get_rect() |
|||
self.__titleTextRect.centerx = 445 |
|||
self.__titleTextRect.centery = 55 |
|||
self.__screen.blit(self.__titleText, self.__titleTextRect) |
|||
|
|||
font = pygame.font.Font(sys.path[0] + '/Roboto-Light.ttf', 24) |
|||
self.__newGameText = font.render('-New Game-', 1, (0, 0, 0)) |
|||
self.__newGameTextRect = self.__newGameText.get_rect() |
|||
self.__newGameTextRect.centerx = 495 |
|||
self.__newGameTextRect.centery = 180 |
|||
self.__screen.blit(self.__newGameText, self.__newGameTextRect) |
|||
|
|||
self.__solveText = font.render('-Check Balance-', 1, (0, 0, 0)) |
|||
self.__solveTextRect = self.__solveText.get_rect() |
|||
self.__solveTextRect.centerx = 495 |
|||
self.__solveTextRect.centery = 220 |
|||
self.__screen.blit(self.__solveText, self.__solveTextRect) |
|||
|
|||
font = pygame.font.Font(sys.path[0] + '/Roboto-Light.ttf', 24) |
|||
self.__checkText = font.render('-Check Solution-', 1, (0, 0, 0)) |
|||
self.__checkTextRect = self.__checkText.get_rect() |
|||
self.__checkTextRect.centerx = 495 |
|||
self.__checkTextRect.centery = 260 |
|||
self.__screen.blit(self.__checkText, self.__checkTextRect) |
|||
|
|||
def __handleKeyboard(self, key): |
|||
"""Get key pressed and update the game board""" |
|||
validKeys = {pygame.K_0: "0", pygame.K_1: "1", pygame.K_2: "2", |
|||
pygame.K_3: "3", pygame.K_4: "4", pygame.K_5: "5", |
|||
pygame.K_6: "6", pygame.K_7: "7", pygame.K_8: "8", |
|||
pygame.K_9: "9", pygame.K_BACKSPACE: "", pygame.K_DELETE: ""} |
|||
if key == pygame.K_ESCAPE: |
|||
sys.exit() |
|||
elif key in validKeys: |
|||
i = self.__currentTile.getGridLoc()[0] |
|||
j = self.__currentTile.getGridLoc()[1] |
|||
cell_num = 9 * i + (j + 1) |
|||
self.__currentTile.setFontColor(pygame.color.THECOLORS['blue']) |
|||
self.__currentTile.updateValue(validKeys[key]) |
|||
self.__gridValues[i][j] = self.__currentTile.getValue() |
|||
self.__timestampValues[cell_num] = int(round(time.time())) |
|||
|
|||
def __handleMouse(self, (x, y)): |
|||
for row in self.__tiles: |
|||
for tile in row: |
|||
if tile.getRect().collidepoint(x, y): |
|||
if not tile.isReadOnly(): |
|||
tile.highlight(pygame.color.THECOLORS['lightyellow']) |
|||
if self.__currentTile.isCorrect(): |
|||
self.__currentTile.unhighlight() |
|||
else: |
|||
self.__currentTile.highlight((255, 164, 164)) |
|||
self.__currentTile = tile |
|||
if self.__newGameTextRect.collidepoint(x, y): |
|||
self.__engine.startNewGame() |
|||
elif self.__solveTextRect.collidepoint(x, y): |
|||
self.__engine.getSolution() |
|||
elif self.__checkTextRect.collidepoint(x, y): |
|||
ret = self.__engine.checkSolution(self.__gridValues, self.__timestampValues) |
|||
|
|||
def __updateBoard(self, gridValues): |
|||
for i in range(9): |
|||
for j in range(9): |
|||
self.__tiles[i][j].updateValue(gridValues[i][j]) |
|||
|
|||
def __unhightlightBoard(self): |
|||
for i in range(9): |
|||
for j in range(9): |
|||
self.__tiles[i][j].unhighlight() |
|||
|
|||
def __createTiles(self, initX=0, initY=0): |
|||
"""Set up a list of tiles corresponding to the grid, along with |
|||
each ones location coordinates on the board""" |
|||
square_size = 40 |
|||
tiles = list() |
|||
x = y = 0 |
|||
for i in range(0, 9): |
|||
row = list() |
|||
for j in range(0, 9): |
|||
if j in (0, 1, 2): |
|||
x = (j * 41) + (initX + 2) |
|||
if j in (3, 4, 5): |
|||
x = (j * 41) + (initX + 6) |
|||
if j in (6, 7, 8): |
|||
x = (j * 41) + (initX + 10) |
|||
if i in (0, 1, 2): |
|||
y = (i * 41) + (initY + 2) |
|||
if i in (3, 4, 5): |
|||
y = (i * 41) + (initY + 6) |
|||
if i in (6, 7, 8): |
|||
y = (i * 41) + (initY + 10) |
|||
tile = Tile(self.__gridValues[i][j], (x, y), (i, j), square_size) |
|||
row.append(tile) |
|||
tiles.append(row) |
|||
self.__currentTile = tiles[0][0] |
|||
return tiles |
|||
|
|||
|
|||
class Tile(): |
|||
"""Represents a graphical tile on the board""" |
|||
|
|||
def __init__(self, value, coords, gridLoc, size): |
|||
xpos = coords[0] |
|||
ypos = coords[1] |
|||
self.__fontColor = pygame.color.THECOLORS["black"] |
|||
self.__readOnly = False |
|||
self.__colorSquare = pygame.Surface((size, size)).convert() |
|||
self.__colorSquare.fill(pygame.color.THECOLORS['white'], None, pygame.BLEND_RGB_ADD) |
|||
self.__colorSquareRect = self.__colorSquare.get_rect() |
|||
self.__colorSquareRect = self.__colorSquareRect.move(xpos + 1, ypos + 1) |
|||
self.__value = value |
|||
self.__gridLoc = gridLoc |
|||
self.__screen = pygame.display.get_surface() |
|||
self.__rect = pygame.Rect(xpos, ypos, size, size) |
|||
self.__isCorrect = True |
|||
if self.__value is not '-': |
|||
self.__readOnly = True |
|||
self.__draw() |
|||
|
|||
def updateValue(self, value): |
|||
self.__value = value |
|||
self.__draw() |
|||
|
|||
def isCorrect(self): |
|||
return self.__isCorrect |
|||
|
|||
def setCorrect(self, isCorrect): |
|||
self.__isCorrect = isCorrect |
|||
|
|||
def setFontColor(self, fontColor): |
|||
self.__fontColor = fontColor |
|||
|
|||
def getValue(self): |
|||
return self.__value |
|||
|
|||
def getRect(self): |
|||
return self.__rect |
|||
|
|||
def getGridLoc(self): |
|||
return self.__gridLoc |
|||
|
|||
def isReadOnly(self): |
|||
return self.__readOnly |
|||
|
|||
def highlight(self, color): |
|||
if self.__readOnly is True: |
|||
return |
|||
self.__colorSquare.fill(color) |
|||
self.__draw() |
|||
|
|||
def unhighlight(self): |
|||
self.__colorSquare.fill((255, 225, 255), None, pygame.BLEND_RGB_ADD) |
|||
self.__draw() |
|||
|
|||
def __draw(self): |
|||
value = self.__value |
|||
if self.__value == '-': |
|||
value = '' |
|||
font = pygame.font.Font(sys.path[0] + '/Roboto-Light.ttf', 24) |
|||
text = font.render(str(value), 1, self.__fontColor) |
|||
textpos = text.get_rect() |
|||
textpos.centerx = self.__rect.centerx |
|||
textpos.centery = self.__rect.centery |
|||
self.__screen.blit(self.__colorSquare, self.__colorSquareRect) |
|||
self.__screen.blit(text, textpos) |
|||
|
|||
|
|||
class Sudoku: |
|||
"""Represents the game's backend and logic""" |
|||
|
|||
def __init__(self, puzzleFile, rpc_connection): |
|||
self.__puzzleFile = puzzleFile |
|||
self.__rpc_connection = rpc_connection |
|||
self.startNewGame() |
|||
|
|||
def startNewGame(self): |
|||
self.__linePuzzle = self.__loadPuzzle(self.__puzzleFile) |
|||
gridValues = self.lineToGrid(self.__linePuzzle) |
|||
# prefill 0 timestamps for already known numbers |
|||
timestampValues = self.prefill_timestamps(gridValues) |
|||
board = PyGameBoard(self, (600, 400), gridValues, timestampValues) |
|||
board.setValues(gridValues) |
|||
|
|||
def __loadPuzzle(self, listName): |
|||
self.__chosen_puzzle = random.choice(listName) |
|||
puzzle = self.__rpc_connection.cclib("txidinfo", "17", '"%22' + self.__chosen_puzzle + '%22"')["unsolved"] |
|||
print "Puzzle ID: " + self.__chosen_puzzle |
|||
print "Reward amount: " + str(self.__rpc_connection.cclib("txidinfo", "17", '"%22' + self.__chosen_puzzle + '%22"')["amount"]) |
|||
ret = [] |
|||
linePuzzle = str(puzzle) |
|||
for i in linePuzzle: |
|||
ret.append(i) |
|||
return ret |
|||
|
|||
def gridToLine(self, grid): |
|||
linePuzzle = '' |
|||
for i in range(9): |
|||
for j in range(9): |
|||
linePuzzle += grid[i][j] |
|||
return linePuzzle |
|||
|
|||
def lineToGrid(self, linePuzzle): |
|||
assert (len(linePuzzle) == 81) |
|||
grid = [] |
|||
for i in xrange(0, 81, 9): |
|||
grid.append(linePuzzle[i:i + 9]) |
|||
return grid |
|||
|
|||
def getSolution(self): |
|||
balance = self.__rpc_connection.cclibaddress("17")["mybalance"] |
|||
print "Your balance: " + str(balance) |
|||
|
|||
def __solve(self, linePuzzle): |
|||
linePuzzle = ''.join(linePuzzle) |
|||
i = linePuzzle.find('-') |
|||
if i == -1: |
|||
return linePuzzle |
|||
|
|||
excluded_numbers = set() |
|||
for j in range(81): |
|||
if self.sameRow(i, j) or self.sameCol(i, j) or self.sameBlock(i, j): |
|||
excluded_numbers.add(linePuzzle[j]) |
|||
|
|||
for m in '123456789': |
|||
if m not in excluded_numbers: |
|||
funcRet = self.__solve(linePuzzle[:i] + m + linePuzzle[i + 1:]) |
|||
if funcRet is not None: |
|||
return funcRet |
|||
|
|||
def prefill_timestamps(self, grid): |
|||
timestamps = {} |
|||
for i in range(9): |
|||
for j in range(9): |
|||
if grid[i][j] != '-': |
|||
cell_num = 9 * i + ( j + 1 ) |
|||
timestamps[cell_num] = 0 |
|||
return timestamps |
|||
|
|||
def sameRow(self, i, j): |
|||
return (i / 9 == j / 9) |
|||
|
|||
def sameCol(self, i, j): |
|||
return (i - j) % 9 == 0 |
|||
|
|||
def sameBlock(self, i, j): |
|||
return (i / 27 == j / 27 and i % 9 / 3 == j % 9 / 3) |
|||
|
|||
def checkSolution(self, attemptGrid, timestampValues): |
|||
# [%22<txid>%22,%22<solution>%22,t0,t1,t2,...] |
|||
attemptLine = self.gridToLine(attemptGrid) |
|||
|
|||
#print attemptLine |
|||
#print timestampValues |
|||
timestampsline = "" |
|||
for timestamp in timestampValues.values(): |
|||
timestampsline += "," |
|||
timestampsline += str(timestamp) |
|||
arg_line = "[%22"+self.__chosen_puzzle+"%22,%22"+attemptLine+"%22"+timestampsline+"]" |
|||
print arg_line |
|||
try: |
|||
solution_info = self.__rpc_connection.cclib("solution", "17", '"' + arg_line + '"') |
|||
print solution_info |
|||
solution_txid = self.__rpc_connection.sendrawtransaction(solution_info["hex"]) |
|||
print "Solution accepted!" |
|||
print solution_txid |
|||
except Exception as e: |
|||
print(e) |
|||
print(solution_info) |
|||
solution_txid = 'error' |
|||
return solution_txid |
|||
|
|||
def main(): |
|||
while True: |
|||
# Assetchain hardcoded here |
|||
chain = 'SUDOKU' |
|||
try: |
|||
print 'Welcome to the Komodo SudokuCC' |
|||
rpc_connection = sudoku_kmdlib.def_credentials(chain) |
|||
pending_puzzles = rpc_connection.cclib("pending", "17")["pending"] |
|||
puzzle_list = [] |
|||
for puzzle in pending_puzzles: |
|||
puzzle_list.append(puzzle["txid"]) |
|||
|
|||
except Exception as e: |
|||
#print rpc_connection |
|||
print e |
|||
print 'Cant connect to SUDOKU Daemon! Please re-check if it up' |
|||
sys.exit() |
|||
else: |
|||
print 'Succesfully connected!\n' |
|||
break |
|||
newGame = Sudoku(puzzle_list, rpc_connection) |
|||
|
|||
if __name__ == '__main__': |
|||
main() |
Before Width: | Height: | Size: 301 KiB |
Before Width: | Height: | Size: 5.5 KiB |
@ -1,41 +0,0 @@ |
|||
import platform |
|||
import os |
|||
import re |
|||
import random |
|||
from slickrpc import Proxy |
|||
|
|||
|
|||
# define function that fetchs rpc creds from .conf |
|||
def def_credentials(chain): |
|||
rpcport =''; |
|||
operating_system = platform.system() |
|||
if operating_system == 'Darwin': |
|||
ac_dir = os.environ['HOME'] + '/Library/Application Support/Komodo' |
|||
elif operating_system == 'Linux': |
|||
ac_dir = os.environ['HOME'] + '/.komodo' |
|||
elif operating_system == 'Windows': |
|||
ac_dir = '%s/komodo/' % os.environ['APPDATA'] |
|||
if chain == 'KMD': |
|||
coin_config_file = str(ac_dir + '/komodo.conf') |
|||
else: |
|||
coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf') |
|||
with open(coin_config_file, 'r') as f: |
|||
for line in f: |
|||
l = line.rstrip() |
|||
if re.search('rpcuser', l): |
|||
rpcuser = l.replace('rpcuser=', '') |
|||
elif re.search('rpcpassword', l): |
|||
rpcpassword = l.replace('rpcpassword=', '') |
|||
elif re.search('rpcport', l): |
|||
rpcport = l.replace('rpcport=', '') |
|||
if len(rpcport) == 0: |
|||
if chain == 'KMD': |
|||
rpcport = 7771 |
|||
else: |
|||
print("rpcport not in conf file, exiting") |
|||
print("check "+coin_config_file) |
|||
exit(1) |
|||
|
|||
return(Proxy("http://%s:%s@127.0.0.1:%d"%(rpcuser, rpcpassword, int(rpcport)))) |
|||
|
|||
|
@ -1,795 +0,0 @@ |
|||
/******************************************************************************
|
|||
* Copyright © 2014-2019 The SuperNET Developers. * |
|||
* * |
|||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * |
|||
* the top-level directory of this distribution for the individual copyright * |
|||
* holder information and the developer policies on copyright and licensing. * |
|||
* * |
|||
* Unless otherwise agreed in a custom licensing agreement, no part of the * |
|||
* SuperNET software, including this file may be copied, modified, propagated * |
|||
* or distributed except according to the terms contained in the LICENSE file * |
|||
* * |
|||
* Removal or modification of this copyright notice is prohibited. * |
|||
* * |
|||
******************************************************************************/ |
|||
|
|||
/*
|
|||
z_exportkey "zaddr" |
|||
z_exportwallet "filename" |
|||
z_getoperationstatus (["operationid", ... ]) |
|||
z_gettotalbalance ( minconf ) |
|||
z_importkey "zkey" ( rescan ) |
|||
z_importwallet "filename" |
|||
z_listaddresses |
|||
z_sendmany "fromaddress" [{"address":... ,"amount":..., "memo":"<hex>"},...] ( minconf ) ( fee ) |
|||
*/ |
|||
|
|||
#ifdef _WIN32 |
|||
#include <wincrypt.h> |
|||
#endif |
|||
#include "komodo_defs.h" |
|||
|
|||
#define JUMBLR_ADDR "RGhxXpXSSBTBm9EvNsXnTQczthMCxHX91t" |
|||
#define JUMBLR_BTCADDR "18RmTJe9qMech8siuhYfMtHo8RtcN1obC6" |
|||
#define JUMBLR_MAXSECRETADDRS 777 |
|||
#define JUMBLR_SYNCHRONIZED_BLOCKS 10 |
|||
#define JUMBLR_INCR 9.965 |
|||
#define JUMBLR_FEE 0.001 |
|||
#define JUMBLR_TXFEE 0.01 |
|||
#define SMALLVAL 0.000000000000001 |
|||
|
|||
#define JUMBLR_ERROR_DUPLICATEDEPOSIT -1 |
|||
#define JUMBLR_ERROR_SECRETCANTBEDEPOSIT -2 |
|||
#define JUMBLR_ERROR_TOOMANYSECRETS -3 |
|||
#define JUMBLR_ERROR_NOTINWALLET -4 |
|||
|
|||
struct jumblr_item |
|||
{ |
|||
UT_hash_handle hh; |
|||
int64_t amount,fee,txfee; // fee and txfee not really used (yet)
|
|||
uint32_t spent,pad; |
|||
char opid[66],src[128],dest[128],status; |
|||
} *Jumblrs; |
|||
|
|||
char Jumblr_secretaddrs[JUMBLR_MAXSECRETADDRS][64],Jumblr_deposit[64]; |
|||
int32_t Jumblr_numsecretaddrs; // if 0 -> run silent mode
|
|||
|
|||
char *jumblr_issuemethod(char *userpass,char *method,char *params,uint16_t port) |
|||
{ |
|||
cJSON *retjson,*resjson = 0; char *retstr; |
|||
if ( (retstr= komodo_issuemethod(userpass,method,params,port)) != 0 ) |
|||
{ |
|||
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( jobj(retjson,(char *)"result") != 0 ) |
|||
resjson = jduplicate(jobj(retjson,(char *)"result")); |
|||
else if ( jobj(retjson,(char *)"error") != 0 ) |
|||
resjson = jduplicate(jobj(retjson,(char *)"error")); |
|||
else |
|||
{ |
|||
resjson = cJSON_CreateObject(); |
|||
jaddstr(resjson,(char *)"error",(char *)"cant parse return"); |
|||
} |
|||
free_json(retjson); |
|||
} |
|||
free(retstr); |
|||
} |
|||
if ( resjson != 0 ) |
|||
return(jprint(resjson,1)); |
|||
else return(clonestr((char *)"{\"error\":\"unknown error\"}")); |
|||
} |
|||
|
|||
char *jumblr_importaddress(char *address) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", \"%s\", false]",address,address); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_validateaddress(char *addr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\"]",addr); |
|||
printf("validateaddress.%s\n",params); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
int32_t Jumblr_secretaddrfind(char *searchaddr) |
|||
{ |
|||
int32_t i; |
|||
for (i=0; i<Jumblr_numsecretaddrs; i++) |
|||
{ |
|||
if ( strcmp(searchaddr,Jumblr_secretaddrs[i]) == 0 ) |
|||
return(i); |
|||
} |
|||
return(-1); |
|||
} |
|||
|
|||
int32_t Jumblr_secretaddradd(char *secretaddr) // external
|
|||
{ |
|||
int32_t ind; |
|||
if ( secretaddr != 0 && secretaddr[0] != 0 ) |
|||
{ |
|||
if ( Jumblr_numsecretaddrs < JUMBLR_MAXSECRETADDRS ) |
|||
{ |
|||
if ( strcmp(Jumblr_deposit,secretaddr) != 0 ) |
|||
{ |
|||
if ( (ind= Jumblr_secretaddrfind(secretaddr)) < 0 ) |
|||
{ |
|||
ind = Jumblr_numsecretaddrs++; |
|||
safecopy(Jumblr_secretaddrs[ind],secretaddr,64); |
|||
} |
|||
return(ind); |
|||
} else return(JUMBLR_ERROR_SECRETCANTBEDEPOSIT); |
|||
} else return(JUMBLR_ERROR_TOOMANYSECRETS); |
|||
} |
|||
else |
|||
{ |
|||
memset(Jumblr_secretaddrs,0,sizeof(Jumblr_secretaddrs)); |
|||
Jumblr_numsecretaddrs = 0; |
|||
} |
|||
return(Jumblr_numsecretaddrs); |
|||
} |
|||
|
|||
int32_t Jumblr_depositaddradd(char *depositaddr) // external
|
|||
{ |
|||
int32_t ind,retval = JUMBLR_ERROR_DUPLICATEDEPOSIT; char *retstr; cJSON *retjson,*ismine; |
|||
if ( depositaddr == 0 ) |
|||
depositaddr = (char *)""; |
|||
if ( (ind= Jumblr_secretaddrfind(depositaddr)) < 0 ) |
|||
{ |
|||
if ( (retstr= jumblr_validateaddress(depositaddr)) != 0 ) |
|||
{ |
|||
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( (ismine= jobj(retjson,(char *)"ismine")) != 0 && cJSON_IsTrue(ismine) != 0 ) |
|||
{ |
|||
retval = 0; |
|||
safecopy(Jumblr_deposit,depositaddr,sizeof(Jumblr_deposit)); |
|||
} |
|||
else |
|||
{ |
|||
retval = JUMBLR_ERROR_NOTINWALLET; |
|||
printf("%s not in wallet: ismine.%p %d %s\n",depositaddr,ismine,cJSON_IsTrue(ismine),jprint(retjson,0)); |
|||
} |
|||
free_json(retjson); |
|||
} |
|||
free(retstr); |
|||
} |
|||
} |
|||
return(retval); |
|||
} |
|||
|
|||
#ifdef _WIN32 |
|||
void OS_randombytes(unsigned char *x,long xlen) |
|||
{ |
|||
HCRYPTPROV prov = 0; |
|||
CryptAcquireContextW(&prov, NULL, NULL,PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT); |
|||
CryptGenRandom(prov, xlen, x); |
|||
CryptReleaseContext(prov, 0); |
|||
} |
|||
#endif |
|||
|
|||
int32_t Jumblr_secretaddr(char *secretaddr) |
|||
{ |
|||
uint32_t r; |
|||
if ( Jumblr_numsecretaddrs > 0 ) |
|||
{ |
|||
OS_randombytes((uint8_t *)&r,sizeof(r)); |
|||
r %= Jumblr_numsecretaddrs; |
|||
safecopy(secretaddr,Jumblr_secretaddrs[r],64); |
|||
} |
|||
return(r); |
|||
} |
|||
|
|||
int32_t jumblr_addresstype(char *addr) |
|||
{ |
|||
if ( addr[0] == '"' && addr[strlen(addr)-1] == '"' ) |
|||
{ |
|||
addr[strlen(addr)-1] = 0; |
|||
addr++; |
|||
} |
|||
if ( addr[0] == 'z' && addr[1] == 'c' && strlen(addr) >= 40 ) |
|||
return('z'); |
|||
else if ( strlen(addr) < 40 ) |
|||
return('t'); |
|||
printf("strange.(%s)\n",addr); |
|||
return(-1); |
|||
} |
|||
|
|||
struct jumblr_item *jumblr_opidfind(char *opid) |
|||
{ |
|||
struct jumblr_item *ptr; |
|||
HASH_FIND(hh,Jumblrs,opid,(int32_t)strlen(opid),ptr); |
|||
return(ptr); |
|||
} |
|||
|
|||
struct jumblr_item *jumblr_opidadd(char *opid) |
|||
{ |
|||
struct jumblr_item *ptr = 0; |
|||
if ( opid != 0 && (ptr= jumblr_opidfind(opid)) == 0 ) |
|||
{ |
|||
ptr = (struct jumblr_item *)calloc(1,sizeof(*ptr)); |
|||
safecopy(ptr->opid,opid,sizeof(ptr->opid)); |
|||
HASH_ADD_KEYPTR(hh,Jumblrs,ptr->opid,(int32_t)strlen(ptr->opid),ptr); |
|||
if ( ptr != jumblr_opidfind(opid) ) |
|||
printf("jumblr_opidadd.(%s) ERROR, couldnt find after add\n",opid); |
|||
} |
|||
return(ptr); |
|||
} |
|||
|
|||
char *jumblr_zgetnewaddress() |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[]"); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zlistoperationids() |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[]"); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zgetoperationresult(char *opid) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[[\"%s\"]]",opid); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zgetoperationstatus(char *opid) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[[\"%s\"]]",opid); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount) |
|||
{ |
|||
char params[1024]; double fee = ((amount-3*JUMBLR_TXFEE) * JUMBLR_FEE) * 1.5; |
|||
if ( jumblr_addresstype(zaddr) != 'z' || jumblr_addresstype(taddr) != 't' ) |
|||
return(clonestr((char *)"{\"error\":\"illegal address in t to z\"}")); |
|||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",taddr,zaddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE); |
|||
printf("t -> z: %s\n",params); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount) |
|||
{ |
|||
char params[1024]; double fee = (amount-2*JUMBLR_TXFEE) * JUMBLR_FEE; |
|||
if ( jumblr_addresstype(zaddrS) != 'z' || jumblr_addresstype(zaddrD) != 'z' ) |
|||
return(clonestr((char *)"{\"error\":\"illegal address in z to z\"}")); |
|||
//sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
|
|||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_TXFEE); |
|||
printf("z -> z: %s\n",params); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount) |
|||
{ |
|||
char params[1024]; double fee = ((amount-JUMBLR_TXFEE) * JUMBLR_FEE) * 1.5; |
|||
if ( jumblr_addresstype(zaddr) != 'z' || jumblr_addresstype(taddr) != 't' ) |
|||
return(clonestr((char *)"{\"error\":\"illegal address in z to t\"}")); |
|||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddr,taddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE); |
|||
printf("z -> t: %s\n",params); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zlistaddresses() |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[]"); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zlistreceivedbyaddress(char *addr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", 1]",addr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_getreceivedbyaddress(char *addr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", 1]",addr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_importprivkey(char *wifstr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", \"\", false]",wifstr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_zgetbalance(char *addr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", 1]",addr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_listunspent(char *coinaddr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[1, 99999999, [\"%s\"]]",coinaddr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
char *jumblr_gettransaction(char *txidstr) |
|||
{ |
|||
char params[1024]; |
|||
sprintf(params,"[\"%s\", 1]",txidstr); |
|||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_RPCPORT)); |
|||
} |
|||
|
|||
int32_t jumblr_numvins(bits256 txid) |
|||
{ |
|||
char txidstr[65],params[1024],*retstr; cJSON *retjson,*vins; int32_t n,numvins = -1; |
|||
bits256_str(txidstr,txid); |
|||
if ( (retstr= jumblr_gettransaction(txidstr)) != 0 ) |
|||
{ |
|||
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( jobj(retjson,(char *)"vin") != 0 && ((vins= jarray(&n,retjson,(char *)"vin")) == 0 || n == 0) ) |
|||
{ |
|||
numvins = n; |
|||
//printf("numvins.%d\n",n);
|
|||
} //else printf("no vin.(%s)\n",retstr);
|
|||
free_json(retjson); |
|||
} |
|||
free(retstr); |
|||
} |
|||
return(numvins); |
|||
} |
|||
|
|||
int64_t jumblr_receivedby(char *addr) |
|||
{ |
|||
char *retstr; int64_t total = 0; |
|||
if ( (retstr= jumblr_getreceivedbyaddress(addr)) != 0 ) |
|||
{ |
|||
total = atof(retstr) * SATOSHIDEN; |
|||
free(retstr); |
|||
} |
|||
return(total); |
|||
} |
|||
|
|||
int64_t jumblr_balance(char *addr) |
|||
{ |
|||
char *retstr; double val; int64_t balance = 0; //cJSON *retjson; int32_t i,n;
|
|||
/*if ( jumblr_addresstype(addr) == 't' )
|
|||
{ |
|||
if ( (retstr= jumblr_listunspent(addr)) != 0 ) |
|||
{ |
|||
//printf("jumblr.[%s].(%s)\n","KMD",retstr);
|
|||
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( (n= cJSON_GetArraySize(retjson)) > 0 && cJSON_IsArray(retjson) != 0 ) |
|||
for (i=0; i<n; i++) |
|||
balance += SATOSHIDEN * jdouble(jitem(retjson,i),(char *)"amount"); |
|||
free_json(retjson); |
|||
} |
|||
free(retstr); |
|||
} |
|||
} |
|||
else*/ if ( (retstr= jumblr_zgetbalance(addr)) != 0 ) |
|||
{ |
|||
if ( (val= atof(retstr)) > SMALLVAL ) |
|||
balance = val * SATOSHIDEN; |
|||
free(retstr); |
|||
} |
|||
return(balance); |
|||
} |
|||
|
|||
int32_t jumblr_itemset(struct jumblr_item *ptr,cJSON *item,char *status) |
|||
{ |
|||
cJSON *params,*amounts,*dest; char *from,*addr; int32_t i,n; int64_t amount; |
|||
/*"params" : {
|
|||
"fromaddress" : "RDhEGYScNQYetCyG75Kf8Fg61UWPdwc1C5", |
|||
"amounts" : [ |
|||
{ |
|||
"address" : "zc9s3UdkDFTnnwHrMCr1vYy2WmkjhmTxXNiqC42s7BjeKBVUwk766TTSsrRPKfnX31Bbu8wbrTqnjDqskYGwx48FZMPHvft", |
|||
"amount" : 3.00000000 |
|||
} |
|||
], |
|||
"minconf" : 1, |
|||
"fee" : 0.00010000 |
|||
}*/ |
|||
if ( (params= jobj(item,(char *)"params")) != 0 ) |
|||
{ |
|||
//printf("params.(%s)\n",jprint(params,0));
|
|||
if ( (from= jstr(params,(char *)"fromaddress")) != 0 ) |
|||
{ |
|||
safecopy(ptr->src,from,sizeof(ptr->src)); |
|||
} |
|||
if ( (amounts= jarray(&n,params,(char *)"amounts")) != 0 ) |
|||
{ |
|||
for (i=0; i<n; i++) |
|||
{ |
|||
dest = jitem(amounts,i); |
|||
//printf("%s ",jprint(dest,0));
|
|||
if ( (addr= jstr(dest,(char *)"address")) != 0 && (amount= jdouble(dest,(char *)"amount")*SATOSHIDEN) > 0 ) |
|||
{ |
|||
if ( strcmp(addr,JUMBLR_ADDR) == 0 ) |
|||
ptr->fee = amount; |
|||
else |
|||
{ |
|||
ptr->amount = amount; |
|||
safecopy(ptr->dest,addr,sizeof(ptr->dest)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
ptr->txfee = jdouble(params,(char *)"fee") * SATOSHIDEN; |
|||
} |
|||
return(1); |
|||
} |
|||
|
|||
void jumblr_opidupdate(struct jumblr_item *ptr) |
|||
{ |
|||
char *retstr,*status; cJSON *retjson,*item; |
|||
if ( ptr->status == 0 ) |
|||
{ |
|||
if ( (retstr= jumblr_zgetoperationstatus(ptr->opid)) != 0 ) |
|||
{ |
|||
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( cJSON_GetArraySize(retjson) == 1 && cJSON_IsArray(retjson) != 0 ) |
|||
{ |
|||
item = jitem(retjson,0); |
|||
//printf("%s\n",jprint(item,0));
|
|||
if ( (status= jstr(item,(char *)"status")) != 0 ) |
|||
{ |
|||
if ( strcmp(status,(char *)"success") == 0 ) |
|||
{ |
|||
ptr->status = jumblr_itemset(ptr,item,status); |
|||
if ( (jumblr_addresstype(ptr->src) == 't' && jumblr_addresstype(ptr->src) == 'z' && strcmp(ptr->src,Jumblr_deposit) != 0) || (jumblr_addresstype(ptr->src) == 'z' && jumblr_addresstype(ptr->src) == 't' && Jumblr_secretaddrfind(ptr->dest) < 0) ) |
|||
{ |
|||
printf("a non-jumblr t->z pruned\n"); |
|||
free(jumblr_zgetoperationresult(ptr->opid)); |
|||
ptr->status = -1; |
|||
} |
|||
|
|||
} |
|||
else if ( strcmp(status,(char *)"failed") == 0 ) |
|||
{ |
|||
printf("jumblr_opidupdate %s failed\n",ptr->opid); |
|||
free(jumblr_zgetoperationresult(ptr->opid)); |
|||
ptr->status = -1; |
|||
} |
|||
} |
|||
} |
|||
free_json(retjson); |
|||
} |
|||
free(retstr); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void jumblr_prune(struct jumblr_item *ptr) |
|||
{ |
|||
struct jumblr_item *tmp; char oldsrc[128]; int32_t flag = 1; |
|||
if ( is_hexstr(ptr->opid,0) == 64 ) |
|||
return; |
|||
printf("jumblr_prune %s\n",ptr->opid); |
|||
strcpy(oldsrc,ptr->src); |
|||
free(jumblr_zgetoperationresult(ptr->opid)); |
|||
while ( flag != 0 ) |
|||
{ |
|||
flag = 0; |
|||
HASH_ITER(hh,Jumblrs,ptr,tmp) |
|||
{ |
|||
if ( strcmp(oldsrc,ptr->dest) == 0 ) |
|||
{ |
|||
if ( is_hexstr(ptr->opid,0) != 64 ) |
|||
{ |
|||
printf("jumblr_prune %s (%s -> %s) matched oldsrc\n",ptr->opid,ptr->src,ptr->dest); |
|||
free(jumblr_zgetoperationresult(ptr->opid)); |
|||
strcpy(oldsrc,ptr->src); |
|||
flag = 1; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
bits256 jbits256(cJSON *json,char *field); |
|||
|
|||
|
|||
void jumblr_zaddrinit(char *zaddr) |
|||
{ |
|||
struct jumblr_item *ptr; char *retstr,*totalstr; cJSON *item,*array; double total; bits256 txid; char txidstr[65],t_z,z_z; |
|||
if ( (totalstr= jumblr_zgetbalance(zaddr)) != 0 ) |
|||
{ |
|||
if ( (total= atof(totalstr)) > SMALLVAL ) |
|||
{ |
|||
if ( (retstr= jumblr_zlistreceivedbyaddress(zaddr)) != 0 ) |
|||
{ |
|||
if ( (array= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
t_z = z_z = 0; |
|||
if ( cJSON_GetArraySize(array) == 1 && cJSON_IsArray(array) != 0 ) |
|||
{ |
|||
item = jitem(array,0); |
|||
if ( (uint64_t)((total+0.0000000049) * SATOSHIDEN) == (uint64_t)((jdouble(item,(char *)"amount")+0.0000000049) * SATOSHIDEN) ) |
|||
{ |
|||
txid = jbits256(item,(char *)"txid"); |
|||
bits256_str(txidstr,txid); |
|||
if ( (ptr= jumblr_opidadd(txidstr)) != 0 ) |
|||
{ |
|||
ptr->amount = (total * SATOSHIDEN); |
|||
ptr->status = 1; |
|||
strcpy(ptr->dest,zaddr); |
|||
if ( jumblr_addresstype(ptr->dest) != 'z' ) |
|||
printf("error setting dest type to Z: %s\n",jprint(item,0)); |
|||
if ( jumblr_numvins(txid) == 0 ) |
|||
{ |
|||
z_z = 1; |
|||
strcpy(ptr->src,zaddr); |
|||
ptr->src[3] = '0'; |
|||
ptr->src[4] = '0'; |
|||
ptr->src[5] = '0'; |
|||
if ( jumblr_addresstype(ptr->src) != 'z' ) |
|||
printf("error setting address type to Z: %s\n",jprint(item,0)); |
|||
} |
|||
else |
|||
{ |
|||
t_z = 1; |
|||
strcpy(ptr->src,"taddr"); |
|||
if ( jumblr_addresstype(ptr->src) != 't' ) |
|||
printf("error setting address type to T: %s\n",jprint(item,0)); |
|||
} |
|||
printf("%s %s %.8f t_z.%d z_z.%d\n",zaddr,txidstr,total,t_z,z_z); // cant be z->t from spend
|
|||
} |
|||
} else printf("mismatched %s %s total %.8f vs %.8f -> %lld\n",zaddr,totalstr,dstr(SATOSHIDEN * total),dstr(SATOSHIDEN * jdouble(item,(char *)"amount")),(long long)((uint64_t)(total * SATOSHIDEN) - (uint64_t)(jdouble(item,(char *)"amount") * SATOSHIDEN))); |
|||
} |
|||
free_json(array); |
|||
} |
|||
free(retstr); |
|||
} |
|||
} |
|||
free(totalstr); |
|||
} |
|||
} |
|||
|
|||
void jumblr_opidsupdate() |
|||
{ |
|||
char *retstr; cJSON *array; int32_t i,n; struct jumblr_item *ptr; |
|||
if ( (retstr= jumblr_zlistoperationids()) != 0 ) |
|||
{ |
|||
if ( (array= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( (n= cJSON_GetArraySize(array)) > 0 && cJSON_IsArray(array) != 0 ) |
|||
{ |
|||
//printf("%s -> n%d\n",retstr,n);
|
|||
for (i=0; i<n; i++) |
|||
{ |
|||
if ( (ptr= jumblr_opidadd(jstri(array,i))) != 0 ) |
|||
{ |
|||
if ( ptr->status == 0 ) |
|||
jumblr_opidupdate(ptr); |
|||
//printf("%d: %s -> %s %.8f\n",ptr->status,ptr->src,ptr->dest,dstr(ptr->amount));
|
|||
if ( jumblr_addresstype(ptr->src) == 'z' && jumblr_addresstype(ptr->dest) == 't' ) |
|||
jumblr_prune(ptr); |
|||
} |
|||
} |
|||
} |
|||
free_json(array); |
|||
} |
|||
free(retstr); |
|||
} |
|||
} |
|||
|
|||
uint64_t jumblr_increment(uint8_t r,int32_t height,uint64_t total,uint64_t biggest,uint64_t medium, uint64_t smallest) |
|||
{ |
|||
int32_t i,n; uint64_t incrs[1000],remains = total; |
|||
height /= JUMBLR_SYNCHRONIZED_BLOCKS; |
|||
if ( (height % JUMBLR_SYNCHRONIZED_BLOCKS) == 0 || total >= 100*biggest ) |
|||
{ |
|||
if ( total >= biggest ) |
|||
return(biggest); |
|||
else if ( total >= medium ) |
|||
return(medium); |
|||
else if ( total >= smallest ) |
|||
return(smallest); |
|||
else return(0); |
|||
} |
|||
else |
|||
{ |
|||
n = 0; |
|||
while ( remains > smallest && n < sizeof(incrs)/sizeof(*incrs) ) |
|||
{ |
|||
if ( remains >= biggest ) |
|||
incrs[n] = biggest; |
|||
else if ( remains >= medium ) |
|||
incrs[n] = medium; |
|||
else if ( remains >= smallest ) |
|||
incrs[n] = smallest; |
|||
else break; |
|||
remains -= incrs[n]; |
|||
n++; |
|||
} |
|||
if ( n > 0 ) |
|||
{ |
|||
r %= n; |
|||
for (i=0; i<n; i++) |
|||
printf("%.8f ",dstr(incrs[i])); |
|||
printf("n.%d incrs r.%d -> %.8f\n",n,r,dstr(incrs[r])); |
|||
return(incrs[r]); |
|||
} |
|||
} |
|||
return(0); |
|||
} |
|||
|
|||
void jumblr_iteration() |
|||
{ |
|||
static int32_t lastheight; static uint32_t lasttime; |
|||
char *zaddr,*addr,*retstr=0,secretaddr[64]; cJSON *array; int32_t i,iter,height,acpublic,counter,chosen_one,n; uint64_t smallest,medium,biggest,amount=0,total=0; double fee; struct jumblr_item *ptr,*tmp; uint16_t r,s; |
|||
acpublic = ASSETCHAINS_PUBLIC; |
|||
if ( ASSETCHAINS_SYMBOL[0] == 0 && GetTime() >= KOMODO_SAPLING_DEADLINE ) |
|||
acpublic = 1; |
|||
if ( JUMBLR_PAUSE != 0 || acpublic != 0 ) |
|||
return; |
|||
if ( lasttime == 0 ) |
|||
{ |
|||
if ( (retstr= jumblr_zlistaddresses()) != 0 ) |
|||
{ |
|||
if ( (array= cJSON_Parse(retstr)) != 0 ) |
|||
{ |
|||
if ( (n= cJSON_GetArraySize(array)) > 0 && cJSON_IsArray(array) != 0 ) |
|||
{ |
|||
for (i=0; i<n; i++) |
|||
jumblr_zaddrinit(jstri(array,i)); |
|||
} |
|||
free_json(array); |
|||
} |
|||
free(retstr), retstr = 0; |
|||
} |
|||
} |
|||
height = (int32_t)chainActive.LastTip()->GetHeight(); |
|||
if ( time(NULL) < lasttime+40 ) |
|||
return; |
|||
lasttime = (uint32_t)time(NULL); |
|||
if ( lastheight == height ) |
|||
return; |
|||
lastheight = height; |
|||
if ( (height % JUMBLR_SYNCHRONIZED_BLOCKS) != JUMBLR_SYNCHRONIZED_BLOCKS-3 ) |
|||
return; |
|||
fee = JUMBLR_INCR * JUMBLR_FEE; |
|||
smallest = SATOSHIDEN * ((JUMBLR_INCR + 3*fee) + 3*JUMBLR_TXFEE); |
|||
medium = SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*10 + 3*JUMBLR_TXFEE); |
|||
biggest = SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*777 + 3*JUMBLR_TXFEE); |
|||
OS_randombytes((uint8_t *)&r,sizeof(r)); |
|||
s = (r % 3); |
|||
//printf("jumblr_iteration r.%u s.%u\n",r,s);
|
|||
switch ( s ) |
|||
{ |
|||
case 0: // t -> z
|
|||
default: |
|||
if ( Jumblr_deposit[0] != 0 && (total= jumblr_balance(Jumblr_deposit)) >= smallest ) |
|||
{ |
|||
if ( (zaddr= jumblr_zgetnewaddress()) != 0 ) |
|||
{ |
|||
if ( zaddr[0] == '"' && zaddr[strlen(zaddr)-1] == '"' ) |
|||
{ |
|||
zaddr[strlen(zaddr)-1] = 0; |
|||
addr = zaddr+1; |
|||
} else addr = zaddr; |
|||
amount = jumblr_increment(r/3,height,total,biggest,medium,smallest); |
|||
/*
|
|||
amount = 0; |
|||
if ( (height % (JUMBLR_SYNCHRONIZED_BLOCKS*JUMBLR_SYNCHRONIZED_BLOCKS)) == 0 && total >= SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE) ) |
|||
amount = SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE); |
|||
else if ( (r & 3) == 0 && total >= SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*10 + 3*JUMBLR_TXFEE) ) |
|||
amount = SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*10 + 3*JUMBLR_TXFEE); |
|||
else amount = SATOSHIDEN * ((JUMBLR_INCR + 3*fee) + 3*JUMBLR_TXFEE);*/ |
|||
if ( amount > 0 && (retstr= jumblr_sendt_to_z(Jumblr_deposit,addr,dstr(amount))) != 0 ) |
|||
{ |
|||
printf("sendt_to_z.(%s)\n",retstr); |
|||
free(retstr), retstr = 0; |
|||
} |
|||
free(zaddr); |
|||
} else printf("no zaddr from jumblr_zgetnewaddress\n"); |
|||
} |
|||
else if ( Jumblr_deposit[0] != 0 ) |
|||
printf("%s total %.8f vs %.8f\n",Jumblr_deposit,dstr(total),(JUMBLR_INCR + 3*(fee+JUMBLR_TXFEE))); |
|||
break; |
|||
case 1: // z -> z
|
|||
jumblr_opidsupdate(); |
|||
chosen_one = -1; |
|||
for (iter=counter=0; iter<2; iter++) |
|||
{ |
|||
counter = n = 0; |
|||
HASH_ITER(hh,Jumblrs,ptr,tmp) |
|||
{ |
|||
if ( ptr->spent == 0 && ptr->status > 0 && jumblr_addresstype(ptr->src) == 't' && jumblr_addresstype(ptr->dest) == 'z' ) |
|||
{ |
|||
if ( (total= jumblr_balance(ptr->dest)) >= (fee + JUMBLR_FEE)*SATOSHIDEN ) |
|||
{ |
|||
if ( iter == 1 && counter == chosen_one ) |
|||
{ |
|||
if ( (zaddr= jumblr_zgetnewaddress()) != 0 ) |
|||
{ |
|||
if ( zaddr[0] == '"' && zaddr[strlen(zaddr)-1] == '"' ) |
|||
{ |
|||
zaddr[strlen(zaddr)-1] = 0; |
|||
addr = zaddr+1; |
|||
} else addr = zaddr; |
|||
if ( (retstr= jumblr_sendz_to_z(ptr->dest,addr,dstr(total))) != 0 ) |
|||
{ |
|||
printf("n.%d counter.%d chosen_one.%d send z_to_z.(%s)\n",n,counter,chosen_one,retstr); |
|||
free(retstr), retstr = 0; |
|||
} |
|||
ptr->spent = (uint32_t)time(NULL); |
|||
free(zaddr); |
|||
break; |
|||
} |
|||
} |
|||
counter++; |
|||
} |
|||
} |
|||
n++; |
|||
} |
|||
if ( counter == 0 ) |
|||
break; |
|||
if ( iter == 0 ) |
|||
{ |
|||
OS_randombytes((uint8_t *)&chosen_one,sizeof(chosen_one)); |
|||
if ( chosen_one < 0 ) |
|||
chosen_one = -chosen_one; |
|||
chosen_one %= counter; |
|||
printf("jumblr z->z chosen_one.%d of %d, from %d\n",chosen_one,counter,n); |
|||
} |
|||
} |
|||
break; |
|||
case 2: // z -> t
|
|||
if ( Jumblr_numsecretaddrs > 0 ) |
|||
{ |
|||
jumblr_opidsupdate(); |
|||
chosen_one = -1; |
|||
for (iter=0; iter<2; iter++) |
|||
{ |
|||
counter = n = 0; |
|||
HASH_ITER(hh,Jumblrs,ptr,tmp) |
|||
{ |
|||
//printf("status.%d %c %c %.8f\n",ptr->status,jumblr_addresstype(ptr->src),jumblr_addresstype(ptr->dest),dstr(ptr->amount));
|
|||
if ( ptr->spent == 0 && ptr->status > 0 && jumblr_addresstype(ptr->src) == 'z' && jumblr_addresstype(ptr->dest) == 'z' ) |
|||
{ |
|||
if ( (total= jumblr_balance(ptr->dest)) >= (fee + JUMBLR_FEE)*SATOSHIDEN ) |
|||
{ |
|||
if ( iter == 1 && counter == chosen_one ) |
|||
{ |
|||
Jumblr_secretaddr(secretaddr); |
|||
if ( (retstr= jumblr_sendz_to_t(ptr->dest,secretaddr,dstr(total))) != 0 ) |
|||
{ |
|||
printf("%s send z_to_t.(%s)\n",secretaddr,retstr); |
|||
free(retstr), retstr = 0; |
|||
} else printf("null return from jumblr_sendz_to_t\n"); |
|||
ptr->spent = (uint32_t)time(NULL); |
|||
break; |
|||
} |
|||
counter++; |
|||
} //else printf("z->t spent.%u total %.8f error\n",ptr->spent,dstr(total));
|
|||
} |
|||
n++; |
|||
} |
|||
if ( counter == 0 ) |
|||
break; |
|||
if ( iter == 0 ) |
|||
{ |
|||
OS_randombytes((uint8_t *)&chosen_one,sizeof(chosen_one)); |
|||
if ( chosen_one < 0 ) |
|||
chosen_one = -chosen_one; |
|||
chosen_one %= counter; |
|||
printf("jumblr z->t chosen_one.%d of %d, from %d\n",chosen_one,counter,n); |
|||
} //else printf("n.%d counter.%d chosen.%d\n",n,counter,chosen_one);
|
|||
} |
|||
} |
|||
break; |
|||
} |
|||
} |
@ -1,98 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
""" |
|||
sudo apt-get install python3-dev |
|||
sudo apt-get install python3 libgnutls28-dev libssl-dev |
|||
sudo apt-get install python3-pip |
|||
pip3 install setuptools |
|||
pip3 install wheel |
|||
pip3 install base58 slick-bitcoinrpc |
|||
./notarystats.py |
|||
------------------------------------------------ |
|||
""" |
|||
import platform |
|||
import os |
|||
import re |
|||
import sys |
|||
import time |
|||
import pprint |
|||
from slickrpc import Proxy |
|||
|
|||
# fucntion to define rpc_connection |
|||
def def_credentials(chain): |
|||
rpcport = ''; |
|||
operating_system = platform.system() |
|||
if operating_system == 'Darwin': |
|||
ac_dir = os.environ['HOME'] + '/Library/Application Support/Komodo' |
|||
elif operating_system == 'Linux': |
|||
ac_dir = os.environ['HOME'] + '/.komodo' |
|||
elif operating_system == 'Windows': |
|||
ac_dir = '%s/komodo/' % os.environ['APPDATA'] |
|||
if chain == 'KMD': |
|||
coin_config_file = str(ac_dir + '/komodo.conf') |
|||
else: |
|||
coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf') |
|||
with open(coin_config_file, 'r') as f: |
|||
for line in f: |
|||
l = line.rstrip() |
|||
if re.search('rpcuser', l): |
|||
rpcuser = l.replace('rpcuser=', '') |
|||
elif re.search('rpcpassword', l): |
|||
rpcpassword = l.replace('rpcpassword=', '') |
|||
elif re.search('rpcport', l): |
|||
rpcport = l.replace('rpcport=', '') |
|||
if len(rpcport) == 0: |
|||
if chain == 'KMD': |
|||
rpcport = 7771 |
|||
else: |
|||
print("rpcport not in conf file, exiting") |
|||
print("check " + coin_config_file) |
|||
exit(1) |
|||
return (Proxy("http://%s:%s@127.0.0.1:%d" % (rpcuser, rpcpassword, int(rpcport)))) |
|||
|
|||
|
|||
rpc = def_credentials('KMD') |
|||
pp = pprint.PrettyPrinter(indent=2) |
|||
|
|||
notarynames = [ "0dev1_jl777", "0dev2_kolo", "0dev3_kolo", "0dev4_decker_AR", "a-team_SH", "artik_AR", "artik_EU", "artik_NA", "artik_SH", "badass_EU", "badass_NA", "batman_AR", "batman_SH", "ca333", "chainmakers_EU", "chainmakers_NA", "chainstrike_SH", "cipi_AR", "cipi_NA", "crackers_EU", "crackers_NA", "dwy_EU", "emmanux_SH", "etszombi_EU", "fullmoon_AR", "fullmoon_NA", "fullmoon_SH", "goldenman_EU", "indenodes_AR", "indenodes_EU", "indenodes_NA", "indenodes_SH", "jackson_AR", "jeezy_EU", "karasugoi_NA", "komodoninja_EU", "komodoninja_SH", "komodopioneers_SH", "libscott_SH", "lukechilds_AR", "madmax_AR", "meshbits_AR", "meshbits_SH", "metaphilibert_AR", "metaphilibert_SH", "patchkez_SH", "pbca26_NA", "peer2cloud_AR", "peer2cloud_SH", "polycryptoblog_NA", "hyper_AR", "hyper_EU", "hyper_SH", "hyper_NA", "popcornbag_AR", "popcornbag_NA", "alien_AR", "alien_EU", "thegaltmines_NA", "titomane_AR", "titomane_EU", "titomane_SH", "webworker01_NA", "xrobesx_NA" ] |
|||
notaries = 64 * [0] |
|||
|
|||
startheight = 821657 #Second time filter for assetchains (block 821657) for KMD its 814000 |
|||
stopheight = 1307200 |
|||
for i in range(startheight,stopheight): |
|||
ret = rpc.getNotarisationsForBlock(i) |
|||
KMD = ret['KMD'] |
|||
if len(KMD) > 0: |
|||
for obj in KMD: |
|||
#for now skip KMD for this. As official stats are from BTC chain |
|||
# this can be reversed to !== to count KMD numbers :) |
|||
if obj['chain'] == 'KMD': |
|||
continue; |
|||
for notary in obj['notaries']: |
|||
notaries[notary] = notaries[notary] + 1 |
|||
|
|||
i = 0 |
|||
SH = [] |
|||
AR = [] |
|||
EU = [] |
|||
NA = [] |
|||
for notary in notaries: |
|||
tmpnotary = {} |
|||
tmpnotary['node'] = notarynames[i] |
|||
tmpnotary['ac_count'] = notary |
|||
if notarynames[i].endswith('SH'): |
|||
SH.append(tmpnotary) |
|||
elif notarynames[i].endswith('AR'): |
|||
AR.append(tmpnotary) |
|||
elif notarynames[i].endswith('EU'): |
|||
EU.append(tmpnotary) |
|||
elif notarynames[i].endswith('NA'): |
|||
NA.append(tmpnotary) |
|||
i = i + 1 |
|||
|
|||
regions = {} |
|||
regions['SH'] = sorted(SH, key=lambda k: k['ac_count'], reverse=True) |
|||
regions['AR'] = sorted(AR, key=lambda k: k['ac_count'], reverse=True) |
|||
regions['EU'] = sorted(EU, key=lambda k: k['ac_count'], reverse=True) |
|||
regions["NA"] = sorted(NA, key=lambda k: k['ac_count'], reverse=True) |
|||
|
|||
pp.pprint(regions) |
@ -1,7 +1,7 @@ |
|||
#!/bin/bash |
|||
|
|||
# Copyright (c) 2018-2020 The Hush developers |
|||
#set working directory to the location of this script |
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|||
cd $DIR |
|||
|
|||
../komodo-cli -ac_name=HUSH3 "$@" |
|||
../hush-cli $@ |
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
# Copyright (c) 2018-2020 The Hush developers |
|||
./hush-smart-chain -ac_name=KOOLAID $@ |
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
# Copyright (c) 2018-2020 The Hush developers |
|||
./hush-smart-chain -ac_name=KUSH $@ |
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
# Copyright (c) 2018-2020 The Hush developers |
|||
./hush-smart-chain -ac_name=ZEX $@ |
@ -0,0 +1,22 @@ |
|||
[ |
|||
{ |
|||
"ac_name": "HUSH3", |
|||
"ac_sapling": "1", |
|||
"ac_founders": "1", |
|||
"ac_reward": "0,1125000000,562500000", |
|||
"ac_end": "128,340000,5422111", |
|||
"ac_blocktime": "150", |
|||
"ac_supply": "6178674", |
|||
"ac_halving": "129,340000,840000", |
|||
"ac_cc": "2", |
|||
"ac_cclib": "hush3", |
|||
"ac_ccenable": "228,234,235,236,241", |
|||
"ac_perc": "11111111", |
|||
"ac_eras": "3", |
|||
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac", |
|||
"clientname": "GoldenSandtrout", |
|||
"addnode": [ |
|||
"1.1.1.1" |
|||
] |
|||
} |
|||
] |
@ -0,0 +1,17 @@ |
|||
#!/bin/bash |
|||
# Copyright (c) 2018-2020 The Hush developers |
|||
set -x |
|||
delay=60 |
|||
source pubkey.txt |
|||
echo $pubkey |
|||
echo "jl777 is a traitor to his village of cypherpunks, ca333 is his obedient servant" |
|||
|
|||
hsc="./hush-smart-chain" |
|||
ip=$(HUSHDEX_SEEDNODE) |
|||
|
|||
# this chain helps power HushDEX |
|||
$hsc -pubkey=$pubkey -ac_name=ZEX -ac_supply=100000000 -addnode=$ip $@ & |
|||
|
|||
# these are testcoins, like ARRR |
|||
$hsc -pubkey=$pubkey -ac_name=ZUSH -ac_supply=100000000 -addnode=$ip $@ & |
|||
$hsc -pubkey=$pubkey -ac_name=KOOLAID -ac_supply=100000000 -addnode=$ip $@ & |
@ -1,21 +0,0 @@ |
|||
MIT License |
|||
|
|||
Copyright (c) 2019 Anton Lysakov |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE. |
@ -1,58 +0,0 @@ |
|||
# Komodo Cryptoconditons Terminal User Interfaces (aka TUIs) |
|||
|
|||
These tools creating for demonstration and partial automation of Komodo cryptoconditions modules testing. (RogueCC game, AssetsCC, OraclesCC, GatewaysCC, MarmaraCC, ...) |
|||
|
|||
|
|||
Developer installation (on Ubuntu 18.04) : |
|||
|
|||
Python3 required for execution: |
|||
|
|||
* `sudo apt-get install python3.6 python3-pip libgnutls28-dev` |
|||
|
|||
pip packages needed: |
|||
|
|||
* `pip3 install setuptools wheel slick-bitcoinrpc` |
|||
* or `pip3 install -r requirements.txt` |
|||
|
|||
Starting: |
|||
|
|||
# TUI for RogueCC |
|||
|
|||
If you're looking for player 3 in 1 (daemon + game + TUI) multiOS bundle - please check `releases` of this repo. |
|||
|
|||
`python3 rogue_tui.py` |
|||
|
|||
![alt text](https://i.imgur.com/gkcxMGt.png) |
|||
|
|||
# TUI for OraclesCC |
|||
|
|||
Have files uploader/downloader functionality - also there is a AWS branch for AWS certificates uploading demonstration |
|||
|
|||
`python3 oracles_cc_tui.py` |
|||
|
|||
![alt text](https://i.imgur.com/tfHwRqc.png) |
|||
|
|||
# TUI for GatewaysCC |
|||
|
|||
![alt text](https://i.imgur.com/c8DPfpp.png) |
|||
|
|||
`python3 gateways_creation_tui.py` |
|||
|
|||
`python3 gateways_usage_tui.py` |
|||
|
|||
At the moment raw version of manual gateway how-to guide can be found here: https://docs.komodoplatform.com/cc/contracts/gateways/scenarios/tutorial.html I advice to read it before you start use this tool to understand the flow. |
|||
|
|||
# TUI for MarmaraCC |
|||
|
|||
`python3 marmara_tui.py` |
|||
|
|||
![alt text](https://i.imgur.com/uonMWHl.png) |
|||
|
|||
# TUI for AssetsCC (not much finished) |
|||
|
|||
`python3 assets_cc_tui.py` |
|||
|
|||
Before execution be sure than daemon for needed AC up. |
|||
|
|||
|
|||
|
@ -1,39 +0,0 @@ |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xlc:ldOKNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xo:,........';lxOXNMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMWNKkoc,..................':ox0XWMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMWNKkdc;............................,:ok0NWMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMWNKOdl;'.....................................,cdkKNWMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMW0c'..............................................';kNMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMK:......................';:c:'......................,kWMMMMMMMMMMMM |
|||
MMMMMMMMMMMMXl...................;cdkKNWWNXOdl;'..................;OWMMMMMMMMMMM |
|||
MMMMMMMMMMMNo...............,cok0XWMMMMMMMMMMWNKkdc;'..............:KMMMMMMMMMMM |
|||
MMMMMMMMMMWx'...........;ox0XWMMMMMMMMMMMMMMMMMMMMWNKko:............lXMMMMMMMMMM |
|||
MMMMMMMMMWk,...........lXWMMMMMMMMMMMMWWWWMMMMMMMMMMMMMNx'...........oNMMMMMMMMM |
|||
MMMMMMMMW0;...........cKMMMMMMMMMWNXOdl::cdkKNWMMMMMMMMMNo...........'xWMMMMMMMM |
|||
MMMMMMMMKc...........;0WMMMMMWN0xl:,........';ldOXWMMMMMMXl...........,OWMMMMMMM |
|||
MMMMMMMXl...........,kWMMMMMMKl..................;OWMMMMMMK:...........;0MMMMMMM |
|||
MMMMMMNd...........'xNMMMMMMXl....................:0WMMMMMWO;...........cKMMMMMM |
|||
MMMMMNx'...........oNMMMMMMNd......................cKMMMMMMWk'...........lXMMMMM |
|||
MMMMWO,...........lXMMMMMMWx'.......................oXMMMMMMNd'...........dNMMMM |
|||
MMMMXc...........,OWMMMMMMK:........................,kWMMMMMMKc...........;0MMMM |
|||
MMMMWx'...........oXMMMMMMNd........................cKMMMMMMWk,...........lXMMMM |
|||
MMMMMNd...........'dNMMMMMMXl......................:0MMMMMMWO;...........cKMMMMM |
|||
MMMMMMXl...........,kWMMMMMMKc....................,OWMMMMMM0:...........;0MMMMMM |
|||
MMMMMMMKc...........;OWMMMMMW0:..................,kWMMMMMMXc...........,OWMMMMMM |
|||
MMMMMMMM0;...........:KMMMMMMWKko:,..........';lx0WMMMMMMNo...........'xWMMMMMMM |
|||
MMMMMMMMWk,...........lXMMMMMMMMWWXOxl:,,;cdOKNWMMMMMMMMNx'...........dNMMMMMMMM |
|||
MMMMMMMMMWx'...........dNMMMMMMMMMMMMWNXXNWMMMMMMMMMMMMWk,...........lXMMMMMMMMM |
|||
MMMMMMMMMMNo............cx0XWMMMMMMMMMMMMMMMMMMMMMMWN0kl,...........cKMMMMMMMMMM |
|||
MMMMMMMMMMMXl..............,:ok0XWMMMMMMMMMMMMWNKkdc;..............;0WMMMMMMMMMM |
|||
MMMMMMMMMMMMK:..................,cokKNWMMWNKOdl;'.................,kWMMMMMMMMMMM |
|||
MMMMMMMMMMMMWO;......................;cool;'.....................'xNMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMWk;................................................'dNMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMWXOxl;'.......................................,cdkKWMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMWNKOdc;..............................,cok0NWMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMWNKkoc,....................,:ox0XWMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0ko:,..........':lx0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xl:,,;ldOKNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNNXNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
|||
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM |
@ -1,129 +0,0 @@ |
|||
import http |
|||
from slickrpc import Proxy |
|||
|
|||
|
|||
# RPC connection |
|||
def rpc_connect(rpc_user, rpc_password, port): |
|||
try: |
|||
rpc_connection = Proxy("http://%s:%s@127.0.0.1:%d"%(rpc_user, rpc_password, port)) |
|||
except Exception: |
|||
raise Exception("Connection error! Probably no daemon on selected port.") |
|||
return rpc_connection |
|||
|
|||
|
|||
# Non CC calls |
|||
def getinfo(rpc_connection): |
|||
try: |
|||
getinfo = rpc_connection.getinfo() |
|||
except Exception: |
|||
raise Exception("Connection error!") |
|||
return getinfo |
|||
|
|||
|
|||
def sendrawtransaction(rpc_connection, hex): |
|||
tx_id = rpc_connection.sendrawtransaction(hex) |
|||
return tx_id |
|||
|
|||
|
|||
def gettransaction(rpc_connection, tx_id): |
|||
transaction_info = rpc_connection.gettransaction(tx_id) |
|||
return transaction_info |
|||
|
|||
|
|||
def getrawtransaction(rpc_connection, tx_id): |
|||
rawtransaction = rpc_connection.getrawtransaction(tx_id) |
|||
return rawtransaction |
|||
|
|||
|
|||
def getbalance(rpc_connection): |
|||
balance = rpc_connection.getbalance() |
|||
return balance |
|||
|
|||
# Token CC calls |
|||
def token_create(rpc_connection, name, supply, description): |
|||
token_hex = rpc_connection.tokencreate(name, supply, description) |
|||
return token_hex |
|||
|
|||
|
|||
def token_info(rpc_connection, token_id): |
|||
token_info = rpc_connection.tokeninfo(token_id) |
|||
return token_info |
|||
|
|||
|
|||
#TODO: have to add option with pubkey input |
|||
def token_balance(rpc_connection, token_id): |
|||
token_balance = rpc_connection.tokenbalance(token_id) |
|||
return token_balance |
|||
|
|||
def token_list(rpc_connection): |
|||
token_list = rpc_connection.tokenlist() |
|||
return token_list |
|||
|
|||
|
|||
def token_convert(rpc_connection, evalcode, token_id, pubkey, supply): |
|||
token_convert_hex = rpc_connection.tokenconvert(evalcode, token_id, pubkey, supply) |
|||
return token_convert_hex |
|||
|
|||
def get_rawmempool(rpc_connection): |
|||
mempool = rpc_connection.getrawmempool() |
|||
return mempool |
|||
|
|||
# Oracle CC calls |
|||
def oracles_create(rpc_connection, name, description, data_type): |
|||
oracles_hex = rpc_connection.oraclescreate(name, description, data_type) |
|||
return oracles_hex |
|||
|
|||
|
|||
def oracles_register(rpc_connection, oracle_id, data_fee): |
|||
oracles_register_hex = rpc_connection.oraclesregister(oracle_id, data_fee) |
|||
return oracles_register_hex |
|||
|
|||
|
|||
def oracles_subscribe(rpc_connection, oracle_id, publisher_id, data_fee): |
|||
oracles_subscribe_hex = rpc_connection.oraclessubscribe(oracle_id, publisher_id, data_fee) |
|||
return oracles_subscribe_hex |
|||
|
|||
|
|||
def oracles_info(rpc_connection, oracle_id): |
|||
oracles_info = rpc_connection.oraclesinfo(oracle_id) |
|||
return oracles_info |
|||
|
|||
|
|||
def oracles_data(rpc_connection, oracle_id, hex_string): |
|||
oracles_data = rpc_connection.oraclesdata(oracle_id, hex_string) |
|||
return oracles_data |
|||
|
|||
|
|||
def oracles_list(rpc_connection): |
|||
oracles_list = rpc_connection.oracleslist() |
|||
return oracles_list |
|||
|
|||
|
|||
def oracles_samples(rpc_connection, oracletxid, batonutxo, num): |
|||
oracles_sample = rpc_connection.oraclessamples(oracletxid, batonutxo, num) |
|||
return oracles_sample |
|||
|
|||
|
|||
# Gateways CC calls |
|||
# Arguments changing dynamically depends of M N, so supposed to wrap it this way |
|||
# token_id, oracle_id, coin_name, token_supply, M, N + pubkeys for each N |
|||
def gateways_bind(rpc_connection, *args): |
|||
gateways_bind_hex = rpc_connection.gatewaysbind(*args) |
|||
return gateways_bind_hex |
|||
|
|||
|
|||
def gateways_deposit(rpc_connection, gateway_id, height, coin_name,\ |
|||
coin_txid, claim_vout, deposit_hex, proof, dest_pub, amount): |
|||
gateways_deposit_hex = rpc_connection.gatewaysdeposit(gateway_id, height, coin_name,\ |
|||
coin_txid, claim_vout, deposit_hex, proof, dest_pub, amount) |
|||
return gateways_deposit_hex |
|||
|
|||
|
|||
def gateways_claim(rpc_connection, gateway_id, coin_name, deposit_txid, dest_pub, amount): |
|||
gateways_claim_hex = rpc_connection.gatewaysclaim(gateway_id, coin_name, deposit_txid, dest_pub, amount) |
|||
return gateways_claim_hex |
|||
|
|||
|
|||
def gateways_withdraw(rpc_connection, gateway_id, coin_name, withdraw_pub, amount): |
|||
gateways_withdraw_hex = rpc_connection.gatewayswithdraw(gateway_id, coin_name, withdraw_pub, amount) |
|||
return gateways_withdraw_hex |
File diff suppressed because it is too large
@ -1,8 +0,0 @@ |
|||
configobj==5.0.6 |
|||
pip==9.0.1 |
|||
pycurl==7.43.0.2 |
|||
setuptools==39.0.1 |
|||
six==1.12.0 |
|||
slick-bitcoinrpc==0.1.4 |
|||
ujson==1.35 |
|||
wheel==0.32.3 |
@ -1,67 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
|
|||
|
|||
header = "\ |
|||
___ _ _____ \n\ |
|||
/ _ \ | | / __ \\\n\ |
|||
/ /_\ \ ___ ___ ___ | |_ ___ | / \/\n\ |
|||
| _ |/ __|/ __| / _ \| __|/ __|| | \n\ |
|||
| | | |\__ \\\__ \| __/| |_ \__ \| \__/\\\n\ |
|||
\_| |_/|___/|___/ \___| \__||___/ \____/\n" |
|||
|
|||
|
|||
menuItems = [ |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Print tokens list": tuilib.print_tokens_list}, |
|||
{"Check my tokens balances" : tuilib.print_tokens_balances}, |
|||
# transfer tokens (pre-print tokens balances) |
|||
{"Create token": tuilib.token_create_tui}, |
|||
# trading zone - pre-print token orders - possible to open order or fill existing one |
|||
{"Exit": exit} |
|||
] |
|||
|
|||
|
|||
def main(): |
|||
while True: |
|||
os.system('clear') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('CLI version 0.2 by Anton Lysakov\n', 'green')) |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
try: |
|||
print(tuilib.colorize("Welcome to the GatewaysCC TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.rpc_connection_tui() |
|||
rpclib.getinfo(rpc_connection) |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to RPC! Please re-check credentials.", "pink")) |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
|||
|
@ -1,67 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
|
|||
header = "\ |
|||
_____ _ _____ _____ \n\ |
|||
| __ \ | | / __ \/ __ \\\n\ |
|||
| | \/ __ _| |_ _____ ____ _ _ _ ___| / \/| / \/\n\ |
|||
| | __ / _` | __/ _ \ \ /\ / / _` | | | / __| | | | \n\ |
|||
| |_\ \ (_| | || __/\ V V / (_| | |_| \__ \ \__/\| \__/\\\n\ |
|||
\____/\__,_|\__\___| \_/\_/ \__,_|\__, |___/\____/ \____/\n\ |
|||
__/ | \n\ |
|||
|___/ \n" |
|||
|
|||
|
|||
menuItems = [ |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Create token": tuilib.token_create_tui}, |
|||
{"Create oracle": tuilib.oracle_create_tui}, |
|||
{"Register as publisher for oracle": tuilib.oracle_register_tui}, |
|||
{"Subscribe on oracle (+UTXO generator)": tuilib.oracle_subscription_utxogen}, |
|||
{"Bind Gateway": tuilib.gateways_bind_tui}, |
|||
{"Exit": exit} |
|||
] |
|||
|
|||
|
|||
def main(): |
|||
while True: |
|||
os.system('clear') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('CLI version 0.2\n', 'green')) |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
try: |
|||
print(tuilib.colorize("Welcome to the GatewaysCC TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.rpc_connection_tui() |
|||
rpclib.getinfo(rpc_connection) |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to RPC! Please re-check credentials.", "pink")) |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
@ -1,96 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os, time |
|||
|
|||
header = "\ |
|||
_____ _ _____ _____ \n\ |
|||
| __ \ | | / __ \/ __ \\\n\ |
|||
| | \/ __ _| |_ _____ ____ _ _ _ ___| / \/| / \/\n\ |
|||
| | __ / _` | __/ _ \ \ /\ / / _` | | | / __| | | | \n\ |
|||
| |_\ \ (_| | || __/\ V V / (_| | |_| \__ \ \__/\| \__/\\\n\ |
|||
\____/\__,_|\__\___| \_/\_/ \__,_|\__, |___/\____/ \____/\n\ |
|||
__/ | \n\ |
|||
|___/ \n" |
|||
|
|||
menuItems = [ |
|||
{"Check connection to assetchain": tuilib.getinfo_tui}, |
|||
{"Check assetchain mempool": tuilib.print_mempool}, |
|||
{"Check connection to KMD": tuilib.getinfo_tui}, |
|||
{"Connect to KMD daemon": tuilib.rpc_kmd_connection_tui}, |
|||
{"Send KMD gateway deposit transaction": tuilib.gateways_send_kmd}, |
|||
{"Execute gateways deposit": tuilib.gateways_deposit_tui}, |
|||
{"Execute gateways claim": tuilib.gateways_claim_tui}, |
|||
{"Execute gateways withdrawal": tuilib.gateways_withdrawal_tui}, |
|||
{"Exit": exit} |
|||
] |
|||
|
|||
def main(): |
|||
while True: |
|||
os.system('clear') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('CLI version 0.2\n', 'green')) |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
# We have to call KMD specific functions with connection to KMD daemon |
|||
elif list(menuItems[int(choice)].keys())[0] == "Connect to KMD daemon": |
|||
rpc_connection_kmd = list(menuItems[int(choice)].values())[0]() |
|||
elif list(menuItems[int(choice)].keys())[0] == "Check connection to KMD": |
|||
while True: |
|||
try: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection_kmd) |
|||
break |
|||
except Exception as e: |
|||
print("Please connect to KMD daemon first!") |
|||
input("Press [Enter] to continue...") |
|||
break |
|||
elif list(menuItems[int(choice)].keys())[0] == "Send KMD gateway deposit transaction": |
|||
while True: |
|||
try: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection_kmd) |
|||
break |
|||
except Exception as e: |
|||
print(e) |
|||
print("Please connect to KMD daemon first!") |
|||
input("Press [Enter] to continue...") |
|||
break |
|||
elif list(menuItems[int(choice)].keys())[0] == "Execute gateways deposit": |
|||
while True: |
|||
try: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection, rpc_connection_kmd) |
|||
break |
|||
except Exception as e: |
|||
print(e) |
|||
print("Please connect to KMD daemon first!") |
|||
input("Press [Enter] to continue...") |
|||
break |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
try: |
|||
print(tuilib.colorize("Welcome to the GatewaysCC TUI!\nPlease provide RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.rpc_connection_tui() |
|||
rpclib.getinfo(rpc_connection) |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to RPC! Please re-check credentials.", "pink")) |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
@ -1,68 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
|
|||
|
|||
header = "\ |
|||
___ ___ _____ _ _ _____ \n\ |
|||
| \/ | |_ _| | | |_ _|\n\ |
|||
| . . | __ _ _ __ _ __ ___ __ _ _ __ __ _ | | | | | | | |\n\ |
|||
| |\/| |/ _` | '__| '_ ` _ \ / _` | '__/ _` | | | | | | | | |\n\ |
|||
| | | | (_| | | | | | | | | (_| | | | (_| | | | | |_| |_| |_\n\ |
|||
\_| |_/\__,_|_| |_| |_| |_|\__,_|_| \__,_| \_/ \___/ \___/\n" |
|||
|
|||
|
|||
menuItems = [ |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Check MARMARA info": tuilib.marmara_info_tui}, |
|||
{"Lock funds for MARMARA": tuilib.marmara_lock_tui}, |
|||
{"Request MARMARA cheque": tuilib.marmara_receive_tui}, |
|||
{"Issue MARMARA cheque": tuilib.marmara_issue_tui}, |
|||
{"Check credit loop status": tuilib.marmara_creditloop_tui}, |
|||
{"Settle MARMARA loop": tuilib.marmara_settlement_tui}, |
|||
{"Exit": exit} |
|||
] |
|||
|
|||
|
|||
def main(): |
|||
while True: |
|||
os.system('clear') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('CLI version 0.1\n', 'green')) |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
chain = input("Input assetchain name (-ac_name= value) you want to work with: ") |
|||
try: |
|||
print(tuilib.colorize("Welcome to the MarmaraCC TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.def_credentials(chain) |
|||
rpclib.getinfo(rpc_connection) |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to RPC! Please re-check credentials.", "pink")) |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
@ -1,67 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
|
|||
header = "\ |
|||
_____ _ _____ _____ \n\ |
|||
| _ | | | / __ \/ __ \\\n\ |
|||
| | | | _ __ __ _ ___ | | ___ ___ | / \/| / \/\n\ |
|||
| | | || '__| / _` | / __|| | / _ \/ __|| | | |\n\ |
|||
\ \_/ /| | | (_| || (__ | || __/\__ \| \__/\| \__/\\\n\ |
|||
\___/ |_| \__,_| \___||_| \___||___/ \____/ \____/\n" |
|||
|
|||
menuItems = [ |
|||
# TODO: Have to implement here native oracle file uploader / reader, should be dope |
|||
# TODO: data publisher / converter for different types |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Create oracle": tuilib.oracle_create_tui}, |
|||
{"Register as publisher for oracle": tuilib.oracle_register_tui}, |
|||
{"Subscribe on oracle (+UTXO generator)": tuilib.oracle_subscription_utxogen}, |
|||
{"Upload file to oracle": tuilib.convert_file_oracle_D}, |
|||
{"Display list of files uploaded to this AC": tuilib.display_files_list}, |
|||
{"Download files from oracle": tuilib.files_downloader}, |
|||
{"Exit": exit} |
|||
] |
|||
|
|||
|
|||
def main(): |
|||
while True: |
|||
os.system('clear') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('CLI version 0.2 by Anton Lysakov\n', 'green')) |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
try: |
|||
print(tuilib.colorize("Welcome to the GatewaysCC TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.rpc_connection_tui() |
|||
rpclib.getinfo(rpc_connection) |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to RPC! Please re-check credentials.", "pink")) |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
@ -1,116 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
import sys |
|||
import platform |
|||
|
|||
header = "\ |
|||
______ _____ _____ \n\ |
|||
| ___ \ / __ \/ __ \\\n\ |
|||
| |_/ /___ __ _ _ _ ___| / \/| / \/\n\ |
|||
| // _ \ / _` | | | |/ _ \ | | |\n\ |
|||
| |\ \ (_) | (_| | |_| | __/ \__/\| \__/\\\n\ |
|||
\_| \_\___/ \__, |\__,_|\___|\____/ \____/\n\ |
|||
__/ |\n\ |
|||
|___/\n" |
|||
|
|||
|
|||
menuItems = [ |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Check my warriors list": tuilib.print_players_list}, |
|||
{"Transfer warrior to other pubkey": tuilib.warrior_trasnfer}, |
|||
{"TOP-20 ROGUE Warriors": tuilib.top_warriors_rating}, |
|||
{"Set warriors name": tuilib.set_warriors_name}, |
|||
{"Start singleplayer training game (creating, registering and starting game)": tuilib.rogue_newgame_singleplayer}, |
|||
{"Create multiplayer game": tuilib.rogue_newgame_multiplayer}, |
|||
{"Join (register) multiplayer game": tuilib.rogue_join_multiplayer_game}, |
|||
{"Check my multiplayer games status / start": tuilib.play_multiplayer_game}, |
|||
{"Check if somebody wants to buy your warrior (incoming bids)": tuilib.print_icoming_bids}, |
|||
{"Place order to sell warrior": tuilib.sell_warrior}, |
|||
{"Place order to buy someones warrior": tuilib.place_bid_on_warriror}, |
|||
{"Check if somebody selling warrior": tuilib.find_warriors_asks}, |
|||
{"Check / cancel my warriors trade orders": tuilib.warriors_orders_check}, |
|||
# {"Manually exit the game (bailout)": "test"}, |
|||
# {"Manually claim ROGUE coins for game (highlander)": "test"}, |
|||
{"Exit": tuilib.exit} |
|||
] |
|||
|
|||
def main(): |
|||
while True: |
|||
operating_system = platform.system() |
|||
if operating_system != 'Win64' and operating_system != 'Windows': |
|||
os.system('clear') |
|||
else: |
|||
os.system('cls') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('TUI v0.0.3\n', 'green')) |
|||
menu_items_counter = 0 |
|||
for item in menuItems: |
|||
if menu_items_counter == 0: |
|||
print("\nUtility:\n") |
|||
menu_items_counter = menu_items_counter + 1 |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
if menu_items_counter == 6: |
|||
print("\nNew singleplayer game:\n") |
|||
if menu_items_counter == 7: |
|||
print("\nMultiplayer games:\n") |
|||
if menu_items_counter == 10: |
|||
print("\nDEX features:\n") |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
chain = "ROGUE" |
|||
try: |
|||
print(tuilib.colorize("Welcome to the RogueCC TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.def_credentials(chain) |
|||
rpclib.getinfo(rpc_connection) |
|||
# waiting until chain is in sync |
|||
while True: |
|||
have_blocks = rpclib.getinfo(rpc_connection)["blocks"] |
|||
longest_chain = rpclib.getinfo(rpc_connection)["longestchain"] |
|||
if have_blocks != longest_chain: |
|||
print(tuilib.colorize("ROGUE not synced yet.", "red")) |
|||
print("Have " + str(have_blocks) + " from " + str(longest_chain) + " blocks") |
|||
time.sleep(5) |
|||
else: |
|||
print(tuilib.colorize("Chain is synced!", "green")) |
|||
break |
|||
# checking if pubkey is set and set valid if not |
|||
info = rpclib.getinfo(rpc_connection) |
|||
if "pubkey" in info.keys(): |
|||
print("Pubkey is already set") |
|||
else: |
|||
valid_address = rpc_connection.getaccountaddress("") |
|||
valid_pubkey = rpc_connection.validateaddress(valid_address)["pubkey"] |
|||
rpc_connection.setpubkey(valid_pubkey) |
|||
print(tuilib.colorize("Pubkey is succesfully set!", "green")) |
|||
# copy ROGUE config to current daemon directory if it's not here |
|||
tuilib.check_if_config_is_here(rpc_connection, "ROGUE") |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to ROGUE daemon RPC! Please check if daemon is up.", "pink")) |
|||
tuilib.exit() |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
@ -1,96 +0,0 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
from lib import rpclib, tuilib |
|||
import os |
|||
import time |
|||
import sys |
|||
import platform |
|||
|
|||
header = "\ |
|||
_____ _ _ ______\n\ |
|||
|_ _| | | (_) | _ \n\ |
|||
| | ___| |_ _ __ _ ___| | | |__ _ _ __ _ __\n\ |
|||
| |/ _ \ __| '__| / __| | | / _` | '_ \| '_ \\\n\ |
|||
| | __/ |_| | | \__ \ |/ / (_| | |_) | |_) |\n\ |
|||
\_/\___|\__|_| |_|___/___/ \__,_| .__/| .__/\n\ |
|||
| | | |\n\ |
|||
|_| |_|" |
|||
|
|||
|
|||
menuItems = [ |
|||
{"Check current connection": tuilib.getinfo_tui}, |
|||
{"Check mempool": tuilib.print_mempool}, |
|||
{"Start singleplayer tetris game (creating, registering and starting game)": tuilib.rogue_newgame_singleplayer}, |
|||
{"Exit": tuilib.exit} |
|||
] |
|||
|
|||
|
|||
def main(): |
|||
while True: |
|||
operating_system = platform.system() |
|||
if operating_system != 'Win64' and operating_system != 'Windows': |
|||
os.system('clear') |
|||
else: |
|||
os.system('cls') |
|||
print(tuilib.colorize(header, 'pink')) |
|||
print(tuilib.colorize('TUI v0.0.3\n', 'green')) |
|||
menu_items_counter = 0 |
|||
for item in menuItems: |
|||
print(tuilib.colorize("[" + str(menuItems.index(item)) + "] ", 'blue') + list(item.keys())[0]) |
|||
choice = input(">> ") |
|||
try: |
|||
if int(choice) < 0: |
|||
raise ValueError |
|||
# Call the matching function |
|||
if list(menuItems[int(choice)].keys())[0] == "Exit": |
|||
list(menuItems[int(choice)].values())[0]() |
|||
elif list(menuItems[int(choice)].keys())[0] == "Start singleplayer tetris game (creating, registering and starting game)": |
|||
list(menuItems[int(choice)].values())[0](rpc_connection, False) |
|||
else: |
|||
list(menuItems[int(choice)].values())[0](rpc_connection) |
|||
except (ValueError, IndexError): |
|||
pass |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
while True: |
|||
chain = "GTEST" |
|||
try: |
|||
print(tuilib.colorize("Welcome to the Tetris TUI!\n" |
|||
"Please provide asset chain RPC connection details for initialization", "blue")) |
|||
rpc_connection = tuilib.def_credentials(chain) |
|||
rpclib.getinfo(rpc_connection) |
|||
# waiting until chain is in sync |
|||
while True: |
|||
have_blocks = rpclib.getinfo(rpc_connection)["blocks"] |
|||
longest_chain = rpclib.getinfo(rpc_connection)["longestchain"] |
|||
if have_blocks != longest_chain: |
|||
print(tuilib.colorize("GTEST not synced yet.", "red")) |
|||
print("Have " + str(have_blocks) + " from " + str(longest_chain) + " blocks") |
|||
time.sleep(5) |
|||
else: |
|||
print(tuilib.colorize("Chain is synced!", "green")) |
|||
break |
|||
# checking if pubkey is set and set valid if not |
|||
info = rpclib.getinfo(rpc_connection) |
|||
if "pubkey" in info.keys(): |
|||
print("Pubkey is already set") |
|||
else: |
|||
valid_address = rpc_connection.getaccountaddress("") |
|||
valid_pubkey = rpc_connection.validateaddress(valid_address)["pubkey"] |
|||
rpc_connection.setpubkey(valid_pubkey) |
|||
print(tuilib.colorize("Pubkey is succesfully set!", "green")) |
|||
# copy ROGUE config to current daemon directory if it's not here |
|||
tuilib.check_if_config_is_here(rpc_connection, "GTEST") |
|||
except Exception: |
|||
print(tuilib.colorize("Cant connect to GTEST daemon RPC! Please check if daemon is up.", "pink")) |
|||
tuilib.exit() |
|||
else: |
|||
print(tuilib.colorize("Succesfully connected!\n", "green")) |
|||
with (open("lib/logo.txt", "r")) as logo: |
|||
for line in logo: |
|||
print(line, end='') |
|||
time.sleep(0.04) |
|||
print("\n") |
|||
break |
|||
main() |
Loading…
Reference in new issue