summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2014-05-08 18:29:58 (GMT)
committer Amir Taaki <genjix@riseup.net>2014-05-08 18:29:58 (GMT)
commit12f09e2566458185f9e25c6cc3d8e481510f3535 (patch)
treedab206499dda115a04a33b6c07c85141025a8d71
parent93419696c9901b4ea441f63b90b90c69e589b937 (diff)
sx stealth commands (initiate, uncover, uncover-secret)
-rw-r--r--src/Makefile.am12
-rw-r--r--src/stealth-initiate.cpp21
-rw-r--r--src/stealth-uncover-secret.cpp22
-rw-r--r--src/stealth-uncover.cpp21
-rwxr-xr-xsrc/sx.py33
5 files changed, 108 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4fb2924..5469936 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,7 +9,8 @@ corebin_PROGRAMS = \
sx-validaddr sx-base58-encode sx-base58-decode sx-wrap sx-unwrap \
sx-ripemd-hash sx-initchain sx-secret-to-wif sx-wif-to-secret \
sx-hd-seed sx-hd-priv sx-hd-pub sx-hd-to-address sx-hd-to-wif \
- sx-stealth-addr sx-stealth-show-addr \
+ sx-stealth-addr sx-stealth-show-addr sx-stealth-initiate \
+ sx-stealth-uncover sx-stealth-uncover-secret \
sx-ec-multiply sx-ec-tweak-add
corebin_SCRIPTS = sx-qrcode sx-watchtx sx-btc sx-satoshi sx-bci-history \
sx-get-utxo sx-bci-fetch-last-height sx-sendtx-bci sx-base58check-encode \
@@ -57,6 +58,15 @@ sx_ec_multiply_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
sx_stealth_show_addr_SOURCES = stealth-show-addr.cpp
sx_stealth_show_addr_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
+sx_stealth_initiate_SOURCES = stealth-initiate.cpp
+sx_stealth_initiate_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
+
+sx_stealth_uncover_SOURCES = stealth-uncover.cpp
+sx_stealth_uncover_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
+
+sx_stealth_uncover_secret_SOURCES = stealth-uncover.cpp
+sx_stealth_uncover_secret_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
+
sx_stealth_addr_SOURCES = stealth-addr.cpp
sx_stealth_addr_LDADD = ${libbitcoin_LIBS} ${libwallet_LIBS}
diff --git a/src/stealth-initiate.cpp b/src/stealth-initiate.cpp
new file mode 100644
index 0000000..92aeca9
--- /dev/null
+++ b/src/stealth-initiate.cpp
@@ -0,0 +1,21 @@
+#include <bitcoin/bitcoin.hpp>
+#include <wallet/wallet.hpp>
+using namespace libbitcoin;
+using namespace libwallet;
+
+int main(int argc, char** argv)
+{
+ if (argc != 4)
+ {
+ std::cerr << "Usage: sx stealth-initiate EPHEM_SECRET SCAN_PUBKEY "
+ "SPEND_PUBKEY" << std::endl;
+ return -1;
+ }
+ ec_secret ephem_secret = decode_hex_digest<ec_secret>(argv[1]);
+ ec_point scan_pubkey = decode_hex(argv[2]);
+ ec_point spend_pubkey = decode_hex(argv[3]);
+ ec_point pubkey = initiate_stealth(ephem_secret, scan_pubkey, spend_pubkey);
+ std::cout << pubkey << std::endl;
+ return 0;
+}
+
diff --git a/src/stealth-uncover-secret.cpp b/src/stealth-uncover-secret.cpp
new file mode 100644
index 0000000..3acd399
--- /dev/null
+++ b/src/stealth-uncover-secret.cpp
@@ -0,0 +1,22 @@
+#include <bitcoin/bitcoin.hpp>
+#include <wallet/wallet.hpp>
+using namespace libbitcoin;
+using namespace libwallet;
+
+int main(int argc, char** argv)
+{
+ if (argc != 4)
+ {
+ std::cerr << "Usage: sx stealth-uncover-secret EPHEM_PUBKEY "
+ "SCAN_SECRET SPEND_SECRET" << std::endl;
+ return -1;
+ }
+ ec_point ephem_pubkey = decode_hex(argv[1]);
+ ec_secret scan_secret = decode_hex_digest<ec_secret>(argv[2]);
+ ec_secret spend_secret = decode_hex_digest<ec_secret>(argv[3]);
+ ec_point pubkey = uncover_stealth_secret(
+ ephem_pubkey, scan_secret, spend_secret);
+ std::cout << pubkey << std::endl;
+ return 0;
+}
+
diff --git a/src/stealth-uncover.cpp b/src/stealth-uncover.cpp
new file mode 100644
index 0000000..87717b4
--- /dev/null
+++ b/src/stealth-uncover.cpp
@@ -0,0 +1,21 @@
+#include <bitcoin/bitcoin.hpp>
+#include <wallet/wallet.hpp>
+using namespace libbitcoin;
+using namespace libwallet;
+
+int main(int argc, char** argv)
+{
+ if (argc != 4)
+ {
+ std::cerr << "Usage: sx stealth-uncover EPHEM_PUBKEY SCAN_SECRET "
+ "SPEND_PUBKEY" << std::endl;
+ return -1;
+ }
+ ec_point ephem_pubkey = decode_hex(argv[1]);
+ ec_secret scan_secret = decode_hex_digest<ec_secret>(argv[2]);
+ ec_point spend_pubkey = decode_hex(argv[3]);
+ ec_point pubkey = uncover_stealth(ephem_pubkey, scan_secret, spend_pubkey);
+ std::cout << pubkey << std::endl;
+ return 0;
+}
+
diff --git a/src/sx.py b/src/sx.py
index af52c19..c285716 100755
--- a/src/sx.py
+++ b/src/sx.py
@@ -806,6 +806,39 @@ Watch transactions from the network searching for a certain hash.\
"""
),
+"stealth-initiate": (
+"STEALTH",
+"Initiate a new stealth address.",
+
+"""\
+Usage: sx stealth-initiate EPHEM_SECRET SCAN_PUBKEY SPEND_PUBKEY
+
+Initiate a new stealth address.\
+"""
+),
+
+"stealth-uncover": (
+"STEALTH",
+"Uncover a stealth address.",
+
+"""\
+Usage: sx stealth-uncover EPHEM_PUBKEY SCAN_SECRET SPEND_PUBKEY
+
+Uncover a stealth address.\
+"""
+),
+
+"stealth-uncover-secret": (
+"STEALTH",
+"Uncover a stealth secret.",
+
+"""\
+Usage: sx stealth-uncover-secret EPHEM_PUBKEY SCAN_SECRET SPEND_SECRET
+
+Uncover a stealth secret.\
+"""
+),
+
"stealth-addr": (
"STEALTH",
"Generate a new stealth address.",