grondilu / bitcoin-bash-tools Goto Github PK
View Code? Open in Web Editor NEWSet of bitcoin-related bash functions
Set of bitcoin-related bash functions
The fix for #50 can break old openssl versions.
openssl version
OpenSSL 1.1.1f 31 Mar 2020
openssl dgst -provider legacy -rmd160 -binary
dgst: Unrecognized flag provider
dgst: Use -help for summary.
$ openssl version
OpenSSL 3.0.5 5 Jul 2022 (Library: OpenSSL 3.0.5 5 Jul 2022)
$ openssl dgst -rmd160
Error setting digest
405C2EFE457F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:349:Global default library context, Algorithm (RIPEMD160 : 96), Properties ()
405C2EFE457F0000:error:03000086:digital envelope routines:evp_md_init_internal:initialization error:crypto/evp/digest.c:252:
This completely breaks bitcoin-bash-tools, I'll see what can be done.
一、我查询了版本号,是3.2.57
192:~ hufeng$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.
二、运行更新命令,但更新不成功
192:~ hufeng$ brew update && brew install bash
-bash: brew: command not found
需要怎样解决?
output appears like so:
bash-4.2$ encodeBase58 00a839606e0a6dfb8c73195e36e7adfde1ddd7130e
1
3Lw2EX9dFL9EgpuGnyVJR59zfr8M
This is under bash-4.2 on OS X Mavericks.
This bug in turn affects hexToAddress() and newBitcoinKey(), providing confusing output...
Hi grondilu, this is a great project and excellent implementation you have, I was wondering if it is possbile to also create the bech32 address? I am not sure if that is even feasible. I checked previous issues and commits and it hasn't come up yet as far as I can tell.
Hello,
Sorry to disturb you, but i'm just beginning with bitcoin keys.
I was planning to use this script in order to find "lost" pub keys from private, but I can't manage to put it to work by using this script...
Could you explain to me how to achieve what i'm looking for?
Thank you for your time, and for your response...
Hi,
thank you for your work on porting the bech32 function to pure bash. Question, would it be possible to use this also for other blockchains?
I would like to use your bech32_encode/decode functions to rebuild the following:
./bech32 stake <<< "e1876c8abaa636168c7d43623be103c6bfffcfb0337c05ffd1a7ea72e5"
stake1uxrkez465cmpdrragd3rhcgrc6lllnasxd7qtl735l489egx9yfxe
./bech32 <<< "stake1uxrkez465cmpdrragd3rhcgrc6lllnasxd7qtl735l489egx9yfxe"
e1876c8abaa636168c7d43623be103c6bfffcfb0337c05ffd1a7ea72e5
In this example a precompiled external binary (bech32) was used to encode/decode between a bech32 string and the hex-representation. Would it be possible with your routines to achieve the same results somehow?
Best regards, Martin
t/bip-0173.t ......... t/bip-0173.t: line 25: correct_segwit_addresses: BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4: must use subscript when assigning associative array
t/bip-0173.t: line 25: correct_segwit_addresses: 0014751e76e8199196d454941c45d1b3a323f1433bd6: must use subscript when assigning associative array
t/bip-0173.t: line 25: correct_segwit_addresses: tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7: must use subscript when assigning associative array
...
$ echo $BASH_VERSION
4.2.45(2)-release
$ bitcoin.sh
This script requires bash version 4 or above.
bitcoin.sh: line 20: return: can only `return' from a function or sourced script
This is on OS X 10.8.4 with bash compiled from MacPorts, if it makes any difference.
This is defacto one of my favourite Bitcoin-related projects, and I share the hope to have"offline wallet" capabilities using common GNU tools, I have been following since reading this bitcointalk thread long ago.
For some time have been trying to make functions for signing/verifying BTC messages using openssl. While this is possible when the keys exist in pem format and one operates on binary sig - it works. Still trying to wrap head around how to verify standard compact BTC sigs using bash/tools alone.
Thanks again for these very useful tools.
Pointed out by @mountaineerbr by mail.
testEncoding() { pack "$(decodeBase58 "$(encodeBase58 "$(echo "$1" |unpack)")")"; }
$ testEncoding foo
foo
$ testEncoding "\tfoo"
�f��[
Not critical, but still annoying.
$ bitcoinAddress 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip78q4h8QmfB6MwMuF1
gives:
1JTUng4hGuPqbbjbkuoyS6BnEXKii6aXV7
which is NOT the public key bitcoin address associated with this private key.
The public key bitcoin address is:
1NpYjtLira16LfGbGwZJ5JbDPh3ai9bjf4
Any idea why it gives the wrong public key bitcoin address?
Hi, I've tried to download and run the script on Ubuntu 18.04 LTS (and older Ubuntu versions) with no luck. It's a bootable USB evaluation version of Ubuntu. I've tried several commands on the terminal with no luck. I need some help.
I think you have an error when computing the public address for a compressed keypair. It doesn't match with what openssl does at least. I have included a patch
diff --git a/bitcoin.sh b/bitcoin.sh
old mode 100644
new mode 100755
index 1ea0f0b..9f67947
--- a/bitcoin.sh
+++ b/bitcoin.sh
@@ -91,7 +91,7 @@ newBitcoinKey() {
else y_parity="03"
fi
uncompressed_addr="$(hexToAddress "$(perl -e "print pack q(H*), q(04$X$Y)" | hash160)")"
- compressed_addr="$(hexToAddress "$(perl -e "print pack q(H*), q(03$X$y_parity)" | hash160)")"
+ compressed_addr="$(hexToAddress "$(perl -e "print pack q(H*), q($y_parity$X)" | hash160)")"
echo ---
echo "secret exponant: 0x$exponant"
echo "public key:"
. bitcoin-bash-tools/bitcoin.sh
This script requires bash version 4 or above.
Saving session...
...copying shared history...
...saving history...
...completed.
Deleting expired sessions...25 completed.
[Process completed]
Great project, thanks! Trying to find the simplest possible way to generate an address and private key for sweeping bitcoin out of exchanges for safe hodling.
In the README.md
https://github.com/grondilu/bitcoin-bash-tools/blame/master/README.md#L29
lines 29-31
what are these "entropy"? How do we issue those three command lines?
$ bip32 m < entropy
$ bip32 m/n < entropy
$ bip32 m/0h/5/7 < entropy
I'm sure those led to these:
...
$ prove -e bash t/*.t.sh
...
wrong checksum : instead of clump
parameters have insufficient entropy or wrong format
parameters have insufficient entropy or wrong format
undocumented error
wrong checksum : instead of unfold
t/bip-0039.t.sh ... Failed 24/96 subtests
t/bip-0173.t.sh ... ok
t/bip-0350.t.sh ... ok
t/secp256k1.t.sh .. ok
Test Summary Report
-------------------
t/bip-0039.t.sh (Wstat: 0 Tests: 96 Failed: 24)
Failed tests: 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41
45, 49, 53, 57, 61, 65, 69, 73, 77, 81
85, 89, 93
Files=6, Tests=194, 190 wallclock secs ( 0.11 usr 0.01 sys + 173.99 cusr 13.61 csys = 187.72 CPU)
Result: FAIL
im trying this on zsh shell
trying to source the bitcoin.sh file and noticed the base58 function returned
some errors and unset it as i already have a base58 binary in my PATH
with exact same operations, only thing i got sourced was the wif() function
maybe these functions should be in separate files with the huge mnemonic
lists
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.