Bitcoin Forum
May 11, 2024, 12:05:17 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 5 6 7 8 9 10 »  All
  Print  
Author Topic: sx command line utilities - Empower The Sysadmin With Bitcoin Tools  (Read 240149 times)
antonimasso
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
August 18, 2013, 10:10:09 AM
Last edit: August 18, 2013, 01:54:54 PM by antonimasso
 #21

****
The author of the article answered my question, change that line to:

for x in `seq 0 2`; do sx rawscript [ `cat sig$x` ] [ `cat pub1 | sx pubkey` ] | sx set-input txfile.tx $x > txfile2.tx; mv txfile2.tx txfile.tx; done
****

Hello,

I've been following the steps in this article (http://bitcoinmagazine.com/what-libbitcoin-and-sx-are-and-why-they-matter/), but can't seem to make a valid raw transaction from an address with multiple unspent inputs.

It misses the scriptSig data from each prev_out. If I copy the raw transaction that

for x in `seq 0 2`; do sx rawscript [ `cat sig$x` ] [ `cat pub1` ] | sx set-input txfile.tx $x; done

returns it shows that only the first prev_out has the scriptSig data.

When using an address with only one unspent transaction it works as expected.

These are the steps I follow:

sx history `cat addr1` | grep Unspent -B 2 | grep output | awk '{print $2}' > input
sx mktx txfile.tx `cat input` -o 18qk7SqRHuS4Kf3f6dmsvqqv7iw1xy77Z6:90000
sx rawscript dup hash160 [ `cat addr1 | sx decode-addr` ] equalverify checksig > raw.script
cat pk1 | sx sign-input txfile.tx 0 `cat raw.script` > sig
sx rawscript [ `cat sig` ] [ `cat pub1` ] | sx set-input txfile.tx 0
sx broadcast-tx txfile.tx

Any ideas?

Thanks
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715429117
Hero Member
*
Offline Offline

Posts: 1715429117

View Profile Personal Message (Offline)

Ignore
1715429117
Reply with quote  #2

1715429117
Report to moderator
1715429117
Hero Member
*
Offline Offline

Posts: 1715429117

View Profile Personal Message (Offline)

Ignore
1715429117
Reply with quote  #2

1715429117
Report to moderator
1715429117
Hero Member
*
Offline Offline

Posts: 1715429117

View Profile Personal Message (Offline)

Ignore
1715429117
Reply with quote  #2

1715429117
Report to moderator
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
August 18, 2013, 10:13:06 AM
 #22

Have you lowered the g++ dependency?

genjix (OP)
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
August 19, 2013, 10:02:39 PM
 #23

Have you lowered the g++ dependency?

g++ 4.7 or higher as always. This is the version of g++ that properly implements the C++ standard. g++ 4.7 is in pretty much every Linux distro now. Older g++ do not fully implement the new C++ standard.
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
August 19, 2013, 10:22:22 PM
 #24

g++ 4.7 or higher as always. This is the version of g++ that properly implements the C++ standard. g++ 4.7 is in pretty much every Linux distro now. Older g++ do not fully implement the new C++ standard.

I personally use Ubuntu LTS or Debian stable for servers I manage, and as far as I know they don't have g++ 4.7.
If you're targeting sysadmins (which I think is great) it would be good to have it build easily on these versions.

I really like the idea of having ligthweight tools that I can use on my servers instead of running a resource-hungry client, but if I need to fiddle around to get g++ 4.7 or run cutting edge versions that's kind of a turn off.

Then again I don't know shit about C++ so I have no idea about the difficulty of working around the limitations of g++ 4.6.3 which is present on Ubuntu LTS for example.

ADgordo
Member
**
Offline Offline

Activity: 203
Merit: 10

The World’s First Blockchain Core


View Profile
September 02, 2013, 07:22:23 PM
 #25

Github is spitting a 404 at

https://github.com/genjix/sx/


▄▄▄▄▄▄▄▄▄▄▄ ▄ ■        SKYNET        ■ ▄ ▄▄▄▄▄▄▄▄▄▄▄
▐▬▬▬▬▬▬▬▬▬▬     PRIVATE SALE is LIVE     ▬▬▬▬▬▬▬▬▬▬▌
Whitepaper   Bounty   Bitcointalk  ■  Facebook   Twitter   Telegram
genjix (OP)
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
September 08, 2013, 02:14:31 PM
 #26

Github is spitting a 404 at

https://github.com/genjix/sx/



https://github.com/spesmilo/sx/

sx now supports embedding files in the blockchain.

$ echo foo | sx embed-addr
$ 1N9v8AKBqst9MNceV3gLmFKsgkKv1bZcBU

send some bitcoin to that address, and it will be a record in the blockchain of some data.

But I recommend to use the install script instead. You can even specify a local path and you don't need to be root. It will build the dependencies needed and stuff.
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
September 08, 2013, 06:39:21 PM
 #27

Is there any documentation for how to use the network parts of this tool? Like how to setup obelisk with the blockchain data so that I can do sx history and so on?
genjix (OP)
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
September 11, 2013, 01:58:24 AM
 #28

Hey,

We're just working on a tool to convert the bitcoind bootstrap.dat into a libbitcoin blockchain which would make the transition easier.

For now I would look at the config in /etc/obelisk/. You want the port of the frontend in balancer.cfg for your sx.cfg

Commands to run:

# Initialize blockchain
$ mkdir blockchain
$ sx initchain blockchain/
# Run the load balancer
$ obbalancer
# Run a worker
$ obworker

You can view debug.log and error.log to see the output of the worker.

It's important that everyone setup an Obelisk server though. I will make a proper release though soon, and then it will include instructions and I'll be ready for everyone to run versions. Soon soon.
greBit
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


View Profile
September 13, 2013, 11:36:48 AM
 #29

The simplest way to install sx, is to use the *install-sx.sh* bash
script.

Code:
   $ wget http://sx.dyne.org/install-sx.sh
   $ sudo bash ./install-sx.sh

sx should now be installed.


Just a quick note for future reference.

Under Ubuntu 12.04 the script fails to install for a few reasons.

Quote
DEPENDENCIES="git build-essential autoconf libtool libboost-all-dev pkg-config libcurl4-openssl-dev libleveldb-dev libzmq-dev libconfig++-dev libncurses-dev"

Firstly, in order to build libbitcoin, I require libboost1.48-all-dev instead of libboost-all-dev, which breaks your dependency checking.

The same can be said for other dependencies which on my system, are named slightly differently - e.g. I have 'libncurses5-dev' which also breaks the dependency checking.

Also I was unable to build obelisk without making modifications, I get
Quote
In file included from worker/publisher.hpp:4:0,
                 from worker/publisher.cpp:1:
/usr/include/zmq.hpp: In member function ‘zmq::context_t& zmq::context_t::operator=(zmq::context_t&&)’:
/usr/include/zmq.hpp:207:13: error: ‘swap’ is not a member of ‘std’
             std::swap(ptr, rhs.ptr);

Which I fixed by making sure to include <algorithm> in various places in the code.

Now it seems to be all nicely installed so I will have a play Smiley
greBit
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


View Profile
September 13, 2013, 12:13:11 PM
 #30

Forgive the newbie question, but how do I actually configure SX so it has a blockchain database to query?

I just want to run the command `sx balance 1...` but this simply hangs with no output.

I am guessing this is because it has no idea about how to get the information, i.e. it has no blockchain database.

So please how do I configure this? Does it depend on bitcoin-qt/bitcoind ?

cheers!


Edit: I have tried an `sx initchain path-to-bitcoin-qt-blockchain` to no avail. this also just hangs with no response
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
September 13, 2013, 02:59:55 PM
 #31

Hey,

We're just working on a tool to convert the bitcoind bootstrap.dat into a libbitcoin blockchain which would make the transition easier.

For now I would look at the config in /etc/obelisk/. You want the port of the frontend in balancer.cfg for your sx.cfg

Commands to run:

# Initialize blockchain
$ mkdir blockchain
$ sx initchain blockchain/
# Run the load balancer
$ obbalancer
# Run a worker
$ obworker

You can view debug.log and error.log to see the output of the worker.

It's important that everyone setup an Obelisk server though. I will make a proper release though soon, and then it will include instructions and I'll be ready for everyone to run versions. Soon soon.

Where do you create the blockchain directory? I mean the config file does not mention a full path.
greBit
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


View Profile
September 13, 2013, 06:44:35 PM
 #32


Where do you create the blockchain directory? I mean the config file does not mention a full path.

I don't have any answers im afraid Sad

Do you get any sort of output when executing `sx initchain blockchain/` ?  I get literally zero and nothing in debug or error logs. It just hangs silently.

I have no idea if it is expecting that directory to be an existing blockchain-dir (i.e. from bitcoin-qt) or a leveldb-based one. Or what that command is supposed to do, is it converting an existing blockchain? or connecting to the bitcoin network to build it up itself?

There is a script /usr/local/bin/download-blockchain.sh  which seems to try to rsync the blockchain from some server. But of course it fails miserably as it cannot authenticate.

Im not making much progress Sad
genjix (OP)
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
September 14, 2013, 08:18:56 PM
 #33

Forgive the newbie question, but how do I actually configure SX so it has a blockchain database to query?

I just want to run the command `sx balance 1...` but this simply hangs with no output.

I am guessing this is because it has no idea about how to get the information, i.e. it has no blockchain database.

So please how do I configure this? Does it depend on bitcoin-qt/bitcoind ?

cheers!


Edit: I have tried an `sx initchain path-to-bitcoin-qt-blockchain` to no avail. this also just hangs with no response


Hey,

My email is amir@unsystem.net if you ever want to reach me directly with questions.

I've been making changes recently, so my server might sometimes experience downtime. Obelisk and SX aren't released yet but a release will be happening soon. Then we will create a stable production server, and keep a separate one for development.

If you want to create your own:

$ mkdir blockchain
$ sx initchain blockchain/
INFO: Imported genesis block 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

You now have a blockchain with the genesis block.

If you start the worker, it will begin downloading the blockchain. The rsync tool is obselete. We're working on a tool to bootstrap the Bitcoin blockchain but it is experimental:

https://github.com/spesmilo/libbitcoin/tree/master/tools

So you'll be able to use rtorrent to download it from bittorrent, then import it into libbitcoin (Obelisk).

The blockchain path is in /etc/obelisk/worker.cfg

That compile error is with ZeroMQ, and should be fixed by them. Since the problem doesn't occur in Debian Wheezy or Ubuntu 13.04, it's probably fixed.

Thanks!
greBit
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


View Profile
September 15, 2013, 08:46:49 AM
 #34


If you want to create your own:

$ mkdir blockchain
$ sx initchain blockchain/
INFO: Imported genesis block 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f


Hey Amir thanks for the reply.

I guess I have a dodgy build then, as when I do 'sx initchain blockchain/' it just silently hangs Sad

But what does this command actually do? Where is it trying to get the data from?

Anyways ill come back to this when it is released, it looks very promising Smiley
genjix (OP)
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
September 16, 2013, 01:02:06 PM
 #35

history/balance/wallet commands:

My host is unreachable for a bit: http://wiki.hetzner.de/index.php/Netzwerkkonfiguration_wegen_Switchanpassung/en

Once my server is available, everything should be working again.
jago25_98
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1000


Crypto Geek


View Profile WWW
November 15, 2013, 08:56:19 PM
 #36

Just a quick one to say thanks and congrats for the first user level multisig implementation.

The stage is set for a website programmer now to build a frontend to assist democratic voting through payments.

Bitcoiner since the early days. Crypto YouTube Channel: Trading Nomads | Analyst | News Reporter | Bitcoin Hodler | Support Freedom of Speech!
jago25_98
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1000


Crypto Geek


View Profile WWW
November 16, 2013, 10:22:15 PM
 #37

Some deps that might be useful for CentOS? Hopefully might see a rpm for that at some stage - would be useful seeing as most webservers are CentOS.

fedora:
Code:
libcurl-devel.x86_64 openssl-devel.x86_64 gcc-c++ asio-devel leveldb.x86_64

Got through the deps but libbitcoin doesn't compile for me:
Code:
libbitcoin-git]$ ./configure --enable-leveldb --prefix /usr/local/
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) 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 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
[j@localhost libbitcoin-git]$ make
Making all in include/bitcoin
make[1]: Entering directory `/home/j/src/libbitcoin-git/include/bitcoin'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/j/src/libbitcoin-git/include/bitcoin'
Making all in src
make[1]: Entering directory `/home/j/src/libbitcoin-git/src'
  CXX      satoshi_serialize.lo
  CXX      deterministic_wallet.lo
  CXX      getx_responder.lo
  CXX      threadpool.lo
  CXX      network/network.lo
  CXX      network/handshake.lo
  CXX      network/channel.lo
  CXX      network/hosts.lo
  CXX      network/protocol.lo
  CXX      poller.lo
  CXX      utility/logger.lo
  CXX      utility/sha256.lo
  CXX      address.lo
  CXX      format.lo
  CXX      script.lo
  CXX      utility/ripemd.lo
  CXX      block.lo
  CXX      utility/elliptic_curve_key.lo
  CXX      transaction.lo
  CXX      error.lo
  CXX      validate.lo
  CXX      session.lo
session.cpp:133:6: warning: unused parameter 'packet' [-Wunused-parameter]
 void session::get_data(const std::error_code& ec,
      ^
session.cpp:147:6: warning: unused parameter 'packet' [-Wunused-parameter]
 void session::get_blocks(const std::error_code& ec,
      ^
  CXX      utility/base58.lo
  CXX      utility/big_number.lo
  CXX      utility/key_formats.lo
  CXX      utility/timed_section.lo
  CXX      utility/mnemonic.lo
  CXX      constants.lo
  CXX      blockchain/organizer.lo
blockchain/organizer.cpp: In member function 'void libbitcoin::organizer::replace_chain(int, libbitcoin::block_detail_list&)':
blockchain/organizer.cpp:166:65: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int orphan_index = 0; orphan_index < orphan_chain.size();
                                                                 ^
blockchain/organizer.cpp:204:73: warning: narrowing conversion of 'arrival_index' from 'int' to 'size_t {aka long unsigned int}' inside { } [-Wnarrowing]
         arrival_block->set_info({block_status::confirmed, arrival_index});
                                                                         ^
  CXX      blockchain/blockchain.lo
  CXX      transaction_pool.lo
  CXX      transaction_indexer.lo
transaction_indexer.cpp: In function 'void libbitcoin::indexer_history_fetched(const std::error_code&, const output_info_list&, const spend_info_list&, libbitcoin::blockchain::history_list, libbitcoin::blockchain::fetch_handler_history)':
transaction_indexer.cpp:233:14: warning: variable 'found' set but not used [-Wunused-but-set-variable]
         bool found = false;
              ^
  CXX      blockchain/leveldb/leveldb_blockchain.lo
In file included from blockchain/leveldb/leveldb_blockchain.cpp:1:0:
./../include/bitcoin/blockchain/leveldb_blockchain.hpp:7:24: fatal error: leveldb/db.h: No such file or directory
 #include <leveldb/db.h>
                        ^
compilation terminated.
make[1]: *** [blockchain/leveldb/leveldb_blockchain.lo] Error 1
make[1]: Leaving directory `/home/j/src/libbitcoin-git/src'
make: *** [all-recursive] Error 1

Bitcoiner since the early days. Crypto YouTube Channel: Trading Nomads | Analyst | News Reporter | Bitcoin Hodler | Support Freedom of Speech!
moderate
Member
**
Offline Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 16, 2013, 11:39:37 PM
 #38


Code:

./../include/bitcoin/blockchain/leveldb_blockchain.hpp:7:24: fatal error: leveldb/db.h: No such file or directory

samson
Legendary
*
Offline Offline

Activity: 2097
Merit: 1070


View Profile
November 17, 2013, 01:55:01 AM
 #39

Maybe not related but could this be something to do with CentOS disabling all Elliptic Curve functionality in their standard packaged OpenSSL distribution ?

However in the next version which is going to be released very soon it will be restored after a long period of on and off support.
jago25_98
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1000


Crypto Geek


View Profile WWW
November 17, 2013, 07:43:59 PM
 #40

Are the sx tools stuck on testnet?

No, it's fully operational AFAIK.

Moderate: Thanks for that, missed the leveldb. ./configure should have spotted it. Will search and try again

Bitcoiner since the early days. Crypto YouTube Channel: Trading Nomads | Analyst | News Reporter | Bitcoin Hodler | Support Freedom of Speech!
Pages: « 1 [2] 3 4 5 6 7 8 9 10 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!