Pages:
Author

Topic: sx command line utilities - Empower The Sysadmin With Bitcoin Tools (Read 240135 times)

legendary
Activity: 1946
Merit: 1009
SELL bitcoinmarket.net | bitcoinitalia.com SELL
mmm..
Code:
 --> Updating libbitcoin...

Current branch version1 is up to date.

 --> Beginning build process now....

Si è già su 'version1'
Your branch is up-to-date with 'origin/version1'.
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
sr. member
Activity: 458
Merit: 250
From nothing to nothing
Checking this out today. Very interesting. Good luck to the creator.
sr. member
Activity: 406
Merit: 251
http://altoidnerd.com
Heres the kicker...

Code:
$ echo -n "ok" | openssl dgst -sha256
2689367b205c16ce32ed4200942b8b8b1e262dfc70d9bc9fbc77c49699a4f1df

edit - issue opened here https://github.com/spesmilo/sx/issues/95
sr. member
Activity: 406
Merit: 251
http://altoidnerd.com
This seems odd.  I cannot understand why sx seems to disagree with vbuterin/pybitcointools (https://github.com/vbuterin/pybitcointools)

If you need to install pybitcointools do
Code:
$ git clone https://github.com/vbuterin/pybitcointools
$ cd pybitcointools
$ chmod +x setup.py
$ ./setup.py install

I am not getting the same result for simple sha256 hashes from pybitcointools and sx.  See:

Code:
$ python
>>> from bitcoin import *
>>> x=sha256('ok')
>>> x
'2689367b205c16ce32ed4200942b8b8b1e262dfc70d9bc9fbc77c49699a4f1df'
>>>quit()
$

sx gives something else...or am i stupid?

Code:

$ sx sha256 ok
6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d
$ sx sha256 'ok'
6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d


Why?
full member
Activity: 233
Merit: 100
I cannot get the code from http://sx.dyne.org/offlinetx.html to run:

Code:
$ DECODED_ADDR=$(cat private.key | sx addr | sx decode-addr)
$ PREVOUT_SCRIPT=$(sx rawscript dup hash160 [ $DECODED_ADDR ] equalverify checksig)
$ SIGNATURE=$(cat private.key | sx sign-input txfile.tx 0 $PREVOUT_SCRIPT)
$ sx rawscript [ $SIGNATURE ] [ $(cat private.key | sx pubkey) ] | sx set-input txfile.tx 0 > signed-tx
$ sx showtx signed-tx
hash: 4a8be467fb75f0f757649348dbb05762142236ec236ac9e55e4683d7083ffca2
version: 1  locktime: 0
Input:
  previous output:
97e06e49dfdd26c5a904670971ccf4c7fe7d9da53cb379bf9b442fc9427080b3:1
  script: [
304602210083f8b5131f6399cdc01ed8368f6137f288f771e40834a94d65cee6b380fec873022100da5ed6d1d283f228752a88c2d6f629587b2a6fbc102202ae7c20f48af7c0533c01
] [
04e3af7cdfaab6ba2f14001a7ea0a490f40c6ba43607be92a05111d2e8fc1eecf6fa2c248b3e25ddf7db081684f6f49dc83fd7b9b5a3a88a2e6b83b918f8972351
]  sequence: 4294967295
  address: 134HfD2fdeBTohfx8YANxEpsYXsv5UoWyz
Output:
  value: 90000
  script: dup hash160 [ 18c0bd8d1818f1bf99cb1df2269c645318ef7b73 ] equalverify
checksig
  address: 13Ft7SkreJY9D823NPm4t6D1cBqLYTJtAe

Error returned is similar to (haven't got it in front of me):

Code:
sx set-input FILENAME N SIGANDPUBKEYSCRIPT

Running sx set-input txfile.tx 0 `cat rawscript.tx` or even
Code:
sx set-input txfile.tx 0 4730......
(where 4730 is the sig/pubkey script) ... it won't work

Any advice?


TL;DR:

Code:
sx rawscript [ $SIGNATURE ] [ $(cat private.key | sx pubkey) ] | sx set-input txfile.tx 0 > signed-tx

This code from the eg doesn't work (and variants of it)
full member
Activity: 233
Merit: 100

I had the same issue and fixed it.

Make sure you have:
1- secp256k1 installed
2- libbitcoin installed

To install secp256k1:
Code:
$ git clone https://github.com/bitcoin/secp256k1
$ cd secp256k1
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

To install libbitcoin:
Code:
$ git clone https://github.com/libbitcoin/libbitcoin
$ cd libbitcoin
$ autoreconf -i
$ ./configure --enable-leveldb
$ make
$ sudo make install
$ sudo ldconfig

You will likely need to do the following as well:
Code:
$ sudo apt-get install build-essential autoconf automake libtool libboost-all-dev pkg-config libcurl4-openssl-dev libleveldb-dev libssl-dev

I did get it to work; between this reply (which I just saw) and a question on Stack Exchange it's all up and running.

I should add, while I understand these tools aren't meant to be for the complete newb, I have found them exceedingly difficult to use. Documentation scarce at best...

For eg,
Code:
sx history `cat addr`

(ie history of outputs for an address will just not work)
hero member
Activity: 658
Merit: 501
Awesome, I can't wait to start testing. Grin
legendary
Activity: 1232
Merit: 1076
we're working on the server a lot, see this:
https://wiki.unsystem.net/en/index.php/Libbitcoin/Blockchain/htdb_slab_Performance

here are the development repos:
https://github.com/libbitcoin/libbitcoin-explorer (formerly sx)
https://github.com/libbitcoin/libbitcoin-server (formerly Obelisk)

sx has basically been rewritten by eric voskuil, and the server will undergo more improvements too (see https://github.com/libbitcoin/libbitcoin-protocol ) which will allow SPV for wallets with the new protocol.
newbie
Activity: 50
Merit: 0
hey so just an update as to what's going on:
- Obelisk has been renamed to libbitcoin-server and is undergoing lots of changes.
- libbitcoin has a new faster blockchain backend.
- SX is renamed to libbitcoin-explorer and has been improved.
we're still working on testing & improving the software, but once that's complete, there will be a new release.
sorry about all the troubles.

Sounds great, thank you for your hard work. I look forward to firing up the VMs again soon and trying it out.
full member
Activity: 168
Merit: 100
hey so just an update as to what's going on:
- Obelisk has been renamed to libbitcoin-server and is undergoing lots of changes.
- libbitcoin has a new faster blockchain backend.
- SX is renamed to libbitcoin-explorer and has been improved.
we're still working on testing & improving the software, but once that's complete, there will be a new release.
sorry about all the troubles.

No problem at all, we really appreciate the work that you guys put into this. Do you know when we will have access to this new release? Is it already on GitHub?

Are you guys aware that obelisk-server's syncing routine stalls in certain cases? I had to write a script to make sure that obelisk processes at least 5 blocks per minute, and if that's not the case, restarts it in order to continue syncing.

I suspect this is happening due to the following error that's exposed to the user:

Code:
Failed to store transaction in mempool : Spent input not found
legendary
Activity: 1232
Merit: 1076
hey so just an update as to what's going on:
- Obelisk has been renamed to libbitcoin-server and is undergoing lots of changes.
- libbitcoin has a new faster blockchain backend.
- SX is renamed to libbitcoin-explorer and has been improved.
we're still working on testing & improving the software, but once that's complete, there will be a new release.
sorry about all the troubles.
full member
Activity: 168
Merit: 100
hero member
Activity: 793
Merit: 1016
full member
Activity: 168
Merit: 100
full member
Activity: 233
Merit: 100
Can someone kindly advise me what the issue is with Ubuntu 14 LTS installation? I'm a Ubuntu newbie but have followed the instructions and running sudo bash ./install-sx.sh file from / (root) always gives this install error:

Code:
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=c++11... yes
checking whether make supports nested variables... (cached) yes
checking --enable-testnet argument... no
checking for boostlib >= 1.20.0... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for SSL... yes
checking for CURL... yes
checking for libsecp256k1... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/bitcoin/Makefile
config.status: creating src/Makefile
config.status: creating libbitcoin.pc
config.status: executing depfiles commands
config.status: executing libtool commands
configure: WARNING: unrecognized options: --with-libsecp256k1
Making all in include/bitcoin
make[1]: Entering directory `/usr/local/src/libbitcoin-git/include/bitcoin'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/src/libbitcoin-git/include/bitcoin'
Making all in src
make[1]: Entering directory `/usr/local/src/libbitcoin-git/src'
  CXX      utility/ec_keys.lo
utility/ec_keys.cpp: In function 'libbitcoin::ec_point libbitcoin::secret_to_public_key(const ec_secret&, bool)':
utility/ec_keys.cpp:66:23: error: 'secp256k1_ecdsa_pubkey_create' was not declared in this scope
             compressed))
                       ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_public_key(const ec_point&)':
utility/ec_keys.cpp:75:78: error: 'secp256k1_ecdsa_pubkey_verify' was not declared in this scope
     return secp256k1_ecdsa_pubkey_verify(public_key.data(), public_key.size());
                                                                              ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_private_key(const ec_secret&)':
utility/ec_keys.cpp:81:60: error: 'secp256k1_ecdsa_seckey_verify' was not declared in this scope
     return secp256k1_ecdsa_seckey_verify(private_key.data());
                                                            ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_tweak_add(libbitcoin::ec_point&, const ec_secret&)':
utility/ec_keys.cpp:115:73: error: 'secp256k1_ecdsa_pubkey_tweak_add' was not declared in this scope
     return secp256k1_ecdsa_pubkey_tweak_add(a.data(), a.size(), b.data());
                                                                         ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_multiply(libbitcoin::ec_point&, const ec_secret&)':
utility/ec_keys.cpp:121:73: error: 'secp256k1_ecdsa_pubkey_tweak_mul' was not declared in this scope
     return secp256k1_ecdsa_pubkey_tweak_mul(a.data(), a.size(), b.data());
                                                                         ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_add(libbitcoin::ec_secret&, const ec_secret&)':
utility/ec_keys.cpp:127:64: error: 'secp256k1_ecdsa_privkey_tweak_add' was not declared in this scope
     return secp256k1_ecdsa_privkey_tweak_add(a.data(), b.data());
                                                                ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_multiply(libbitcoin::ec_secret&, const ec_secret&)':
utility/ec_keys.cpp:133:64: error: 'secp256k1_ecdsa_privkey_tweak_mul' was not declared in this scope
     return secp256k1_ecdsa_privkey_tweak_mul(a.data(), b.data());
                                                                ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_public_key(const ec_point&)':
utility/ec_keys.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_private_key(const ec_secret&)':
utility/ec_keys.cpp:82:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_tweak_add(libbitcoin::ec_point&, const ec_secret&)':
utility/ec_keys.cpp:116:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_multiply(libbitcoin::ec_point&, const ec_secret&)':
utility/ec_keys.cpp:122:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_add(libbitcoin::ec_secret&, const ec_secret&)':
utility/ec_keys.cpp:128:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_multiply(libbitcoin::ec_secret&, const ec_secret&)':
utility/ec_keys.cpp:134:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [utility/ec_keys.lo] Error 1
make[1]: Leaving directory `/usr/local/src/libbitcoin-git/src'
make: *** [all-recursive] Error 1
sim@ubuntu:/$ sx
The program 'sx' is currently not installed. You can install it by typing:
sudo apt-get install lrzsz

Everything is fine up until this point.

Any help would be greatly appreciated; have literally spent 2 days trying to work this out with LTS 12 now LTS 14 (ie I'm not here as first resort, I've RTFM!)

TL;DR:

Ubuntu 14 LTS, how to fix this error?

Code:
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_multiply(libbitcoin::ec_secret&, const ec_secret&)':
utility/ec_keys.cpp:133:64: error: 'secp256k1_ecdsa_privkey_tweak_mul' was not declared in this scope
     return secp256k1_ecdsa_privkey_tweak_mul(a.data(), b.data());
                                                                ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_public_key(const ec_point&)':
utility/ec_keys.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::verify_private_key(const ec_secret&)':
utility/ec_keys.cpp:82:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
utility/ec_keys.cpp: In function 'bool libbitcoin::ec_tweak_add(libbitcoin::ec_point&, const ec_secret&)':
utility/ec_keys.cpp:116:1: warning: control reaches end of non-void function [-Wreturn-type]
full member
Activity: 168
Merit: 100
I'm now on my fifth attempt using 2 different servers (one a pretty much clean Debian VM and one an established server).. every time I get nearly to the end of the blockchain sync it just seems to sit around not receiving new blocks and spewing reams of errors such as below. I'm assuming blockchain database corruption but it always seems to be somewhere in the 27#### block range (I've just noticed this). Is this normal? Is there maybe something about this range of blocks, was that when someone was spamming the blockchain? Getting a bit frustrated here sapping so much time and bandwidth and still haven't got a sync'd copy to play with. I don't want to download a torrent copy.


WARNING: Error storing memory pool transaction c0c958698d61b260a885115a7e2ccec1a25c8a121c0da9ec6165f0ce11920c9b: Spent input not found


I am having this exact same issue on Ubuntu 64 (latest version) running in VirtualBox on my MacBook Pro Retina.  I have 70GB of SSD and 6GB RAM allocated to the VM.  The block chain has simply stopped updating at right around 300,000 block height.  What solved this problem for you?

I'm afraid nothing solved the problem for me, I gave it a good go but submitted defeat assuming that the h/ware I was using was too slow. I'll try again though one day when I have spare hardware in the hope that whatever caused it is solved.

I'm now on my fifth attempt using 2 different servers (one a pretty much clean Debian VM and one an established server).. every time I get nearly to the end of the blockchain sync it just seems to sit around not receiving new blocks and spewing reams of errors such as below. I'm assuming blockchain database corruption but it always seems to be somewhere in the 27#### block range (I've just noticed this). Is this normal? Is there maybe something about this range of blocks, was that when someone was spamming the blockchain? Getting a bit frustrated here sapping so much time and bandwidth and still haven't got a sync'd copy to play with. I don't want to download a torrent copy.


WARNING: Error storing memory pool transaction c0c958698d61b260a885115a7e2ccec1a25c8a121c0da9ec6165f0ce11920c9b: Spent input not found


I am having this exact same issue on Ubuntu 64 (latest version) running in VirtualBox on my MacBook Pro Retina.  I have 70GB of SSD and 6GB RAM allocated to the VM.  The block chain has simply stopped updating at right around 300,000 block height.  What solved this problem for you?

I was having the same problem and I even have the same configuration with the MBP Retina.

It has nothing to do with the hardware or virtualization. It has to do with the systemwide file descriptor limits. Linux limits the number of files a process can have open and how many files can be open globally.

While excessively lenient of a policy, applying these settings wiil fix the issue:
Code:
sysctl -w fs.file-max=409600
echo "fs.file-max=409600" >> /etc/sysctl.conf
ulimit -n 409600
echo "$USER soft nofile 409600" >> /etc/security/limits.conf
echo "$USER hard nofile 409600" >> /etc/security/limits.conf
newbie
Activity: 50
Merit: 0
Change to obelisk.coinkite.com:9091 or another from https://wiki.unsystem.net/en/index.php/Obelisk/Servers

Using the coinkite one I get..

Code:
sx balance 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
Address: 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
  Paid balance:    10000000
  Pending balance: 10000000
  Total received:  190000000


thank you that worked for me.

sometimes getting:
after sx balance address quyery

Assertion failed: ok (mailbox.cpp:82)
Resource temporarily unavailable (signaler.cpp:236)



Probably a rate limiter as it's a public server, I believe using obelisk balancer you can specify more than one public server and it will balance the queries. Whether it does auto-failover or weighted balancing I don't know off the top of my head. Or you could go back to trying to install a local obelisk server, then you wouldn't need the public ones. I'm no expert, just trying to help, give the website/docs a read.


hero member
Activity: 708
Merit: 502
Change to obelisk.coinkite.com:9091 or another from https://wiki.unsystem.net/en/index.php/Obelisk/Servers

Using the coinkite one I get..

Code:
sx balance 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
Address: 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
  Paid balance:    10000000
  Pending balance: 10000000
  Total received:  190000000


thank you that worked for me.

sometimes getting:
after sx balance address quyery

Assertion failed: ok (mailbox.cpp:82)
Resource temporarily unavailable (signaler.cpp:236)
newbie
Activity: 50
Merit: 0
Change to obelisk.coinkite.com:9091 or another from https://wiki.unsystem.net/en/index.php/Obelisk/Servers

Using the coinkite one I get..

Code:
sx balance 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
Address: 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
  Paid balance:    10000000
  Pending balance: 10000000
  Total received:  190000000
hero member
Activity: 708
Merit: 502
do I need to run obelisk to get response from "sx balance addreess" command
also it seems that i cant install obelisk -
 ERROR: --> You need to have installed libbitcoin, sx and obelisk before run this script.
 Read the header of this script:


after i install-sx.sh

Please advise. Thank you.

yes, though you can point it at public servers rather than a local one if you dont want to / cant run it.

http://sx.dyne.org/introduction.html#installation  (note running the install script as root)

i ran it as root.



/usr/local/src/sx-git# sx balance 1Lmc3kNttoyiU2ivPLizEBhE9UvQj6rquD
^CTraceback (most recent call last):
  File "/usr/local/bin/sx", line 1163, in
    sys.exit(main(sys.argv))
  File "/usr/local/bin/sx", line 1157, in main
    return subprocess.call([binary] + args)
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1301, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 478, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt


sx.cfg:

# ~/.sx.cfg Sample file.
service = "tcp://obelisk.unsystem.net:8081"
# Use CZMQ program 'makecert' to generate these values.
#client-certificate = "/home/genjix/.sx.cert"
#server-public-key = "W=GRFxHUuUN#En3MI]f{}X:KWnV=pRZ$((byg=:h"


it seems like it is public server by default - but query dose not return anything, until i ctrl+c

please advise.
Pages:
Jump to: