Last active
December 23, 2018 07:21
-
-
Save cryptozeny/ee608238efe421b750dacfdc72ec8cc5 to your computer and use it in GitHub Desktop.
Get ExtraNonce & Nonce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#getExtraNonce | |
#!/bin/bash | |
Hash=NULL && \ | |
Tx=NULL && \ | |
RawTx=NULL && \ | |
DecodeRawTx=NULL && \ | |
ExtraNonce=NULL && \ | |
Nonce=NULL && \ | |
printf "%-16s %-16s \n" ExtraNonce Nonce && \ | |
for(( i=2; i<= 12; i++ )); do | |
Hash=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblockhash $i) && \ | |
Tx=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblock $Hash | jq -r '.tx[]') && \ | |
Nonce=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblock $Hash | jq -r .nonce) && \ | |
RawTx=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getrawtransaction $Tx) && \ | |
Coinbase=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password decoderawtransaction $RawTx | jq -r '.vin[].coinbase') && \ | |
ExtraNonce=$(echo $Coinbase | cut -c4- | rev | cut -c3-) && \ | |
printf "%-16s 0x%-16x \n" $Coinbase $Nonce | |
done | |
#jsonFormat | |
#!/bin/bash | |
Hash=NULL && \ | |
Tx=NULL && \ | |
RawTx=NULL && \ | |
DecodeRawTx=NULL && \ | |
ExtraNonce=NULL && \ | |
Nonce=NULL && \ | |
echo "{ExtraNonce, Nonce}" && \ | |
for(( i=17; i < 137; i++ )); do | |
Hash=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblockhash $i) && \ | |
Tx=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblock $Hash | jq -r '.tx[]') && \ | |
Nonce=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getblock $Hash | jq -r .nonce) && \ | |
RawTx=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password getrawtransaction $Tx) && \ | |
Coinbase=$(./src/sugarchain-cli -rpcuser=username -rpcpassword=password decoderawtransaction $RawTx | jq -r '.vin[].coinbase') && \ | |
ExtraNonce=$(echo $Coinbase | cut -c4- | rev | cut -c3-) && \ | |
#printf "{%s, 0x%x}, " $Coinbase $Nonce | |
printf "{%s, 0x%x}, " $Coinbase $Nonce | |
if (( $i %4 == 0 )); then | |
printf "\n"; | |
fi; | |
done && \ | |
printf "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExtraNonce Nonce | |
0102 0xc65555d5 | |
0103 0x11140080 | |
0104 0xdd5e5555 | |
0105 0xa7070000 | |
0106 0xab080080 | |
0107 0xfe020080 | |
0108 0x84000000 | |
0109 0xbf605555 | |
010a 0x2cafaa2a | |
010b 0xa3585555 | |
010c 0xffaaaaaa | |
{ExtraNonce, Nonce} | |
{0111, 0x6b5b55d5}, {0112, 0x40040000}, {0113, 0xaeaeaa2a}, {0114, 0xf2020080}, | |
{0115, 0x67040080}, {0116, 0x80070080}, {0117, 0xa7adaaaa}, {0118, 0x365d5555}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment