Merge pull request #51 from MyHush/danger

Danger Will Robinson!!!
This commit is contained in:
Duke Leto
2019-12-16 02:44:38 -08:00
committed by GitHub
159 changed files with 5705 additions and 34546 deletions

14
.gitignore vendored
View File

@@ -1,10 +1,6 @@
*.tar.gz
*.deb
src/bitcoin
src/zcashd
src/zcash-cli
src/zcash-gtest
src/zcash-tx
src/test/test_bitcoin
*zcashTest.pk
@@ -29,7 +25,7 @@ build-aux/compile
build-aux/test-driver
config.log
config.status
#configure
configure
libtool
src/config/bitcoin-config.h
src/config/bitcoin-config.h.in
@@ -44,7 +40,7 @@ src/univalue/gen
.dirstamp
.idea
.libs
.*.swp
.*.sw?
*.*~*
*.bak
*.rej
@@ -156,3 +152,9 @@ src/cc/rogue/confdefs.h
src/cc/rogue/x64
src/cc/dapps/a.out
src/Makefile.in
doc/man/Makefile.in
Makefile.in
src/libcc.so
src/cc/customcc.so
src/HUSH3_7776

View File

@@ -46,7 +46,7 @@ Write clear, clean and consistent code. Follow well-known and established style
## Setting up your environment
The Hush Core (hushd) is mainly written in C++ with specific modules written in C. Follow the [Install](https://github.com/MyHush/hush3/blob/master/INSTALL.md) instructions to build hushd from sources. For more informations about the Hush Platform and a full API documentation please visit the official [Komodo developer documentation](https://docs.komodoplatform.com/).
The Hush Core (hushd) is mainly written in C++ with specific modules written in C. Follow the [Install](https://github.com/MyHush/hush3/blob/master/INSTALL.md) instructions to build hushd from sources. For more informations about the Hush Platform and a full API documentation please visit the official [Hush Developer documentation](https://gilardh.github.io/dev-website/developers/)
## Contribution review process

View File

@@ -1,218 +0,0 @@
*** Makefile.am 2017-01-03 10:53:52.436371005 +0000
--- ../../komodo-jl777/Makefile.am 2017-01-03 09:49:08.848505929 +0000
***************
*** 39,58 ****
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
-
- if BUILD_DARWIN
- COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
- leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
- baseline_filtered.info block_test_filtered.info \
- leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info
- # zcash-gtest.info zcash-gtest_filtered.info zcash-gtest_coverage.info
- else
COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
baseline_filtered.info block_test_filtered.info \
leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info \
zcash-gtest.info zcash-gtest_filtered.info zcash-gtest_coverage.info
- endif
dist-hook:
-$(MAKE) -C $(top_distdir)/src/leveldb clean
--- 39,49 ----
***************
*** 159,173 ****
baseline.info:
$(LCOV) -c -i -d $(abs_builddir)/src -o $@
- if BUILD_DARWIN
- baseline_filtered.info: baseline.info
- $(LCOV) -r $< "/usr/include/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
- "$(abs_builddir)/src/test/*" \
- -o $@
- else
baseline_filtered.info: baseline.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
--- 150,155 ----
***************
*** 177,196 ****
"$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
- endif
leveldb_baseline.info: baseline_filtered.info
$(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@
- if BUILD_DARWIN
- leveldb_baseline_filtered.info: leveldb_baseline.info
- $(LCOV) -r $< "/usr/include/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
- "$(abs_builddir)/src/test/*" \
- -o $@
- else
leveldb_baseline_filtered.info: leveldb_baseline.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
--- 159,168 ----
***************
*** 200,206 ****
"$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
- endif
baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info
$(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@
--- 172,177 ----
***************
*** 211,226 ****
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
- if BUILD_DARWIN
test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
"$(abs_builddir)/src/test/*" \
-o $@
! else
! test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
--- 182,204 ----
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
+ "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gtest/*" \
+ "$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
!
! zcash-gtest.info: baseline_filtered_combined.info
! $(MAKE) -C src/ zcash-gtest_check
! $(LCOV) -c -d $(abs_builddir)/src -t zcash-gtest -o $@
! $(LCOV) -z -d $(abs_builddir)/src
! $(LCOV) -z -d $(abs_builddir)/src/leveldb
!
! zcash-gtest_filtered.info: zcash-gtest.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
***************
*** 229,235 ****
"$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
- endif
block_test.info: test_bitcoin_filtered.info
$(MKDIR_P) qa/tmp
--- 207,212 ----
***************
*** 238,252 ****
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
- if BUILD_DARWIN
- block_test_filtered.info: block_test.info
- $(LCOV) -r $< "/usr/include/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
- "$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
- "$(abs_builddir)/src/test/*" \
- -o $@
- else
block_test_filtered.info: block_test.info
$(LCOV) -r $< "/usr/include/*" \
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
--- 215,220 ----
***************
*** 256,293 ****
"$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
- endif
test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
! $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
- if ! BUILD_DARWIN
zcash-gtest_coverage.info: baseline_filtered_combined.info zcash-gtest_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a zcash-gtest_filtered.info -o $@
- endif
- if BUILD_DARWIN
- total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info
- $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
- else
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a zcash-gtest_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
- endif
-
test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info
! $(GENHTML) -s $< -o $(@D)
! @touch $@
total.coverage/.dirstamp: total_coverage.info
! $(GENHTML) -s $< -o $(@D)
! @touch $@
- if BUILD_DARWIN
- cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
- else
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
- endif
endif
--- 224,254 ----
"$(abs_builddir)/src/gtest/*" \
"$(abs_builddir)/src/test/*" \
-o $@
test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
! $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
zcash-gtest_coverage.info: baseline_filtered_combined.info zcash-gtest_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a zcash-gtest_filtered.info -o $@
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a zcash-gtest_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info
! $(GENHTML) -s $< -o $(@D)
! @touch $@
!
! zcash-gtest.coverage/.dirstamp: zcash-gtest_coverage.info
! $(GENHTML) -s $< -o $(@D)
! @touch $@
!
! cov-zcash: zcash-gtest.coverage/.dirstamp
total.coverage/.dirstamp: total_coverage.info
! $(GENHTML) -s $< -o $(@D)
! @touch $@
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
endif

View File

@@ -1,30 +1,90 @@
## Reporting a Vulnerability
Please use the below [contact data](https://komodoplatform.com/.well-known/security.txt.asc) to report vulnerabilities. We kindly ask you to not publish or exploit any found vulnerabilities.
You can use [Keybase](https://keybase.io/dukeleto) to find secure contact information.
You can also contact Duke directly via SilentDragon wallet, via "Contact Duke". Encrypted sensitive data
in memo fields in highly encouraged.
We kindly ask you to not publish or exploit any found vulnerabilities without at least contacting us first.
Fingerprint: F16219F4C23F91112E9C734A8DFCBF8E5A4D8019
```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Keybase OpenPGP v2.0.8
Comment: https://keybase.io/crypto
Contact: security@komodoplatform.com
Contact: ca333@komodoplatform.com
Contact: noashh@komodoplatform.com
Encryption: http://pgp.key-server.io:11371/0x379287998EE6CF47
-----BEGIN PGP SIGNATURE-----
xsFNBFU/8aYBEADf7eIcersi4Fbxdc2O6fuy3F9eoW6ap+bBz53fvZFMgBrKcUoV
2q6HkTQr/CWgPjx1LDwwBo7CBxOeg5FI8W5NVmVA+1XQ0TSa1fx8COpkPOAyCeDa
6aNQI1ciZS9xJeWy65gF2Mn+iJpgdkQj7xFxxaQpg8Uadq+jKzKp8BIMFyK10eSa
Pdn1xRDN3Bp5Ze2KUkv59nUc+C1Qx8mE5taXspSdHhrIL/78saGUZ4Q1bnlNex5u
aiAGRr5L/Qr0e5oEmfId56aQiCBqfvZmgUoun4djLdkAdhMW9bR8msbL/AycFvBn
C7fNTvic/vOw3yShd5jlr92OfNfHSgzJ5oa+BvMxPDbY4be8GPiTEvaGlPeEAec+
HyQQHD2yzkhDCLPKbf6WDyRfnUTe3YoAEEmZWkgyP36ggB9gpoW5QuGC0P0Oz8Gz
jeqBdtnSwR30cwkH535ChjDP/W+KR1yoKZgenV5KuyA6WOZTkdFnDr1R33CkWA+q
NlZixmSYXZKPeL/z95ZDOiMTuUpG2/fqJsZMSfJ4GcMuF6UtWT5jM+/pzxPg0szq
8vEu8UZJD4UnUKJAb8XgfQbTXgmG3C+xAxPO2nrUD4etr375yyLR922mc9IRNj3v
oJqGYsYUfPwKS7ZsJU1N8bAtjdaxRHs6BL0r2sqEyvLwJLh/CdaNCK4HQQARAQAB
zSlrZXliYXNlLmlvL2R1a2VsZXRvIDxkdWtlbGV0b0BrZXliYXNlLmlvPsLBcAQT
AQoAGgUCVT/xpgIbLwMLCQcDFQoIAh4BAheAAhkBAAoJEI38v45aTYAZ0q0P/17Q
URAJGiJqQF7Lqon8bHlvM6jdnHhkv0We50pU+aLXGwaSTy60uj7sqPte6TxWM5BD
2BGi2viXuJfP+NrM8WJyRqZ0+SHlGM7vHwrHhfGC3sh+Bvh/T9ToXBRDPcp/zbvD
dqoF4KyI7qUH69mrf9THn+5fM3vF2PNwkEaXLvF7KAHZcFza2tLcEu8kBpTBpd5w
ZwVGfOTGTw5mbUwB3P6k0pY/SVF31cynCbIszr6YA0p0EUHirzPB8faHfRxzkyt3
U6MFSHD070vqFu5W9QdwEFlVKn4G5RP4bD/i4Omjt8uHt2oWm3CqmJc+CVsEsxLz
gLXQmsTZTWYPGQcFc/oUTfBdfeXMsB2tZbuw56Ua/rFH03wgB6pp9pCKb/UDUC1R
tUQxGliQCA23444i4Pq1aGeTYVEBVHDw6xsp7lXDQi1AzhjXxzrf0Axt7khEX6Z8
OilDT3ChhCkFacWt2YhudEU4gS1mAbnl1H2bn41FquoLqHCc4vPJlc5OzdhkDaeT
NjNCEgiCu8F42vfRaDQOeZdC2Rh1vJoe9GAv7OPg9nRv1caJQvIWHRIWkBotNAMz
q1vQaTB+LDnBpz3gG07EW60WYzuvOm6dyK5PH2BBMHS7J7UyRXERjmB2+5LvK1my
sDLV2qk+ToQgU8h2dJt+phyzKizVt9VfKTEFN/t6zsBNBFU/8aYBCADN9oyrBJam
Ly2QLBgihg/yifPoZClq0Z6M86M+VaeWKAKwdNE4r9bBR0ze8f6wuCMix5J+p+lb
UMFn5GubNgMLzcuuJ2nLqAKInAt3TxbYGz/MQm77DnuW0/b6XfniUKTe+Nf8vOBZ
HH7cyuhZdV549JaT2BOFXWFayLZF986atPN+NuX8kOzqD0InzEzbDwH1OVxhpeFV
r7W9s7HUGEDmBDXOLhdLmqx5mEcjumKUSWbMnwgHkR203RGY4H15/jSbpthE8/hH
z0FgRZWg69f/mZckyoKmjFeiNs5FaQKj2C1q6CEawYyzPd9P1WpCH97t/Y3//XRr
98bwOT8Rb6R/ABEBAAHCwoQEGAEKAA8FAlU/8aYFCQ8JnAACGwIBKQkQjfy/jlpN
gBnAXSAEGQEKAAYFAlU/8aYACgkQcteVKUeHcFho5wf+Ma++R1tGsmrI20sA04jz
jYRag7eVLnC9jhby6T8qIjOR13QaqZelZ0Tr0GBM0KRjU+ehmquw2Mx+NdE7+H60
h0/D8sPHcOoabYztHz7EPto/lWGcjbEGNLx9Go6049XbTGiL+UfKWfHEzNdEeRX6
0n1X3JOS67esaJg/ch7cgFrc/5V9Er2b+MBll2doPLh2QTtS7ECfxLzjkiRjwk9u
9warhCVqZd11xz1CCT+/8TRSSkJYgNkCAtogmrWiJ+HWAhlpr2eRdq1ESMmC4myP
oElx3FQWBdAY281aJ6EOBjwjpmPLElgltdQ5+yatlLR/j3E2J7jguXIzOEpGgFoO
i7HsD/0XQYgZ7/HtFka4xYBNHR1tw+F7uY3UzaQ8214sfRWoTtJmSPLeAFQZFh6E
OoGFPbimDTGttKPfIorZsUnGkZLcWrEqAAieFRmiL8Eyq98zQSEb4S/mMFYcgYMf
qYWm0dpX5sNQxZfw2Ny4JMPUFRT2LHlk1CC9dpdMvpkK5EqLBb8HVCwW+NFkwZBB
rzUtyWeSRd8HSDPqdy8T6BG0zTwZ+axIs7VH9nyo4Wyc+irVWctqYkAGyuJRci0s
C0lb9xgP7gwlEc/o0IpcAwCdSh/4aH4YTYyGOny1TQLWW6vYKwMMLtfdhqrD1Gzw
SnBo/6vfsELjt1IexEoAU1AaGRf4n7AyRPmhd3SFqtqXhv0bosv+oxi1WVbs4vB+
rbfMpv4mq9CjbJQRr1gE9NAohqKLTlV5ADDcBc6uN6G5uUsgxzLdPo987rqQxW26
XWpiJ309vQlgvkJjkOzS1YeDmsLnpSy/i5vocDs7G9XgI0CpuCs3C5kh+6L/ipB3
78opGszS6yXFvVIPmklA57+F5pbZu4KlONCdlAoH3szZpDjUBashkvEKbbk25JVV
382WTLLbUz+s2rDAiU0eXCpkI/Zrkt1R8YYCCe09OeUAK1cMfm9v1QQaJaMFMA0L
mNXQ98FHvgfVa5vo/jxzKH4HqPPpTyKyKWhDJKCHJVmWfnec387ATQRVP/GmAQgA
wG70Vd4u64nHmAzLUe3dLuOIIIxBX6M4MYe6QXLyjsQ5vv8ScsF9QTRw3SMIw2Aa
9SB3I+bt6DKRUQOyWyUH74XZdEHveUip7GYglm9+rhiVHT3QfhiVWJo+84j9hG3J
C4gg3jkB0VzYUSU3lrRX0hRIl5C0oLa+ce80PM0MlmuwnJtRKCi5cNSjQKLi6PEu
ZlaKwkJvO+hbCguxtfuCK9qDd+l8vY63UM+Crqpc1QTNuEgD0MmOKqk/jyt6WUOC
Flep1zOMrbvpBYj3a01TdvG3J+5uuh9d2aKH3IhZyOPwu651DNLcRatF/36QmGQ0
HFHYvM40UF0F06iHcDFw5QARAQABwsKEBBgBCgAPBQJVP/GmBQkPCZwAAhsMASkJ
EI38v45aTYAZwF0gBBkBCgAGBQJVP/GmAAoJENA7aXPDXJizlg8H/1SP4CP7ZCd4
J9ptegCvfpcB1KRyIuIUxjDi4XuX6g+QLyZE98eSeoDj6JlYVVHOwACXcNtoBzIm
7/nk7afFTVYHVEyOCDFprml8qTmQ6aXOgv7z1Ib3Q8rw7EyaMWifsD3f757TSOKw
H0JBeQYrnhC0Mg9YunjepvamvTvHwZrLNNMltAznXQ2NGqS7dokPNGOmusGmW29a
EvK8K+AqSuCk2DB4UkaQul1UVmRhMjpKj/nQ9ubEsTDODbouRuLELqOLWmVAyE2V
WRq3VaGm23N/7w2FlsfPzfElHhmA3znx+2NllNB4nRHforu3/bmUJljozwBwDAN1
+CfAct5LTQbn+w/8DtEiEZ3BMFU0WWo6W/NqvF5R4x/Hyns50L1GIA6UZqfs9Pdj
94EgoCVBGzgwUAl241HT7R4Kys58KlFNhlq3fFxlAADAY/ToCyNCK84PR10EDN6I
Q0jWZaMzMSSm6fJT75br93Sp4TNpTuVhGijR4ZehdDmclbShS28jrJo3u0vfOBoT
Sy7IchvuudIonnL5UKlA4a1KZOjuEfQfUId/iiIzRhTF+cPsvjqRv6lxLNjdbrDr
BMCsvwqZl4Qst2Z2kAZYND6gSSQAlef4j3EGtoVrS46maPTimv1KoLsgCQ4ycFmP
4uU+2KebEY1IdJW50gAEipajiqwH0Biy+H1muanSluZLeC/LYRdH+ebXuguhYZbI
m4qCbO5rupke0gBFZ7rmqmnDhDg7riVUWvIrtL2YtWX8y8u50TCaQaRjyf0Fqyv8
G76/DUCUCYcwNkm2qJdHpjVqOU+7E+iWfooA4obfGyPLtuLw2fpVDEDgn+csd+M4
KlRY6butx+NDUqHtx1Axf6aC9Dl6LAE33UY8nlQWWFvJbQBAY54IzU0WehSgrJSB
tnKq9uroBB7qDoJExmOnlUaAsmJWjkfxsQS9lFam6lf1UD01AFiIql0rQTcacxrF
NvQ1HJmZvDZF/K37DrE72NmkYz1aJhTokGFHOGoCqLt146bA2IRkpQRXCv4=
=YSWs
-----END PGP PUBLIC KEY BLOCK-----
iQJNBAEBCAA3FiEEVez5U2AlPa805zvqN5KHmY7mz0cFAlz6EuMZHGNhMzMzQGtv
bW9kb3BsYXRmb3JtLmNvbQAKCRA3koeZjubPR8cIEACP+JjyXDIzjgIewMMi/02b
tsYswPyQ+9bAoEJnis3r94d1FP1rqXmt4oNz6VwFTqQLEa5opW+gvvaxBTFJSPb0
UzbS+1PjfAOox5cnT3Dnv9kcy4ECslnW/G+mH+85BUgz1HuqYc8A3kNQJL7KqLoi
YeD0Hd09KtlG+B4PWdnqLw/uvfbavSKdMn6WSIU6adNZWX0ewSubWPXvrWea5cI2
yKDdMcDqB8Sc9J4JR2L9zW8NqPQuaxfLQbkCt2tg9QjlClrAqQgb8OZQJgY9f1T/
kBlVXoA4ZUZeifvjSKxQ/3TdRFP+jbV9xsb6sr14zTx+Wcoqtgsh3l9F4+T3V2m8
/c/iS4mFlK31pJtwYyrJAq9hpggqymdCVi0Pa3yLZsEj3orBPaPWbmq2v7xeF3J8
y8vqAkt3M3T6251aZAKEcaN5RXYJW70CTseadwp0tmrAL2nIVmziNCMOF+Bufyxi
HddkasTcNX8VYfPCLWqBwrocx8d3n3E7dBGeS2x2iwuRVQ85pH5d+imxaMftcbqm
YrNuiqcI/0XDGk9pS6f1gpu5Eh5Q2QXGmOoRlfosfkAEfgFxfaMvmcu5Ay1s0gSR
MsTn0PrQyMYC3t3KpyP47C8ui9x7FtJFltR/QT4yzBF1QyDmINnK86ldQqSui402
2+gQFt7YFvLIBUiy1fh1Jw==
=UITq
-----END PGP SIGNATURE-----
```

View File

@@ -1,55 +0,0 @@
*** depends/packages/boost.mk 2017-01-03 10:53:52.440371182 +0000
--- ../../komodo-jl777/depends/packages/boost.mk 2017-01-03 09:48:21.650035146 +0000
***************
*** 11,24 ****
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
! $(package)_config_opts_darwin=--toolset=gcc threadapi=pthread runtime-link=shared
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
$(package)_config_opts_x86_64_mingw32=address-model=64
$(package)_config_opts_i686_mingw32=address-model=32
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
$(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar)
! $(package)_toolset_darwin=gcc
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
$(package)_cxxflags=-fvisibility=hidden
$(package)_cxxflags_linux=-fPIC
--- 11,25 ----
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
! $(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
$(package)_config_opts_x86_64_mingw32=address-model=64
$(package)_config_opts_i686_mingw32=address-model=32
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
$(package)_toolset_$(host_os)=gcc
$(package)_archiver_$(host_os)=$($(package)_ar)
! $(package)_toolset_darwin=darwin
! $(package)_archiver_darwin=$($(package)_libtool)
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
$(package)_cxxflags=-fvisibility=hidden
$(package)_cxxflags_linux=-fPIC
***************
*** 35,43 ****
endef
define $(package)_build_cmds
! ./b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) cxxflags=-std=c++11 stage
endef
define $(package)_stage_cmds
! ./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) cxxflags=-std=c++11 install
endef
--- 36,44 ----
endef
define $(package)_build_cmds
! ./b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) stage
endef
define $(package)_stage_cmds
! ./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
endef

View File

@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 50)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
@@ -163,6 +163,17 @@ AC_ARG_ENABLE([zmq],
[use_zmq=$enableval],
[use_zmq=yes])
AC_ARG_ENABLE([experimental-asm],
[AS_HELP_STRING([--enable-experimental-asm],
[Enable experimental assembly routines (default is no)])],
[experimental_asm=$enableval],
[experimental_asm=no])
if test "x$experimental_asm" = xyes; then
AC_DEFINE(EXPERIMENTAL_ASM, 1, [Define this symbol to build in experimental assembly routines])
fi
AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
AC_ARG_ENABLE(man,
@@ -894,6 +905,8 @@ AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
AM_CONDITIONAL([ASAN],[test x$use_asan = xyes])
AM_CONDITIONAL([TSAN],[test x$use_tsan = xyes])
AM_CONDITIONAL([EXPERIMENTAL_ASM],[test x$experimental_asm = xyes])
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])

View File

@@ -1,99 +0,0 @@
*** configure.ac 2017-01-03 10:53:52.436371005 +0000
--- ../../komodo-jl777/configure.ac 2017-01-03 09:49:08.848505929 +0000
***************
*** 124,130 ****
[AS_HELP_STRING([--enable-hardening],
[attempt to harden the resulting executables (default is yes)])],
[use_hardening=$enableval],
! [use_hardening=no])
AC_ARG_ENABLE([reduce-exports],
[AS_HELP_STRING([--enable-reduce-exports],
--- 124,130 ----
[AS_HELP_STRING([--enable-hardening],
[attempt to harden the resulting executables (default is yes)])],
[use_hardening=$enableval],
! [use_hardening=yes])
AC_ARG_ENABLE([reduce-exports],
[AS_HELP_STRING([--enable-reduce-exports],
***************
*** 276,305 ****
fi
fi
! dnl AC_CHECK_PROG([BREW],brew, brew)
! dnl if test x$BREW = xbrew; then
dnl These Homebrew packages may be keg-only, meaning that they won't be found
dnl in expected paths because they may conflict with system files. Ask
dnl Homebrew where each one is located, then adjust paths accordingly.
dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example).
! dnl openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
! dnl bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
! dnl qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
! dnl if test x$openssl_prefix != x; then
! dnl PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
! dnl export PKG_CONFIG_PATH
! dnl fi
! dnl if test x$bdb_prefix != x; then
! dnl CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
! dnl LIBS="$LIBS -L$bdb_prefix/lib"
! dnl fi
! dnl if test x$qt5_prefix != x; then
! dnl PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
! dnl export PKG_CONFIG_PATH
! dnl fi
! dnl fi
else
case $build_os in
*darwin*)
--- 276,305 ----
fi
fi
! AC_CHECK_PROG([BREW],brew, brew)
! if test x$BREW = xbrew; then
dnl These Homebrew packages may be keg-only, meaning that they won't be found
dnl in expected paths because they may conflict with system files. Ask
dnl Homebrew where each one is located, then adjust paths accordingly.
dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example).
! openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
! bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
! qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
! if test x$openssl_prefix != x; then
! PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
! export PKG_CONFIG_PATH
! fi
! if test x$bdb_prefix != x; then
! CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
! LIBS="$LIBS -L$bdb_prefix/lib"
! fi
! if test x$qt5_prefix != x; then
! PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
! export PKG_CONFIG_PATH
! fi
! fi
else
case $build_os in
*darwin*)
***************
*** 730,736 ****
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
! LIBZCASH_LIBS="-lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium"
CXXFLAGS_TEMP="$CXXFLAGS"
LIBS_TEMP="$LIBS"
--- 730,736 ----
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
! LIBZCASH_LIBS="-lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp"
CXXFLAGS_TEMP="$CXXFLAGS"
LIBS_TEMP="$LIBS"

View File

@@ -6,6 +6,10 @@ Do not expect all scripts to work!
Please fix bugs and report things you find.
## Hush Tools
checkpoints.pl - generate checkpoint data for main.cpp
block\_time.pl - estimate when a Hush block will happen
## Wallet Tools

View File

@@ -1,8 +0,0 @@
### BitRPC
Allows for sending of all standard Bitcoin commands via RPC rather than as command line args.
### Looking for Wallet Tools?
BitRPC.py is able to do the exact same thing as `walletchangepass.py` and `walletunlock.py`. Their respective commands in BitRPC.py are:
bitrpc.py walletpassphrasechange
bitrpc.py walletpassphrase

View File

@@ -1,335 +0,0 @@
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8232")
else:
access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:8232")
cmd = sys.argv[1].lower()
if cmd == "backupwallet":
try:
path = raw_input("Enter destination path/filename: ")
print access.backupwallet(path)
except Exception as inst:
print inst
elif cmd == "encryptwallet":
try:
pwd = getpass.getpass(prompt="Enter passphrase: ")
pwd2 = getpass.getpass(prompt="Repeat passphrase: ")
if pwd == pwd2:
access.encryptwallet(pwd)
print "\n---Wallet encrypted. Server stopping, restart to run with encrypted wallet---\n"
else:
print "\n---Passphrases do not match---\n"
except Exception as inst:
print inst
elif cmd == "getaccount":
try:
addr = raw_input("Enter a Bitcoin address: ")
print access.getaccount(addr)
except Exception as inst:
print inst
elif cmd == "getaccountaddress":
try:
acct = raw_input("Enter an account name: ")
print access.getaccountaddress(acct)
except Exception as inst:
print inst
elif cmd == "getaddressesbyaccount":
try:
acct = raw_input("Enter an account name: ")
print access.getaddressesbyaccount(acct)
except Exception as inst:
print inst
elif cmd == "getbalance":
try:
acct = raw_input("Enter an account (optional): ")
mc = raw_input("Minimum confirmations (optional): ")
try:
print access.getbalance(acct, mc)
except:
print access.getbalance()
except Exception as inst:
print inst
elif cmd == "getblockbycount":
try:
height = raw_input("Height: ")
print access.getblockbycount(height)
except Exception as inst:
print inst
elif cmd == "getblockcount":
try:
print access.getblockcount()
except Exception as inst:
print inst
elif cmd == "getblocknumber":
try:
print access.getblocknumber()
except Exception as inst:
print inst
elif cmd == "getconnectioncount":
try:
print access.getconnectioncount()
except Exception as inst:
print inst
elif cmd == "getdifficulty":
try:
print access.getdifficulty()
except Exception as inst:
print inst
elif cmd == "getgenerate":
try:
print access.getgenerate()
except Exception as inst:
print inst
elif cmd == "gethashespersec":
try:
print access.gethashespersec()
except Exception as inst:
print inst
elif cmd == "getinfo":
try:
print access.getinfo()
except Exception as inst:
print inst
elif cmd == "getnewaddress":
try:
acct = raw_input("Enter an account name: ")
try:
print access.getnewaddress(acct)
except:
print access.getnewaddress()
except Exception as inst:
print inst
elif cmd == "getreceivedbyaccount":
try:
acct = raw_input("Enter an account (optional): ")
mc = raw_input("Minimum confirmations (optional): ")
try:
print access.getreceivedbyaccount(acct, mc)
except:
print access.getreceivedbyaccount()
except Exception as inst:
print inst
elif cmd == "getreceivedbyaddress":
try:
addr = raw_input("Enter a Bitcoin address (optional): ")
mc = raw_input("Minimum confirmations (optional): ")
try:
print access.getreceivedbyaddress(addr, mc)
except:
print access.getreceivedbyaddress()
except Exception as inst:
print inst
elif cmd == "gettransaction":
try:
txid = raw_input("Enter a transaction ID: ")
print access.gettransaction(txid)
except Exception as inst:
print inst
elif cmd == "getwork":
try:
data = raw_input("Data (optional): ")
try:
print access.gettransaction(data)
except:
print access.gettransaction()
except Exception as inst:
print inst
elif cmd == "help":
try:
cmd = raw_input("Command (optional): ")
try:
print access.help(cmd)
except:
print access.help()
except Exception as inst:
print inst
elif cmd == "listaccounts":
try:
mc = raw_input("Minimum confirmations (optional): ")
try:
print access.listaccounts(mc)
except:
print access.listaccounts()
except Exception as inst:
print inst
elif cmd == "listreceivedbyaccount":
try:
mc = raw_input("Minimum confirmations (optional): ")
incemp = raw_input("Include empty? (true/false, optional): ")
try:
print access.listreceivedbyaccount(mc, incemp)
except:
print access.listreceivedbyaccount()
except Exception as inst:
print inst
elif cmd == "listreceivedbyaddress":
try:
mc = raw_input("Minimum confirmations (optional): ")
incemp = raw_input("Include empty? (true/false, optional): ")
try:
print access.listreceivedbyaddress(mc, incemp)
except:
print access.listreceivedbyaddress()
except Exception as inst:
print inst
elif cmd == "listtransactions":
try:
acct = raw_input("Account (optional): ")
count = raw_input("Number of transactions (optional): ")
frm = raw_input("Skip (optional):")
try:
print access.listtransactions(acct, count, frm)
except:
print access.listtransactions()
except Exception as inst:
print inst
elif cmd == "move":
try:
frm = raw_input("From: ")
to = raw_input("To: ")
amt = raw_input("Amount:")
mc = raw_input("Minimum confirmations (optional): ")
comment = raw_input("Comment (optional): ")
try:
print access.move(frm, to, amt, mc, comment)
except:
print access.move(frm, to, amt)
except Exception as inst:
print inst
elif cmd == "sendfrom":
try:
frm = raw_input("From: ")
to = raw_input("To: ")
amt = raw_input("Amount:")
mc = raw_input("Minimum confirmations (optional): ")
comment = raw_input("Comment (optional): ")
commentto = raw_input("Comment-to (optional): ")
try:
print access.sendfrom(frm, to, amt, mc, comment, commentto)
except:
print access.sendfrom(frm, to, amt)
except Exception as inst:
print inst
elif cmd == "sendmany":
try:
frm = raw_input("From: ")
to = raw_input("To (in format address1:amount1,address2:amount2,...): ")
mc = raw_input("Minimum confirmations (optional): ")
comment = raw_input("Comment (optional): ")
try:
print access.sendmany(frm,to,mc,comment)
except:
print access.sendmany(frm,to)
except Exception as inst:
print inst
elif cmd == "sendtoaddress":
try:
to = raw_input("To (in format address1:amount1,address2:amount2,...): ")
amt = raw_input("Amount:")
comment = raw_input("Comment (optional): ")
commentto = raw_input("Comment-to (optional): ")
try:
print access.sendtoaddress(to,amt,comment,commentto)
except:
print access.sendtoaddress(to,amt)
except Exception as inst:
print inst
elif cmd == "setaccount":
try:
addr = raw_input("Address: ")
acct = raw_input("Account:")
print access.setaccount(addr,acct)
except Exception as inst:
print inst
elif cmd == "setgenerate":
try:
gen= raw_input("Generate? (true/false): ")
cpus = raw_input("Max processors/cores (-1 for unlimited, optional):")
try:
print access.setgenerate(gen, cpus)
except:
print access.setgenerate(gen)
except Exception as inst:
print inst
elif cmd == "settxfee":
try:
amt = raw_input("Amount:")
print access.settxfee(amt)
except Exception as inst:
print inst
elif cmd == "stop":
try:
print access.stop()
except Exception as inst:
print inst
elif cmd == "validateaddress":
try:
addr = raw_input("Address: ")
print access.validateaddress(addr)
except Exception as inst:
print inst
elif cmd == "walletpassphrase":
try:
pwd = getpass.getpass(prompt="Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
print "\n---Wallet unlocked---\n"
except Exception as inst:
print inst
elif cmd == "walletpassphrasechange":
try:
pwd = getpass.getpass(prompt="Enter old wallet passphrase: ")
pwd2 = getpass.getpass(prompt="Enter new wallet passphrase: ")
access.walletpassphrasechange(pwd, pwd2)
print
print "\n---Passphrase changed---\n"
except Exception as inst:
print inst
else:
print "Command not found or not supported"

23
contrib/block_time.pl Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/perl
# Copyright 2019 The Hush developers
# Released under the GPLv3
use warnings;
use strict;
# Given a block time, estimate when it will happen
my $block = shift || die "Usage: $0 123";
my $hush = "./src/hush-cli";
my $blockcount = qx{$hush getblockcount};
if ($block <= $blockcount) {
die "That block has already happened!";
} else {
my $diff = $block - $blockcount;
my $minutes = $diff*2.5;
my $seconds = $minutes*60;
my $now = time;
my $then = $now + $seconds;
my $date = localtime($then);
print "Hush Block $block will happen at roughly:\n";
print "$date # $then\n";
}

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# Copyright (c) 2019 Hush developers
# Released under the GPLv3
import sys
import base58

View File

@@ -1,5 +1,5 @@
Contents
===========
# Contrib Devtools
This directory contains tools for developers working on this repository.
github-merge.sh

View File

@@ -1,28 +1,30 @@
#!/bin/sh
# Copyright (c) 2019 The Hush developers
# Released under the GPLv3
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
SRCDIR=${SRCDIR:-$TOPDIR/src}
MANDIR=${MANDIR:-$TOPDIR/doc/man}
KOMODOD=${KOMODOD:-$SRCDIR/komodod}
KOMODOCLI=${KOMODOCLI:-$SRCDIR/komodo-cli}
KOMODOTX=${KOMODOTX:-$SRCDIR/komodo-tx}
HUSHD=${HUSHD:-$SRCDIR/hushd}
HUSHCLI=${HUSHCLI:-$SRCDIR/hush-cli}
HUSHTX=${HUSHTX:-$SRCDIR/hush-tx}
[ ! -x $KOMODOD ] && echo "$KOMODOD not found or not executable." && exit 1
[ ! -x $HUSHD ] && echo "$HUSHD not found or not executable." && exit 1
# The autodetected version git tag can screw up manpage output a little bit
KMDVER="v3.2.2"
#HUSHVER="v3.3.0"
HUSHVER=$(./src/hushd --version|head -n2|tail -n1|cut -d' ' -f4|cut -d- -f1)
# Create a footer file with copyright content.
# This gets autodetected fine for komodod if --version-string is not set,
# but has different outcomes for komodo-cli.
echo "[COPYRIGHT]" > footer.h2m
$KOMODOD --version | sed -n '1!p' >> footer.h2m
$HUSHD --version | sed -n '1!p' >> footer.h2m
for cmd in $KOMODOD $KOMODOCLI $KOMODOTX; do
for cmd in $HUSHD $HUSHCLI $HUSHTX; do
cmdname="${cmd##*/}"
help2man -N --version-string=${KMDVER} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
#sed -i "s/\\\-${KMDVER[1]}//g" ${MANDIR}/${cmdname}.1
help2man -N --version-string=${HUSHVER} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
#sed -i "s/\\\-${HUSHVER[1]}//g" ${MANDIR}/${cmdname}.1
done
rm -f footer.h2m

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env perl
# Copyright 2019 The Hush developers
# Released under the GPLv3
use warnings;
use strict;

View File

@@ -1,20 +0,0 @@
commit cfae26916dba311f6f75d444301c1f9362267c3e
Author: Matt Corallo <git@bluematt.me>
Date: Sun Mar 24 20:45:50 2013 -0400
Revert "Checkpoint at first block in 11 March chain fork"
This reverts commit f817c496a1482d05b22c8e539de67f07db1c09d9.
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp
index 62234b9..9b11f0b 100644
--- a/src/checkpoints.cpp
+++ b/src/checkpoints.cpp
@@ -44,7 +44,6 @@ namespace Checkpoints
(193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
(210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
(216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
- (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
;
static const CCheckpointData data = {
&mapCheckpoints,

View File

@@ -1,21 +0,0 @@
*** depends/hosts/darwin.mk 2017-01-03 10:53:52.440371182 +0000
--- ../../komodo-jl777/depends/hosts/darwin.mk 2017-01-03 09:48:21.650035146 +0000
***************
*** 2,9 ****
OSX_SDK_VERSION=10.9
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=241.9
! darwin_CC=gcc-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
! darwin_CXX=g++-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)
--- 2,9 ----
OSX_SDK_VERSION=10.9
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=241.9
! darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
! darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

View File

@@ -1,40 +0,0 @@
*** depends/builders/darwin.mk 2017-01-03 10:53:52.440371182 +0000
--- ../../komodo-jl777/depends/builders/darwin.mk 2017-01-03 09:48:21.646034937 +0000
***************
*** 1,5 ****
! build_darwin_CC = gcc-6
! build_darwin_CXX = g++-6
build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip)
--- 1,5 ----
! build_darwin_CC: = $(shell xcrun -f clang)
! build_darwin_CXX: = $(shell xcrun -f clang++)
build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip)
***************
*** 7,17 ****
build_darwin_NM: = $(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_SHA256SUM = shasum -a 256
! build_darwin_DOWNLOAD = wget --timeout=$(DOWNLOAD_CONNECT_TIMEOUT) --tries=$(DOWNLOAD_RETRIES) -nv -O
#darwin host on darwin builder. overrides darwin host preferences.
! darwin_CC= gcc-6
! darwin_CXX= g++-6
darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip)
--- 7,17 ----
build_darwin_NM: = $(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_SHA256SUM = shasum -a 256
! build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o
#darwin host on darwin builder. overrides darwin host preferences.
! darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION)
! darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION)
darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip)

View File

@@ -1,11 +1,10 @@
package=libsodium
$(package)_version=1.0.15
$(package)_download_path=https://github.com/jedisct1/libsodium/releases/download/1.0.15
$(package)_version=1.0.18
$(package)_download_path=https://github.com/MyHush/libsodium/releases/download/$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4
$(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
$(package)_dependencies=
$(package)_config_opts=
ifeq ($(build_os),darwin)
define $(package)_set_vars
$(package)_build_env=MACOSX_DEPLOYMENT_TARGET="10.11"

View File

@@ -1,5 +1,5 @@
$(package)_version=3.1
$(package)_download_path=https://github.com/nemtrif/$(package)/archive/
$(package)_download_path=https://github.com/MyHush/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=v$($(package)_version).tar.gz
$(package)_sha256_hash=ab531c3fd5d275150430bfaca01d7d15e017a188183be932322f2f651506b096

View File

@@ -1,74 +0,0 @@
Hotfix Release Process
======================
Hotfix releases are versioned by incrementing the build number of the latest
release. For example:
First hotfix: v1.0.11 -> v1.0.11-1
Second hotfix: v1.0.11-1 -> v1.0.11-2
In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie.
v1.0.11 (not 1.0.11).
## Create a hotfix branch
Create a hotfix branch from the previous release tag, and push it to the main
repository:
$ git branch hotfix-<RELEASE> <RELEASE_PREV>
$ git push 'git@github.com:zcash/zcash' hotfix-<RELEASE>
## Implement hotfix changes
Hotfix changes are implemented the same way as regular changes (developers work
in separate branches per change, and push the branches to their own repositories),
except that the branches are based on the hotfix branch instead of master:
$ git checkout hotfix-<RELEASE>
$ git checkout -b <BRANCH_NAME>
## Merge hotfix PRs
Hotfix PRs are created like regular PRs, except using the hotfix branch as the
base instead of master. Each PR should be reviewed as normal, and then the
following process should be used to merge:
- A CI merge build is manually run by logging into the CI server, going to the
pr-merge builder, clicking the "force" button, and entering the following
values:
- Repository: https://github.com/<DevUser>/zcash
- <DevUser> must be in the set of "safe" users as-specified in the CI
config.
- Branch: name of the hotfix PR branch (not the hotfix release branch).
- A link to the build and its result is manually added to the PR as a comment.
- If the build was successful, the PR is merged via the GitHub button.
## Release process
The majority of this process is identical to the standard release process.
However, there are a few notable differences:
- When running the release script, use the `--hotfix` flag:
$ ./zcutil/make-release.py --hotfix <RELEASE> <RELEASE_PREV> <APPROX_RELEASE_HEIGHT>
- To review the automated changes in git:
$ git log hotfix-<RELEASE>..HEAD
- After the standard review process, use the hotfix merge process outlined above
instead of the regular merge process.
- When making the tag, check out the hotfix branch instead of master.
## Post-release
Once the hotfix release has been created, a new PR should be opened for merging
the hotfix release branch into master. This may require fixing merge conflicts
(e.g. changing the version number in the hotfix branch to match master, if
master is ahead). Such conflicts **MUST** be addressed with additional commits
to the hotfix branch; specifically, the branch **MUST NOT** be rebased on
master.

View File

@@ -1,4 +1,4 @@
*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
*** Warning: This document has not been updated for Hush and may be inaccurate. ***
Sample init scripts and service configuration for bitcoind
==========================================================

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODO-CLI "1" "November 2019" "komodo-cli v3.2.1" "User Commands"
.TH KOMODO-CLI "1" "December 2019" "komodo-cli v3.3.0" "User Commands"
.SH NAME
komodo-cli \- manual page for komodo-cli v3.2.2
komodo-cli \- manual page for komodo-cli v3.3.0
.SH DESCRIPTION
Komodo RPC client version v3.2.1\-7965ffc29\-dirty
Komodo RPC client version v3.3.0\-bde7744d9
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODO-TX "1" "November 2019" "komodo-tx v3.2.1" "User Commands"
.TH KOMODO-TX "1" "December 2019" "komodo-tx v3.3.0" "User Commands"
.SH NAME
komodo-tx \- manual page for komodo-tx v3.2.2
komodo-tx \- manual page for komodo-tx v3.3.0
.SH DESCRIPTION
Hush komodo\-tx utility version v3.2.1\-7965ffc29\-dirty
Hush komodo\-tx utility version v3.3.0\-bde7744d9
.SS "Usage:"
.TP
komodo\-tx [options] <hex\-tx> [commands]

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODOD "1" "November 2019" "komodod v3.2.1" "User Commands"
.TH KOMODOD "1" "December 2019" "komodod v3.3.0" "User Commands"
.SH NAME
komodod \- manual page for komodod v3.2.2
komodod \- manual page for komodod v3.3.0
.SH DESCRIPTION
Hush Daemon version v3.2.1\-7965ffc29\-dirty
Hush Daemon version v3.3.0\-bde7744d9
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.

View File

@@ -39,7 +39,7 @@ RPC parameter conventions:
* taddr : Transparent address
* zaddr : Private address
* address : Accepts both private and transparent addresses.
* amount : JSON format decimal number with at most 8 digits of precision, with 1 ZEC expressed as 1.00000000.
* amount : JSON format decimal number with at most 8 digits of precision, with 1 HUSH expressed as 1.00000000.
* memo : Metadata expressed in hexadecimal format. Limited to 512 bytes, the current size of the memo field of a private transaction. Zero padding is automatic.
### Accounting
@@ -75,7 +75,7 @@ Command | Parameters | Description
--- | --- | ---
z_listreceivedbyaddress<br> | zaddr [minconf=1] | Return a list of amounts received by a zaddr belonging to the nodes wallet.<br><br>Optionally set the minimum number of confirmations which a received amount must have in order to be included in the result. Use 0 to count unconfirmed transactions.<br><br>Output:<br>[{<br>“txid”: “4a0f…”,<br>“amount”: 0.54,<br>“memo”:”F0FF…”,}, {...}, {...}<br>]
z_listunspent | [minconf=1] [maxconf=9999999] [includeWatchonly=false] [zaddrs] | Returns array of unspent shielded notes with between minconf and maxconf (inclusive) confirmations.<br><br>Optionally filter to only include notes sent to specified addresses.<br><br>When minconf is 0, unspent notes with zero confirmations are returned, even though they are not immediately spendable.<br><br>Results are an array of Objects, each of which has: {txid, jsindex, jsoutindex, confirmations, address, amount, memo}
z_sendmany<br> | fromaddress amounts [minconf=1] [fee=0.0001] | _This is an Asynchronous RPC call_<br><br>Send funds from an address to multiple outputs. The address can be either a taddr or a zaddr.<br><br>Amounts is a list containing key/value pairs corresponding to the addresses and amount to pay. Each output address can be in taddr or zaddr format.<br><br>When sending to a zaddr, you also have the option of attaching a memo in hexadecimal format.<br><br>**NOTE:**When sending coinbase funds to a zaddr, the node's wallet does not allow any change. Put another way, spending a partial amount of a coinbase utxo is not allowed. This is not a consensus rule but a local wallet rule due to the current implementation of z_sendmany. In future, this rule may be removed.<br><br>Example of Outputs parameter:<br>[{“address”:”t123…”, “amount”:0.005},<br>,{“address”:”z010…”,”amount”:0.03, “memo”:”f508af…”}]<br><br>Optionally set the minimum number of confirmations which a private or transparent transaction must have in order to be used as an input. When sending from a zaddr, minconf must be greater than zero.<br><br>Optionally set a transaction fee, which by default is 0.0001 ZEC.<br><br>Any transparent change will be sent to a new transparent address. Any private change will be sent back to the zaddr being used as the source of funds.<br><br>Returns an operationid. You use the operationid value with z_getoperationstatus and z_getoperationresult to obtain the result of sending funds, which if successful, will be a txid.
z_sendmany<br> | fromaddress amounts [minconf=1] [fee=0.0001] | _This is an Asynchronous RPC call_<br><br>Send funds from an address to multiple outputs. The address can be either a taddr or a zaddr.<br><br>Amounts is a list containing key/value pairs corresponding to the addresses and amount to pay. Each output address can be in taddr or zaddr format.<br><br>When sending to a zaddr, you also have the option of attaching a memo in hexadecimal format.<br><br>**NOTE:**When sending coinbase funds to a zaddr, the node's wallet does not allow any change. Put another way, spending a partial amount of a coinbase utxo is not allowed. This is not a consensus rule but a local wallet rule due to the current implementation of z_sendmany. In future, this rule may be removed.<br><br>Example of Outputs parameter:<br>[{“address”:”t123…”, “amount”:0.005},<br>,{“address”:”z010…”,”amount”:0.03, “memo”:”f508af…”}]<br><br>Optionally set the minimum number of confirmations which a private or transparent transaction must have in order to be used as an input. When sending from a zaddr, minconf must be greater than zero.<br><br>Optionally set a transaction fee, which by default is 0.0001 HUSH.<br><br>Any transparent change will be sent to a new transparent address. Any private change will be sent back to the zaddr being used as the source of funds.<br><br>Returns an operationid. You use the operationid value with z_getoperationstatus and z_getoperationresult to obtain the result of sending funds, which if successful, will be a txid.
z_shieldcoinbase<br> | fromaddress toaddress [fee=0.0001] [limit=50] | _This is an Asynchronous RPC call_<br><br>Shield transparent coinbase funds by sending to a shielded z address. Utxos selected for shielding will be locked. If there is an error, they are unlocked. The RPC call `listlockunspent` can be used to return a list of locked utxos.<br><br>The number of coinbase utxos selected for shielding can be set with the limit parameter, which has a default value of 50. If the parameter is set to 0, the number of utxos selected is limited by the `-mempooltxinputlimit` option. Any limit is constrained by a consensus rule defining a maximum transaction size of 100000 bytes. <br><br>The from address is a taddr or "*" for all taddrs belonging to the wallet. The to address is a zaddr. The default fee is 0.0001.<br><br>Returns an object containing an operationid which can be used with z_getoperationstatus and z_getoperationresult, along with key-value pairs regarding how many utxos are being shielded in this transaction and what remains to be shielded.
### Operations
@@ -105,7 +105,7 @@ It is currently not possible to cancel operations.
Command | Parameters | Description
--- | --- | ---
z_getoperationresult <br>| [operationids] | Return OperationStatus JSON objects for all completed operations the node is currently aware of, and then remove the operation from memory.<br><br>Operationids is an optional array to filter which operations you want to receive status objects for.<br><br>Output is a list of operation status objects, where the status is either "failed", "cancelled" or "success".<br>[<br>{“operationid”: “opid-11ee…”,<br>“status”: “cancelled”},<br>{“operationid”: “opid-9876”, “status”: ”failed”},<br>{“operationid”: “opid-0e0e”,<br>“status”:”success”,<br>“execution_time”:”25”,<br>“result”: {“txid”:”af3887654…”,...}<br>},<br>]<br><br> Examples:<br>zcash-cli z_getoperationresult '["opid-8120fa20-5ee7-4587-957b-f2579c2d882b"]'<br> zcash-cli z_getoperationresult
z_getoperationresult <br>| [operationids] | Return OperationStatus JSON objects for all completed operations the node is currently aware of, and then remove the operation from memory.<br><br>Operationids is an optional array to filter which operations you want to receive status objects for.<br><br>Output is a list of operation status objects, where the status is either "failed", "cancelled" or "success".<br>[<br>{“operationid”: “opid-11ee…”,<br>“status”: “cancelled”},<br>{“operationid”: “opid-9876”, “status”: ”failed”},<br>{“operationid”: “opid-0e0e”,<br>“status”:”success”,<br>“execution_time”:”25”,<br>“result”: {“txid”:”af3887654…”,...}<br>},<br>]<br><br> Examples:<br>hush-cli z_getoperationresult '["opid-8120fa20-5ee7-4587-957b-f2579c2d882b"]'<br> hush-cli z_getoperationresult
z_getoperationstatus <br>| [operationids] | Return OperationStatus JSON objects for all operations the node is currently aware of.<br><br>Operationids is an optional array to filter which operations you want to receive status objects for.<br><br>Output is a list of operation status objects.<br>[<br>{“operationid”: “opid-12ee…”,<br>“status”: “queued”},<br>{“operationid”: “opd-098a…”, “status”: ”executing”},<br>{“operationid”: “opid-9876”, “status”: ”failed”}<br>]<br><br>When the operation succeeds, the status object will also include the result.<br><br>{“operationid”: “opid-0e0e”,<br>“status”:”success”,<br>“execution_time”:”25”,<br>“result”: {“txid”:”af3887654…”,...}<br>}
z_listoperationids <br>| [state] | Return a list of operationids for all operations which the node is currently aware of.<br><br>State is an optional string parameter to filter the operations you want listed by their state. Acceptable parameter values are queued, executing, success, failed, cancelled.<br><br>[“opid-0e0e…”, “opid-1af4…”, … ]

View File

@@ -50,7 +50,7 @@ To validate a payment disclosure, the following RPC call can be used:
Generate a payment disclosure for the first joinsplit, second output (index starts from zero):
zcash-cli z_getpaymentdisclosure 79189528d611e811a1c7bb0358dd31343033d14b4c1e998d7c4799c40f8b652b 0 1 "Hello"
hush-cli z_getpaymentdisclosure 79189528d611e811a1c7bb0358dd31343033d14b4c1e998d7c4799c40f8b652b 0 1 "Hello"
This returns a payment disclosure in the form of a hex string:
@@ -58,7 +58,7 @@ This returns a payment disclosure in the form of a hex string:
To validate the payment disclosure:
zcash-cli z_validatepaymentdisclosure HEXDATA
hush-cli z_validatepaymentdisclosure HEXDATA
This returns data related to the payment and the payment disclosure:

View File

@@ -1,151 +1,26 @@
Release Process
====================
Meta: There should always be a single release engineer to disambiguate responsibility.
If this is a hotfix release, please see `./hotfix-process.md` before proceeding.
# Hush Release Process
## Pre-release
### Github Milestone
### Github Issues
Ensure all goals for the github milestone are met. If not, remove tickets
or PRs with a comment as to why it is not included. (Running out of time
is a common reason.)
Looks for Github issues that should be fixed in the next release.
### Pre-release checklist:
Check that dependencies are properly hosted by looking at the `check-depends` builder:
https://ci.z.cash/#/builders/1
Check that there are no surprising performance regressions:
https://speed.z.cash
Ensure that new performance metrics appear on that site.
Update `src/chainparams.cpp` nMinimumChainWork with information from the getblockchaininfo rpc.
...
### Protocol Safety Checks:
If this release changes the behavior of the protocol or fixes a serious
bug, verify that a pre-release PR merge updated `PROTOCOL_VERSION` in
`version.h` correctly.
If this release breaks backwards compatibility or needs to prevent
interaction with software forked projects, change the network magic
numbers. Set the four `pchMessageStart` in `CTestNetParams` in
`chainparams.cpp` to random values.
Both of these should be done in standard PRs ahead of the release
process. If these were not anticipated correctly, this could block the
release, so if you suspect this is necessary, double check with the
whole engineering team.
## Release dependencies
The release script has the following dependencies:
Instal deps on Linxu:
- `help2man`
- `debchange` (part of the devscripts Debian package)
apt-get install help2man debchange
You can optionally install the `progressbar2` Python module with pip to have a
progress bar displayed during the build process.
## Release process
In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie.
v1.0.9 (not 1.0.9).
### Create the release branch
Run the release script, which will verify you are on the latest clean
checkout of master, create a branch, then commit standard automated
changes to that branch locally:
$ ./zcutil/make-release.py <RELEASE> <RELEASE_PREV> <RELEASE_FROM> <APPROX_RELEASE_HEIGHT>
Examples:
$ ./zcutil/make-release.py v1.0.9 v1.0.8-1 v1.0.8-1 120000
$ ./zcutil/make-release.py v1.0.13 v1.0.13-rc1 v1.0.12 222900
### Create, Review, and Merge the release branch pull request
Review the automated changes in git:
$ git log master..HEAD
Push the resulting branch to github:
$ git push 'git@github.com:$YOUR_GITHUB_NAME/zcash' $(git rev-parse --abbrev-ref HEAD)
Then create the PR on github. Complete the standard review process,
then merge, then wait for CI to complete.
## Make tag for the newly merged result
Checkout master and pull the latest version to ensure master is up to date with the release PR which was merged in before.
$ git checkout master
$ git pull --ff-only
Check the last commit on the local and remote versions of master to make sure they are the same:
$ git log -1
The output should include something like, which is created by Homu:
Auto merge of #4242 - nathan-at-least:release-v1.0.9, r=nathan-at-least
Then create the git tag. The `-s` means the release tag will be
signed. **CAUTION:** Remember the `v` at the beginning here:
$ git tag -s v1.0.9
$ git push origin v1.0.9
## Make and deploy deterministic builds
- Run the [Gitian deterministic build environment](https://github.com/zcash/zcash-gitian)
- Compare the uploaded [build manifests on gitian.sigs](https://github.com/zcash/gitian.sigs)
- If all is well, the DevOps engineer will build the Debian packages and update the
[apt.z.cash package repository](https://apt.z.cash).
## Add release notes to GitHub
- Go to the [GitHub tags page](https://github.com/zcash/zcash/tags).
- Click "Add release notes" beside the tag for this release.
- Copy the release blog post into the release description, and edit to suit
publication on GitHub. See previous release notes for examples.
- Click "Publish release" if publishing the release blog post now, or
"Save draft" to store the notes internally (and then return later to publish
once the blog post is up).
Note that some GitHub releases are marked as "Verified", and others as
"Unverified". This is related to the GPG signature on the release tag - in
particular, GitHub needs the corresponding public key to be uploaded to a
corresponding GitHub account. If this release is marked as "Unverified", click
the marking to see what GitHub wants to be done.
## Post Release Task List
### Deploy testnet
Notify the Zcash DevOps engineer/sysadmin that the release has been tagged. They update some variables in the company's automation code and then run an Ansible playbook, which:
* builds Zcash based on the specified branch
* deploys it as a public service (e.g. betatestnet.z.cash, mainnet.z.cash)
* often the same server can be re-used, and the role idempotently handles upgrades, but if not then they also need to update DNS records
* possible manual steps: blowing away the `testnet3` dir, deleting old parameters, restarting DNS seeder
Then, verify that nodes can connect to the testnet server, and update the guide on the wiki to ensure the correct hostname is listed in the recommended zcash.conf.
### Update the 1.0 User Guide
This also means updating [the translations](https://github.com/zcash/zcash-docs).
Coordinate with the translation team for now. Suggestions for improving this
part of the process should be added to #2596.
### Publish the release announcement (blog, github, zcash-dev, slack)
## Celebrate
...

View File

@@ -30,19 +30,19 @@ The default fee is 0.0010000 ZEC and the default limit on the maximum number of
Sweep up coinbase UTXOs from a transparent address you use for mining:
zcash-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress
hush-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress
Sweep up coinbase UTXOs from multiple transparent addresses to a shielded address:
zcash-cli z_shieldcoinbase "*" zMyPrivateAddress
hush-cli z_shieldcoinbase "*" zMyPrivateAddress
Sweep up with a fee of 1.23 ZEC:
zcash-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress 1.23
hush-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress 1.23
Sweep up with a fee of 0.1 ZEC and set limit on the maximum number of UTXOs to shield at 25:
zcash-cli z_shieldcoinbase "*" zMyPrivateAddress 0.1 25
hush-cli z_shieldcoinbase "*" zMyPrivateAddress 0.1 25
### Asynchronous Call
@@ -50,7 +50,7 @@ The `z_shieldcoinbase` RPC call is an asynchronous call, so you can queue up mul
When you invoke
zcash-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress
hush-cli z_shieldcoinbase tMyMiningAddress zMyPrivateAddress
JSON will be returned immediately, with the following data fields populated:

View File

@@ -28,7 +28,7 @@ Note that zcashd will need to be stopped and restarted for edits in the config f
To create a backup of your wallet, use:
`zcash-cli backupwallet <nameofbackup>`.
`hush-cli backupwallet <nameofbackup>`.
The backup will be an exact copy of the current state of your wallet.dat file stored in the export directory you specified in the config file. The file path will also be returned.
@@ -40,51 +40,51 @@ If your original `wallet.dat` file becomes inaccessible for whatever reason, you
If you prefer to have an export of your private keys in human readable format, you can use:
`zcash-cli z_exportwallet <nameofbackup>`
`hush-cli z_exportwallet <nameofbackup>`
This will generate a file in the export directory listing all transparent and shielded private keys with their associated public addresses. The file path will be returned in the command line.
To import keys into a wallet which were previously exported to a file, use:
`zcash-cli z_importwallet <path/to/exportdir/nameofbackup>`
`hush-cli z_importwallet <path/to/exportdir/nameofbackup>`
### Using `z_exportkey`, `z_importkey`, `dumpprivkey` & `importprivkey`
If you prefer to export a single private key for a shielded address, you can use:
`zcash-cli z_exportkey <z-address>`
`hush-cli z_exportkey <z-address>`
This will return the private key and will not create a new file.
For exporting a single private key for a transparent address, you can use the command inherited from Bitcoin:
`zcash-cli dumpprivkey <t-address>`
`hush-cli dumpprivkey <t-address>`
This will return the private key and will not create a new file.
To import a private key for a shielded address, use:
`zcash-cli z_importkey <z-priv-key>`
`hush-cli z_importkey <z-priv-key>`
This will add the key to your wallet and rescan the wallet for associated transactions if it is not already part of the wallet.
The rescanning process can take a few minutes for a new private key. To skip it, instead use:
`zcash-cli z_importkey <z-private-key> no`
`hush-cli z_importkey <z-private-key> no`
For other instructions on fine-tuning the wallet rescan, see the command's help documentation:
`zcash-cli help z_importkey`
`hush-cli help z_importkey`
To import a private key for a transparent address, use:
`zcash-cli importprivkey <t-priv-key>`
`hush-cli importprivkey <t-priv-key>`
This has the same functionality as `z_importkey` but works with transparent addresses.
See the command's help documentation for instructions on fine-tuning the wallet rescan:
`zcash-cli help importprivkey`
`hush-cli help importprivkey`
### Using `dumpwallet`

View File

@@ -1,35 +0,0 @@
*** src/crypto/equihash.cpp 2017-01-03 10:53:52.444371361 +0000
--- ../../komodo-jl777/src/crypto/equihash.cpp 2017-01-03 09:48:21.690037241 +0000
***************
*** 21,50 ****
#include <boost/optional.hpp>
- #ifdef __APPLE__
- #include <machine/endian.h>
- #include <libkern/OSByteOrder.h>
-
- #define htobe16(x) OSSwapHostToBigInt16(x)
- #define htole16(x) OSSwapHostToLittleInt16(x)
- #define be16toh(x) OSSwapBigToHostInt16(x)
- #define le16toh(x) OSSwapLittleToHostInt16(x)
-
- #define htobe32(x) OSSwapHostToBigInt32(x)
- #define htole32(x) OSSwapHostToLittleInt32(x)
- #define be32toh(x) OSSwapBigToHostInt32(x)
- #define le32toh(x) OSSwapLittleToHostInt32(x)
-
- #define htobe64(x) OSSwapHostToBigInt64(x)
- #define htole64(x) OSSwapHostToLittleInt64(x)
- #define be64toh(x) OSSwapBigToHostInt64(x)
- #define le64toh(x) OSSwapLittleToHostInt64(x)
-
- #define __BIG_ENDIAN BIG_ENDIAN
- #define __LITTLE_ENDIAN LITTLE_ENDIAN
- #define __BYTE_ORDER BYTE_ORDER
- #endif
-
EhSolverCancelledException solver_cancelled;
template<unsigned int N, unsigned int K>
--- 21,26 ----

View File

@@ -1,52 +0,0 @@
*** depends/packages/libsnark.mk 2017-01-03 10:53:52.440371182 +0000
--- ../../komodo-jl777/depends/packages/libsnark.mk 2017-01-03 09:48:21.650035146 +0000
***************
*** 1,30 ****
package=libsnark
$(package)_version=0.1
! $(package)_download_path=https://github.com/radix42/$(package)/archive
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
! $(package)_sha256_hash=9dbd5b44d3443e86463e934bfe1023cab4ca5948f8d74c23a67d9535c28d2584
! $(package)_git_commit=9be18569b8abcda1245c3912877075259599c0f1
$(package)_dependencies=libgmp libsodium
- ifeq ($(build_os),darwin)
- define $(package)_build_cmds
- CC=gcc-6 CXX=g++-6 CXXFLAGS="-arch x86_64 -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=0 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT
- endef
- else
define $(package)_build_cmds
CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64 -g "
endef
-
-
-
- endif
-
-
-
-
define $(package)_stage_cmds
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
endef
--- 1,17 ----
package=libsnark
$(package)_version=0.1
! $(package)_download_path=https://github.com/zcash/$(package)/archive
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
! $(package)_sha256_hash=9422b1a2a94e6b8be61f07af7f146087c2a7d70b208d07ad076622225aa7f0e4
! $(package)_git_commit=2e6314a9f7efcd9af1c77669d7d9a229df86a777
$(package)_dependencies=libgmp libsodium
define $(package)_build_cmds
CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64 -g "
endef
define $(package)_stage_cmds
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
endef

View File

@@ -1,17 +0,0 @@
*** depends/packages/packages.mk 2017-01-03 10:53:52.440371182 +0000
--- ../../komodo-jl777/depends/packages/packages.mk 2017-01-03 09:48:21.650035146 +0000
***************
*** 1,12 ****
zcash_packages := libsnark libgmp libsodium
-
- ifeq ($(build_os),darwin)
- packages := boost openssl $(zcash_packages)
- else
packages := boost openssl $(zcash_packages) googletest googlemock
- endif
-
-
native_packages := native_ccache
wallet_packages=bdb
--- 1,5 ----

View File

@@ -68,7 +68,6 @@ testScripts=(
'zcjoinsplitdoublespend.py'
'ivk_import_export.py'
'zkey_import_export.py'
'reorg_limit.py'
'getblocktemplate.py'
'bip65-cltv-p2p.py'
'bipdersig-p2p.py'

0
qa/rpc-tests/addressindex.py Normal file → Executable file
View File

0
qa/rpc-tests/cryptoconditions.py Normal file → Executable file
View File

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python2
# Copyright (c) 2018 The Hush developers
# Copyright (c) 2018-2019 The Hush developers
# Copyright (c) 2019 The SuperNET developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

View File

@@ -39,7 +39,7 @@ class MempoolUpgradeActivationTest(BitcoinTestFramework):
self.nodes[0].generate(97)
self.sync_all()
# Shield some ZEC
# Shield some HUSH
node1_taddr = self.nodes[1].getnewaddress()
node0_zaddr = self.nodes[0].z_getnewaddress()
recipients = [{'address': node0_zaddr, 'amount': Decimal('10')}]

View File

@@ -1,84 +0,0 @@
#!/usr/bin/env python2
# Copyright (c) 2017 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test reorg limit
#
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
check_node,
connect_nodes_bi,
sync_blocks,
)
from time import sleep
def check_stopped(i, timeout=10):
stopped = False
for x in xrange(1, timeout):
ret = check_node(i)
if ret is None:
sleep(1)
else:
stopped = True
break
return stopped
class ReorgLimitTest(BitcoinTestFramework):
def run_test(self):
assert(self.nodes[0].getblockcount() == 200)
assert(self.nodes[2].getblockcount() == 200)
self.split_network()
print "Test the maximum-allowed reorg:"
print "Mine 99 blocks on Node 0"
self.nodes[0].generate(99)
assert(self.nodes[0].getblockcount() == 299)
assert(self.nodes[2].getblockcount() == 200)
print "Mine competing 100 blocks on Node 2"
self.nodes[2].generate(100)
assert(self.nodes[0].getblockcount() == 299)
assert(self.nodes[2].getblockcount() == 300)
print "Connect nodes to force a reorg"
connect_nodes_bi(self.nodes, 0, 2)
self.is_network_split = False
sync_blocks(self.nodes)
print "Check Node 0 is still running and on the correct chain"
assert(self.nodes[0].getblockcount() == 300)
self.split_network()
print "Test the minimum-rejected reorg:"
print "Mine 100 blocks on Node 0"
self.nodes[0].generate(100)
assert(self.nodes[0].getblockcount() == 400)
assert(self.nodes[2].getblockcount() == 300)
print "Mine competing 101 blocks on Node 2"
self.nodes[2].generate(101)
assert(self.nodes[0].getblockcount() == 400)
assert(self.nodes[2].getblockcount() == 401)
print "Sync nodes to force a reorg"
connect_nodes_bi(self.nodes, 0, 2)
self.is_network_split = False
# sync_blocks uses RPC calls to wait for nodes to be synced, so don't
# call it here, because it will have a non-specific connection error
# when Node 0 stops. Instead, we explicitly check for the process itself
# to stop.
print "Check Node 0 is no longer running"
assert(check_stopped(0))
# Dummy stop to enable the test to tear down
self.nodes[0].stop = lambda: True
if __name__ == '__main__':
ReorgLimitTest().main()

0
qa/rpc-tests/spentindex.py Normal file → Executable file
View File

View File

@@ -1,4 +1,5 @@
# mininode.py - Bitcoin P2P network half-a-node
# Copyright (c) 2019 The Hush developers
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -43,14 +44,14 @@ OVERWINTER_PROTO_VERSION = 170003
BIP0031_VERSION = 60000
SPROUT_PROTO_VERSION = 170002 # past bip-31 for ping/pong
SAPLING_PROTO_VERSION = 170006
MY_SUBVERSION = "/python-mininode-tester:0.0.1/"
MY_SUBVERSION = "/python-mininode-hush-tester:0.0.1/"
OVERWINTER_VERSION_GROUP_ID = 0x03C48270
MAX_INV_SZ = 50000
COIN = 100000000 # 1 zec in zatoshis
COIN = 100000000 # 1 HUSH in puposhis
# Keep our own socket map for asyncore, so that we can track disconnects
# ourselves (to workaround an issue with closing an asyncore socket when

0
qa/rpc-tests/timestampindex.py Normal file → Executable file
View File

0
qa/rpc-tests/txindex.py Normal file → Executable file
View File

View File

@@ -24,7 +24,7 @@ class WalletChangeIndicatorTest (BitcoinTestFramework):
self.nodes[0].sendtoaddress(taddr, Decimal('1.0'))
self.generate_and_sync()
# Send 1 ZEC to a zaddr
# Send 1 HUSH to a zaddr
wait_and_assert_operationid_status(self.nodes[1], self.nodes[1].z_sendmany(taddr, [{'address': zaddr1, 'amount': 1.0, 'memo': 'c0ffee01'}], 1, 0))
self.generate_and_sync()

View File

@@ -36,7 +36,7 @@ class ListReceivedTest (BitcoinTestFramework):
self.nodes[0].sendtoaddress(taddr, 2.0)
self.generate_and_sync(height+2)
# Send 1 ZEC to zaddr1
# Send 1 HUSH to zaddr1
opid = self.nodes[1].z_sendmany(taddr,
[{'address': zaddr1, 'amount': 1, 'memo': my_memo}])
txid = wait_and_assert_operationid_status(self.nodes[1], opid)
@@ -52,7 +52,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_false(r[0]['change'], "Note should not be change")
assert_equal(my_memo, r[0]['memo'])
# Confirm transaction (1 ZEC from taddr to zaddr1)
# Confirm transaction (1 HUSH from taddr to zaddr1)
self.generate_and_sync(height+3)
# Require one confirmation, note should be present

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python2
# Copyright (c) 2018 The Zcash developers
# Copyright (c) 2019 The Hush developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -185,18 +186,5 @@ class WalletSaplingTest(BitcoinTestFramework):
self.nodes[2].z_importkey(sk1, "yes")
assert_equal(self.nodes[2].z_getbalance(saplingAddr1), Decimal('5'))
# Make sure we get a useful error when trying to send to both sprout and sapling
node4_sproutaddr = self.nodes[3].z_getnewaddress('sprout')
node4_saplingaddr = self.nodes[3].z_getnewaddress('sapling')
try:
self.nodes[1].z_sendmany(
taddr1,
[{'address': node4_sproutaddr, 'amount': 2.5}, {'address': node4_saplingaddr, 'amount': 2.4999}],
1, 0.0001
)
raise AssertionError("Should have thrown an exception")
except JSONRPCException as e:
assert_equal("Cannot send to both Sprout and Sapling addresses using z_sendmany", e.error['message'])
if __name__ == '__main__':
WalletSaplingTest().main()

View File

@@ -40,7 +40,7 @@ class JoinSplitTest(BitcoinTestFramework):
assert_equal(self.cannot_joinsplit(node, txn), True)
def run_test(self):
# All nodes should start with 250 ZEC:
# All nodes should start with 250 HUSH:
starting_balance = 250
for i in range(4):
assert_equal(self.nodes[i].getbalance(), starting_balance)

View File

@@ -146,7 +146,7 @@ class ZkeyImportExportTest (BitcoinTestFramework):
bob_fee = Decimal(0)
# Try to reproduce zombie balance reported in #1936
# At generated zaddr, receive ZEC, and send ZEC back out. bob -> alice
# At generated zaddr, receive HUSH, and send HUSH back out. bob -> alice
for amount in amounts[:2]:
print("Sending amount from bob to alice: ", amount)
z_send(bob, bob_zaddr, alice_zaddr, amount)

View File

@@ -413,6 +413,11 @@ crypto_libbitcoin_crypto_a_SOURCES = \
crypto/sha512.cpp \
crypto/sha512.h
if EXPERIMENTAL_ASM
crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
endif
if ENABLE_MINING
EQUIHASH_TROMP_SOURCES = \
pow/tromp/equi_miner.h \

View File

@@ -1,418 +0,0 @@
bin_PROGRAMS += qt/komodo-qt
EXTRA_LIBRARIES += qt/libbitcoinqt.a
# bitcoin qt core #
QT_TS = \
qt/locale/bitcoin_ach.ts \
qt/locale/bitcoin_af_ZA.ts \
qt/locale/bitcoin_ar.ts \
qt/locale/bitcoin_be_BY.ts \
qt/locale/bitcoin_bg.ts \
qt/locale/bitcoin_bs.ts \
qt/locale/bitcoin_ca_ES.ts \
qt/locale/bitcoin_ca.ts \
qt/locale/bitcoin_ca@valencia.ts \
qt/locale/bitcoin_cmn.ts \
qt/locale/bitcoin_cs.ts \
qt/locale/bitcoin_cy.ts \
qt/locale/bitcoin_da.ts \
qt/locale/bitcoin_de.ts \
qt/locale/bitcoin_el_GR.ts \
qt/locale/bitcoin_en.ts \
qt/locale/bitcoin_eo.ts \
qt/locale/bitcoin_es_CL.ts \
qt/locale/bitcoin_es_DO.ts \
qt/locale/bitcoin_es_MX.ts \
qt/locale/bitcoin_es.ts \
qt/locale/bitcoin_es_UY.ts \
qt/locale/bitcoin_et.ts \
qt/locale/bitcoin_eu_ES.ts \
qt/locale/bitcoin_fa_IR.ts \
qt/locale/bitcoin_fa.ts \
qt/locale/bitcoin_fi.ts \
qt/locale/bitcoin_fr_CA.ts \
qt/locale/bitcoin_fr.ts \
qt/locale/bitcoin_gl.ts \
qt/locale/bitcoin_gu_IN.ts \
qt/locale/bitcoin_he.ts \
qt/locale/bitcoin_hi_IN.ts \
qt/locale/bitcoin_hr.ts \
qt/locale/bitcoin_hu.ts \
qt/locale/bitcoin_id_ID.ts \
qt/locale/bitcoin_it.ts \
qt/locale/bitcoin_ja.ts \
qt/locale/bitcoin_ka.ts \
qt/locale/bitcoin_kk_KZ.ts \
qt/locale/bitcoin_ko_KR.ts \
qt/locale/bitcoin_ky.ts \
qt/locale/bitcoin_la.ts \
qt/locale/bitcoin_lt.ts \
qt/locale/bitcoin_lv_LV.ts \
qt/locale/bitcoin_mn.ts \
qt/locale/bitcoin_ms_MY.ts \
qt/locale/bitcoin_nb.ts \
qt/locale/bitcoin_nl.ts \
qt/locale/bitcoin_pam.ts \
qt/locale/bitcoin_pl.ts \
qt/locale/bitcoin_pt_BR.ts \
qt/locale/bitcoin_pt_PT.ts \
qt/locale/bitcoin_ro_RO.ts \
qt/locale/bitcoin_ru.ts \
qt/locale/bitcoin_sah.ts \
qt/locale/bitcoin_sk.ts \
qt/locale/bitcoin_sl_SI.ts \
qt/locale/bitcoin_sq.ts \
qt/locale/bitcoin_sr.ts \
qt/locale/bitcoin_sv.ts \
qt/locale/bitcoin_th_TH.ts \
qt/locale/bitcoin_tr.ts \
qt/locale/bitcoin_uk.ts \
qt/locale/bitcoin_ur_PK.ts \
qt/locale/bitcoin_uz@Cyrl.ts \
qt/locale/bitcoin_vi.ts \
qt/locale/bitcoin_vi_VN.ts \
qt/locale/bitcoin_zh_CN.ts \
qt/locale/bitcoin_zh_HK.ts \
qt/locale/bitcoin_zh_TW.ts
QT_FORMS_UI = \
qt/forms/addressbookpage.ui \
qt/forms/askpassphrasedialog.ui \
qt/forms/coincontroldialog.ui \
qt/forms/editaddressdialog.ui \
qt/forms/helpmessagedialog.ui \
qt/forms/intro.ui \
qt/forms/openuridialog.ui \
qt/forms/optionsdialog.ui \
qt/forms/overviewpage.ui \
qt/forms/receivecoinsdialog.ui \
qt/forms/receiverequestdialog.ui \
qt/forms/rpcconsole.ui \
qt/forms/sendcoinsdialog.ui \
qt/forms/sendcoinsentry.ui \
qt/forms/signverifymessagedialog.ui \
qt/forms/transactiondescdialog.ui
QT_MOC_CPP = \
qt/moc_addressbookpage.cpp \
qt/moc_addresstablemodel.cpp \
qt/moc_askpassphrasedialog.cpp \
qt/moc_bitcoinaddressvalidator.cpp \
qt/moc_bitcoinamountfield.cpp \
qt/moc_bitcoingui.cpp \
qt/moc_bitcoinunits.cpp \
qt/moc_clientmodel.cpp \
qt/moc_coincontroldialog.cpp \
qt/moc_coincontroltreewidget.cpp \
qt/moc_csvmodelwriter.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
qt/moc_macdockiconhandler.cpp \
qt/moc_macnotificationhandler.cpp \
qt/moc_notificator.cpp \
qt/moc_openuridialog.cpp \
qt/moc_optionsdialog.cpp \
qt/moc_optionsmodel.cpp \
qt/moc_overviewpage.cpp \
qt/moc_peertablemodel.cpp \
qt/moc_paymentserver.cpp \
qt/moc_qvalidatedlineedit.cpp \
qt/moc_qvaluecombobox.cpp \
qt/moc_receivecoinsdialog.cpp \
qt/moc_receiverequestdialog.cpp \
qt/moc_recentrequeststablemodel.cpp \
qt/moc_rpcconsole.cpp \
qt/moc_sendcoinsdialog.cpp \
qt/moc_sendcoinsentry.cpp \
qt/moc_signverifymessagedialog.cpp \
qt/moc_splashscreen.cpp \
qt/moc_trafficgraphwidget.cpp \
qt/moc_transactiondesc.cpp \
qt/moc_transactiondescdialog.cpp \
qt/moc_transactionfilterproxy.cpp \
qt/moc_transactiontablemodel.cpp \
qt/moc_transactionview.cpp \
qt/moc_utilitydialog.cpp \
qt/moc_walletframe.cpp \
qt/moc_walletmodel.cpp \
qt/moc_walletview.cpp
BITCOIN_MM = \
qt/macdockiconhandler.mm \
qt/macnotificationhandler.mm
QT_MOC = \
qt/bitcoin.moc \
qt/bitcoinamountfield.moc \
qt/intro.moc \
qt/overviewpage.moc \
qt/rpcconsole.moc
QT_QRC_CPP = qt/qrc_bitcoin.cpp
QT_QRC = qt/bitcoin.qrc
QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp
QT_QRC_LOCALE = qt/bitcoin_locale.qrc
PROTOBUF_CC = qt/paymentrequest.pb.cc
PROTOBUF_H = qt/paymentrequest.pb.h
PROTOBUF_PROTO = qt/paymentrequest.proto
BITCOIN_QT_H = \
qt/addressbookpage.h \
qt/addresstablemodel.h \
qt/askpassphrasedialog.h \
qt/bitcoinaddressvalidator.h \
qt/bitcoinamountfield.h \
qt/bitcoingui.h \
qt/bitcoinunits.h \
qt/clientmodel.h \
qt/coincontroldialog.h \
qt/coincontroltreewidget.h \
qt/csvmodelwriter.h \
qt/editaddressdialog.h \
qt/guiconstants.h \
qt/guiutil.h \
qt/intro.h \
qt/macdockiconhandler.h \
qt/macnotificationhandler.h \
qt/networkstyle.h \
qt/notificator.h \
qt/openuridialog.h \
qt/optionsdialog.h \
qt/optionsmodel.h \
qt/overviewpage.h \
qt/paymentrequestplus.h \
qt/paymentserver.h \
qt/peertablemodel.h \
qt/qvalidatedlineedit.h \
qt/qvaluecombobox.h \
qt/receivecoinsdialog.h \
qt/receiverequestdialog.h \
qt/recentrequeststablemodel.h \
qt/rpcconsole.h \
qt/scicon.h \
qt/sendcoinsdialog.h \
qt/sendcoinsentry.h \
qt/signverifymessagedialog.h \
qt/splashscreen.h \
qt/trafficgraphwidget.h \
qt/transactiondesc.h \
qt/transactiondescdialog.h \
qt/transactionfilterproxy.h \
qt/transactionrecord.h \
qt/transactiontablemodel.h \
qt/transactionview.h \
qt/utilitydialog.h \
qt/walletframe.h \
qt/walletmodel.h \
qt/walletmodeltransaction.h \
qt/walletview.h \
qt/winshutdownmonitor.h
RES_ICONS = \
qt/res/icons/add.png \
qt/res/icons/address-book.png \
qt/res/icons/about.png \
qt/res/icons/about_qt.png \
qt/res/icons/bitcoin.ico \
qt/res/icons/bitcoin.png \
qt/res/icons/clock1.png \
qt/res/icons/clock2.png \
qt/res/icons/clock3.png \
qt/res/icons/clock4.png \
qt/res/icons/clock5.png \
qt/res/icons/configure.png \
qt/res/icons/connect0.png \
qt/res/icons/connect1.png \
qt/res/icons/connect2.png \
qt/res/icons/connect3.png \
qt/res/icons/connect4.png \
qt/res/icons/debugwindow.png \
qt/res/icons/edit.png \
qt/res/icons/editcopy.png \
qt/res/icons/editpaste.png \
qt/res/icons/export.png \
qt/res/icons/eye.png \
qt/res/icons/eye_minus.png \
qt/res/icons/eye_plus.png \
qt/res/icons/filesave.png \
qt/res/icons/history.png \
qt/res/icons/info.png \
qt/res/icons/key.png \
qt/res/icons/lock_closed.png \
qt/res/icons/lock_open.png \
qt/res/icons/open.png \
qt/res/icons/overview.png \
qt/res/icons/quit.png \
qt/res/icons/receive.png \
qt/res/icons/remove.png \
qt/res/icons/send.png \
qt/res/icons/synced.png \
qt/res/icons/transaction0.png \
qt/res/icons/transaction2.png \
qt/res/icons/transaction_conflicted.png \
qt/res/icons/tx_inout.png \
qt/res/icons/tx_input.png \
qt/res/icons/tx_output.png \
qt/res/icons/tx_mined.png \
qt/res/icons/warning.png \
qt/res/icons/verify.png
BITCOIN_QT_CPP = \
qt/bitcoinaddressvalidator.cpp \
qt/bitcoinamountfield.cpp \
qt/bitcoingui.cpp \
qt/bitcoinunits.cpp \
qt/clientmodel.cpp \
qt/csvmodelwriter.cpp \
qt/guiutil.cpp \
qt/intro.cpp \
qt/networkstyle.cpp \
qt/notificator.cpp \
qt/optionsdialog.cpp \
qt/optionsmodel.cpp \
qt/peertablemodel.cpp \
qt/qvalidatedlineedit.cpp \
qt/qvaluecombobox.cpp \
qt/rpcconsole.cpp \
qt/scicon.cpp \
qt/splashscreen.cpp \
qt/trafficgraphwidget.cpp \
qt/utilitydialog.cpp
if TARGET_WINDOWS
BITCOIN_QT_CPP += qt/winshutdownmonitor.cpp
endif
if ENABLE_WALLET
BITCOIN_QT_CPP += \
qt/addressbookpage.cpp \
qt/addresstablemodel.cpp \
qt/askpassphrasedialog.cpp \
qt/coincontroldialog.cpp \
qt/coincontroltreewidget.cpp \
qt/editaddressdialog.cpp \
qt/openuridialog.cpp \
qt/overviewpage.cpp \
qt/paymentrequestplus.cpp \
qt/paymentserver.cpp \
qt/receivecoinsdialog.cpp \
qt/receiverequestdialog.cpp \
qt/recentrequeststablemodel.cpp \
qt/sendcoinsdialog.cpp \
qt/sendcoinsentry.cpp \
qt/signverifymessagedialog.cpp \
qt/transactiondesc.cpp \
qt/transactiondescdialog.cpp \
qt/transactionfilterproxy.cpp \
qt/transactionrecord.cpp \
qt/transactiontablemodel.cpp \
qt/transactionview.cpp \
qt/walletframe.cpp \
qt/walletmodel.cpp \
qt/walletmodeltransaction.cpp \
qt/walletview.cpp
endif
RES_IMAGES =
RES_MOVIES = $(wildcard qt/res/movies/spinner-*.png)
BITCOIN_RC = qt/res/komodo-qt-res.rc
BITCOIN_QT_INCLUDES = -I$(builddir)/qt -I$(srcdir)/qt -I$(srcdir)/qt/forms \
-I$(builddir)/qt/forms -DQT_NO_KEYWORDS
qt_libbitcoinqt_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
$(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES)
nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
$(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
# forms/foo.h -> forms/ui_foo.h
QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h))))
# Most files will depend on the forms and moc files as includes. Generate them
# before anything else.
$(QT_MOC): $(QT_FORMS_H)
$(qt_libbitcoinqt_a_OBJECTS) $(qt_komodo_qt_OBJECTS) : | $(QT_MOC)
#Generating these with a half-written protobuf header leads to wacky results.
#This makes sure it's done.
$(QT_MOC): $(PROTOBUF_H)
$(QT_MOC_CPP): $(PROTOBUF_H)
# bitcoin-qt binary #
qt_komodo_qt_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_komodo_qt_SOURCES = qt/bitcoin.cpp
if TARGET_DARWIN
qt_komodo_qt_SOURCES += $(BITCOIN_MM)
endif
if TARGET_WINDOWS
qt_komodo_qt_SOURCES += $(BITCOIN_RC)
endif
qt_komodo_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
if ENABLE_WALLET
qt_komodo_qt_LDADD += $(LIBBITCOIN_WALLET)
endif
qt_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS)
qt_komodo_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_komodo_qt_LIBTOOLFLAGS = --tag CXX
#locale/foo.ts -> locale/foo.qm
QT_QM=$(QT_TS:.ts=.qm)
SECONDARY: $(QT_QM)
qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES)
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) ../share/qt/extract_strings_qt.py $^
translate: qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts qt/locale/bitcoin_en.ts
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
@test -f $(RCC)
@test -f $(@D)/$(<F) || cp -f $< $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin_locale $(@D)/$(<F) | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
@test -f $(RCC)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno
CLEANFILES += $(CLEAN_QT)
komodo_qt_clean: FORCE
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_komodo_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT)
komodo_qt : qt/bitcoin-qt$(EXEEXT)
ui_%.h: %.ui
@test -f $(UIC)
@$(MKDIR_P) $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
%.moc: %.cpp
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
moc_%.cpp: %.h
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
%.qm: %.ts
@test -f $(LRELEASE)
@$(MKDIR_P) $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@

View File

@@ -1,48 +0,0 @@
bin_PROGRAMS += qt/test/test_bitcoin-qt
TESTS += qt/test/test_bitcoin-qt
TEST_QT_MOC_CPP = qt/test/moc_uritests.cpp
if ENABLE_WALLET
TEST_QT_MOC_CPP += qt/test/moc_paymentservertests.cpp
endif
TEST_QT_H = \
qt/test/uritests.h \
qt/test/paymentrequestdata.h \
qt/test/paymentservertests.h
qt_test_test_komodo_qt_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)
qt_test_test_komodo_qt_SOURCES = \
qt/test/test_main.cpp \
qt/test/uritests.cpp \
$(TEST_QT_H)
if ENABLE_WALLET
qt_test_test_komodo_qt_SOURCES += \
qt/test/paymentservertests.cpp
endif
nodist_qt_test_test_komodo_qt_SOURCES = $(TEST_QT_MOC_CPP)
qt_test_test_komodo_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
if ENABLE_WALLET
qt_test_test_komodo_qt_LDADD += $(LIBBITCOIN_WALLET)
endif
qt_test_test_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) \
$(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS)
qt_test_test_komodo_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno
CLEANFILES += $(CLEAN_BITCOIN_QT_TEST)
test_komodo_qt : qt/test/test_bitcoin-qt$(EXEEXT)
test_komodo_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE
$(MAKE) check-TESTS TESTS=$^
test_komodo_qt_clean: FORCE
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_komodo_qt_OBJECTS)

View File

@@ -1,323 +0,0 @@
# RG1QE6hTqu4dadL2XSNWS9VCHjd8xNVo58 KMD 16462.32091533, REVS 289.86606506
fiat/revs sendtoaddress RG1QE6hTqu4dadL2XSNWS9VCHjd8xNVo58 289.86606506
sleep 1
# RFVvyUAnQe5yon6wq7B73Z1BzfFeZKyAZA KMD 74417.52897713, REVS 500.77700000
fiat/revs sendtoaddress RFVvyUAnQe5yon6wq7B73Z1BzfFeZKyAZA 500.77700000
sleep 1
# RWfaj9ZNmHq5A4jV411xpt1FJoyvKfVJ6c KMD 616895.10028203, REVS 3685.61452692
fiat/revs sendtoaddress RWfaj9ZNmHq5A4jV411xpt1FJoyvKfVJ6c 3685.61452692
sleep 1
# R9dTcQWVDuaRdFqDzq4xPaFDjGbaLK6t8n KMD 1053.37494565, REVS 4.29070721
fiat/revs sendtoaddress R9dTcQWVDuaRdFqDzq4xPaFDjGbaLK6t8n 4.29070721
sleep 1
# REvJWEuwqmwTnanZ8bWt85wnjfrsAjnvgE KMD 3945.67461320, REVS 30.24757576
fiat/revs sendtoaddress REvJWEuwqmwTnanZ8bWt85wnjfrsAjnvgE 30.24757576
sleep 1
# RBpEnyzuQNj1hNdAG1pKLALpAWEUS67PBj KMD 2729058.03025689, REVS 54178.00103054
fiat/revs sendtoaddress RBpEnyzuQNj1hNdAG1pKLALpAWEUS67PBj 54178.00103054
sleep 1
# RHSZ1CWDNhkNbbQRDrqLHRAdCshueMrt2r KMD 8661.80183095, REVS 171.90929822
fiat/revs sendtoaddress RHSZ1CWDNhkNbbQRDrqLHRAdCshueMrt2r 171.90929822
sleep 1
# RTqh7gEJMJDpnBp62FZZAfXctj8X7sRRia KMD 18367.01200788, REVS 350.00000000
fiat/revs sendtoaddress RTqh7gEJMJDpnBp62FZZAfXctj8X7sRRia 350.00000000
sleep 1
# RNhyF9U3o4hTgWqnwQjHwrD1o4GqWiP1T6 KMD 7816.63087181, REVS 78.63808960
fiat/revs sendtoaddress RNhyF9U3o4hTgWqnwQjHwrD1o4GqWiP1T6 78.63808960
sleep 1
# RE3yR2mCeG15ARgvENMbb573VqoQJcM3po KMD 17738.87416605, REVS 18.61556549
fiat/revs sendtoaddress RE3yR2mCeG15ARgvENMbb573VqoQJcM3po 18.61556549
sleep 1
# RT7ENMvL46nwrFfNj1TLa5FEqJzTztHefH KMD 26696.69308472, REVS 529.99000000
fiat/revs sendtoaddress RT7ENMvL46nwrFfNj1TLa5FEqJzTztHefH 529.99000000
sleep 1
# RDTcqgh4MMHLtu9FBCcULqZmP761DFmk9b KMD 82906.87674571, REVS 1438.93600000
fiat/revs sendtoaddress RDTcqgh4MMHLtu9FBCcULqZmP761DFmk9b 1438.93600000
sleep 1
# RHSUmLRyJwpbdsRtytkGs9GmpZghQWHje3 KMD 2197.34858012, REVS 43.61040113
fiat/revs sendtoaddress RHSUmLRyJwpbdsRtytkGs9GmpZghQWHje3 43.61040113
sleep 1
# RJEQbNrMQUHELrYPVLPepR2Y3ruAag3hEP KMD 64966.39751162, REVS 1035.00000000
fiat/revs sendtoaddress RJEQbNrMQUHELrYPVLPepR2Y3ruAag3hEP 1035.00000000
sleep 1
# RJ1DUUySYib5LcwJKFJ78PD3so2GQ89jKJ KMD 377892.70160675, REVS 7501.00000000
fiat/revs sendtoaddress RJ1DUUySYib5LcwJKFJ78PD3so2GQ89jKJ 7501.00000000
sleep 1
# RC2nLGhFUc5Q9QFG1b38gAi9WgSgzQ9hJR KMD 41.38832712, REVS 0.82090537
fiat/revs sendtoaddress RC2nLGhFUc5Q9QFG1b38gAi9WgSgzQ9hJR 0.82090537
sleep 1
# RCJHEogA7SW6PxuctPLtaVnXwiu49PyZY8 KMD 1350076.86672091, REVS 100.00000000
fiat/revs sendtoaddress RCJHEogA7SW6PxuctPLtaVnXwiu49PyZY8 100.00000000
sleep 1
# RJbudEMb7wEEN8QZ18fEkptxjE4QnMECUu KMD 50567.04202258, REVS 1003.32000000
fiat/revs sendtoaddress RJbudEMb7wEEN8QZ18fEkptxjE4QnMECUu 1003.32000000
sleep 1
# RSdVypRznJsboL6MaP1shkaLhrVFcNx2KL KMD 589187.66272894, REVS 11685.49743445
fiat/revs sendtoaddress RSdVypRznJsboL6MaP1shkaLhrVFcNx2KL 11685.49743445
sleep 1
# RWXwZyGf4q7cBakkY4tgupptBbCSvcBsBH KMD 1012.75625347, REVS 20.10000000
fiat/revs sendtoaddress RWXwZyGf4q7cBakkY4tgupptBbCSvcBsBH 20.10000000
sleep 1
# RA7UJPwPxqgPHn4YscYWRH5EPQVaFaaaPa KMD 45132.81116316, REVS 342.26137428
fiat/revs sendtoaddress RA7UJPwPxqgPHn4YscYWRH5EPQVaFaaaPa 342.26137428
sleep 1
# RRFFxsc6kkfahR7v4paTaUZrPFisuz9Nkq KMD 155.36852443, REVS 3.08314987
fiat/revs sendtoaddress RRFFxsc6kkfahR7v4paTaUZrPFisuz9Nkq 3.08314987
sleep 1
# RWFSbi9ECuZWVE37jpkbiKGw7DaFYdNtts KMD 23963.90703474, REVS 475.60756080
fiat/revs sendtoaddress RWFSbi9ECuZWVE37jpkbiKGw7DaFYdNtts 475.60756080
sleep 1
# RUVkn1F9g7TxoPbYtegiQoFnPTusP2gzDr KMD 43088.75849296, REVS 470.88002226
fiat/revs sendtoaddress RUVkn1F9g7TxoPbYtegiQoFnPTusP2gzDr 470.88002226
sleep 1
# R9vBYQw9tSBhu2c1g4SQhZdhuZeeQrEBoN KMD 111664.10821907, REVS 2023.42268720
fiat/revs sendtoaddress R9vBYQw9tSBhu2c1g4SQhZdhuZeeQrEBoN 2023.42268720
sleep 1
# RG8g7LjK7hdyKp3aoKBRdwzpLy31XMXMLk KMD 972.80557592, REVS 19.29916914
fiat/revs sendtoaddress RG8g7LjK7hdyKp3aoKBRdwzpLy31XMXMLk 19.29916914
sleep 1
# RJ7RfZfip4qL9uEJs7Wr9FYtGusQiryMqE KMD 43251.49599262, REVS 857.93461385
fiat/revs sendtoaddress RJ7RfZfip4qL9uEJs7Wr9FYtGusQiryMqE 857.93461385
sleep 1
# RNW6Kkcdktbeemd2n8NVPCfgnRirzWoiZY KMD 53585.08128315, REVS 731.01000000
fiat/revs sendtoaddress RNW6Kkcdktbeemd2n8NVPCfgnRirzWoiZY 731.01000000
sleep 1
# RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 KMD 57862.44847739, REVS 464.78017965
fiat/revs sendtoaddress RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 464.78017965
sleep 1
# RTkvmxME9rVZBY6ABNqkkbqKvn8WUqgQqr KMD 215743.93040290, REVS 4280.65926868
fiat/revs sendtoaddress RTkvmxME9rVZBY6ABNqkkbqKvn8WUqgQqr 4280.65926868
sleep 1
# RS9erX84xJG17efdZ66qHxhsUMG15fnCsH KMD 977546.42205511, REVS 19403.85638743
fiat/revs sendtoaddress RS9erX84xJG17efdZ66qHxhsUMG15fnCsH 19403.85638743
sleep 1
# RE1wsrDNwW2NnNWM5eE162yp6haLtm5uh7 KMD 14588.33036215, REVS 289.61149547
fiat/revs sendtoaddress RE1wsrDNwW2NnNWM5eE162yp6haLtm5uh7 289.61149547
sleep 1
# RK5BnRzCP52qsTE4xR3Qysn6m6KeTgpZA6 KMD 3170.70655908, REVS 37.96790925
fiat/revs sendtoaddress RK5BnRzCP52qsTE4xR3Qysn6m6KeTgpZA6 37.96790925
sleep 1
# RN6TfTEYHdvFAeosYrvDaMBb2yBco47Q5a KMD 7073.16782615, REVS 44.30216197
fiat/revs sendtoaddress RN6TfTEYHdvFAeosYrvDaMBb2yBco47Q5a 44.30216197
sleep 1
# RV4Hf22arBv4P4s5eFsUAnXC6N11T8x9tv KMD 117108.97863641, REVS 1631.49836519
fiat/revs sendtoaddress RV4Hf22arBv4P4s5eFsUAnXC6N11T8x9tv 1631.49836519
sleep 1
# RYBH6Ha8RJa3CcE91yxJP6z2E6mDFm3bBt KMD 163386.58575808, REVS 50.00000000
fiat/revs sendtoaddress RYBH6Ha8RJa3CcE91yxJP6z2E6mDFm3bBt 50.00000000
sleep 1
# RUY7YW1WmTD3hCvkXmUKLeRnNg5UsJoLbU KMD 6742.29255596, REVS 105.00000000
fiat/revs sendtoaddress RUY7YW1WmTD3hCvkXmUKLeRnNg5UsJoLbU 105.00000000
sleep 1
# RNVwzuZynZ7d4DE5CfT8CWkxsp9TtCY3BF KMD 1598.36899361, REVS 11.75449303
fiat/revs sendtoaddress RNVwzuZynZ7d4DE5CfT8CWkxsp9TtCY3BF 11.75449303
sleep 1
# RPriQZfzzgin7y2Ns6vxdrMAa4XgZqdY6y KMD 21671.70738465, REVS 170.69524117
fiat/revs sendtoaddress RPriQZfzzgin7y2Ns6vxdrMAa4XgZqdY6y 170.69524117
sleep 1
# RSCdeeWvzpBhg2tKnCWZWKw9iAMyYWiREG KMD 12075.12037906, REVS 239.62000000
fiat/revs sendtoaddress RSCdeeWvzpBhg2tKnCWZWKw9iAMyYWiREG 239.62000000
sleep 1
# RUAvb7FFPvxjNTVhABeS2EbbdUi2LfGNMj KMD 25710.06172178, REVS 510.00000000
fiat/revs sendtoaddress RUAvb7FFPvxjNTVhABeS2EbbdUi2LfGNMj 510.00000000
sleep 1
# RQuMEMn1TG7CCpbmYCVcDfPqesEvEkisjC KMD 34758.47429765, REVS 689.94006658
fiat/revs sendtoaddress RQuMEMn1TG7CCpbmYCVcDfPqesEvEkisjC 689.94006658
sleep 1
# RBNB5mKstG86jYRjrKFgJuFoUFvZKJb9Wq KMD 816561.67159376, REVS 16199.49755302
fiat/revs sendtoaddress RBNB5mKstG86jYRjrKFgJuFoUFvZKJb9Wq 16199.49755302
sleep 1
# RHoouCBBapEHE6uyX7CxHGFcRwUQFGMot5 KMD 88331.27512150, REVS 1398.88449696
fiat/revs sendtoaddress RHoouCBBapEHE6uyX7CxHGFcRwUQFGMot5 1398.88449696
sleep 1
# RLHEGDwXuXQwhYkrhwSRGSJMFuvv7EAT7i KMD 22366.16022678, REVS 443.95821128
fiat/revs sendtoaddress RLHEGDwXuXQwhYkrhwSRGSJMFuvv7EAT7i 443.95821128
sleep 1
# RAEtFUqe3jwVxLywCga2eKQxT2DiewsUuN KMD 25.54297774, REVS 0.50680815
fiat/revs sendtoaddress RAEtFUqe3jwVxLywCga2eKQxT2DiewsUuN 0.50680815
sleep 1
# RUcDMtu7fA3ATbHHsDTsZ8KThgd1ivawym KMD 21446.21749875, REVS 241.00000000
fiat/revs sendtoaddress RUcDMtu7fA3ATbHHsDTsZ8KThgd1ivawym 241.00000000
sleep 1
# RG2cAef3JbCXiQkzPgrqS52HAQrBzJiAy4 KMD 102137.83664315, REVS 2027.11216000
fiat/revs sendtoaddress RG2cAef3JbCXiQkzPgrqS52HAQrBzJiAy4 2027.11216000
sleep 1
# REzcqBkARMCCxkA5rVdp61f7rovmFtq5kf KMD 130928.69826981, REVS 2597.54928401
fiat/revs sendtoaddress REzcqBkARMCCxkA5rVdp61f7rovmFtq5kf 2597.54928401
sleep 1
# RXKZmFmmpfAV2DAdUUXhA88RqCoyPRXcnA KMD 28641.72782430, REVS 337.66808110
fiat/revs sendtoaddress RXKZmFmmpfAV2DAdUUXhA88RqCoyPRXcnA 337.66808110
sleep 1
# RCxnQhmYdpK9vTS7PLRtXBtDk2HaRNo1qk KMD 2171.04073365, REVS 43.05910000
fiat/revs sendtoaddress RCxnQhmYdpK9vTS7PLRtXBtDk2HaRNo1qk 43.05910000
sleep 1
# RPtwW4UejbAxs5PU6a1zMPcPqW7SVghMDS KMD 31741.86724191, REVS 514.45537037
fiat/revs sendtoaddress RPtwW4UejbAxs5PU6a1zMPcPqW7SVghMDS 514.45537037
sleep 1
# RYMzZx5nxKrMtTm3TNeheVn4RooTGvhsNd KMD 12756.16332851, REVS 253.10000000
fiat/revs sendtoaddress RYMzZx5nxKrMtTm3TNeheVn4RooTGvhsNd 253.10000000
sleep 1
# RPyKbtBPVb3FYv5iFULNUB6bq9DdvekZuz KMD 3422.63549310, REVS 51.90683618
fiat/revs sendtoaddress RPyKbtBPVb3FYv5iFULNUB6bq9DdvekZuz 51.90683618
sleep 1
# RVcGdBT2N6Fbqbptj3R4zhZYNB4WJQWEns KMD 77986.19708921, REVS 1548.20316000
fiat/revs sendtoaddress RVcGdBT2N6Fbqbptj3R4zhZYNB4WJQWEns 1548.20316000
sleep 1
# RH4SXj2zZqfG4TfejyHcVpaoPoDv1Uonnf KMD 11621.99031627, REVS 192.14192021
fiat/revs sendtoaddress RH4SXj2zZqfG4TfejyHcVpaoPoDv1Uonnf 192.14192021
sleep 1
# REtq1LtbLVo6bz68f9TGFduNmUTKqG7vnH KMD 25088.84725730, REVS 305.62849999
fiat/revs sendtoaddress REtq1LtbLVo6bz68f9TGFduNmUTKqG7vnH 305.62849999
sleep 1
# RS3rMPEGouBWbHKStyQg8TxVmtwFQ6ebh3 KMD 3546.25060143, REVS 39.99000000
fiat/revs sendtoaddress RS3rMPEGouBWbHKStyQg8TxVmtwFQ6ebh3 39.99000000
sleep 1
# RGzvr4JSHDLDQAGBwdyoUiUuaYn5sUwKNd KMD 69108.92543895, REVS 314.51750000
fiat/revs sendtoaddress RGzvr4JSHDLDQAGBwdyoUiUuaYn5sUwKNd 314.51750000
sleep 1
# RMD1wVnzMmKn8uMTHaP9pYfCWkxf3QVWWE KMD 2931.50081538, REVS 40.37145505
fiat/revs sendtoaddress RMD1wVnzMmKn8uMTHaP9pYfCWkxf3QVWWE 40.37145505
sleep 1
# RQCEEEprmqghZHN73iG1C2XvYTTQ6FB2wE KMD 5506.18026103, REVS 90.00054364
fiat/revs sendtoaddress RQCEEEprmqghZHN73iG1C2XvYTTQ6FB2wE 90.00054364
sleep 1
# RCmLc2JBpPw9T9g1skg7J5Xr5kz1fyd7mx KMD 529.41438680, REVS 10.50000000
fiat/revs sendtoaddress RCmLc2JBpPw9T9g1skg7J5Xr5kz1fyd7mx 10.50000000
sleep 1
# R9ULUWEvzmHPZ4rYL5FtwkMyTWvGDZX43J KMD 15051.18125683, REVS 298.60000000
fiat/revs sendtoaddress R9ULUWEvzmHPZ4rYL5FtwkMyTWvGDZX43J 298.60000000
sleep 1
# RW2xS8dpxjudqBX1hqxShP7FWn8EHYH4Rb KMD 166779.58408020, REVS 3310.49966000
fiat/revs sendtoaddress RW2xS8dpxjudqBX1hqxShP7FWn8EHYH4Rb 3310.49966000
sleep 1
# RALRwXaEN3yS5damdDwAkmEMKvdAkVs361 KMD 25746.96382302, REVS 510.64558668
fiat/revs sendtoaddress RALRwXaEN3yS5damdDwAkmEMKvdAkVs361 510.64558668
sleep 1
# RPVNUvVq4BgKrrB3E1uULja2hjPW6Hv6r9 KMD 16872.68860925, REVS 334.64000000
fiat/revs sendtoaddress RPVNUvVq4BgKrrB3E1uULja2hjPW6Hv6r9 334.64000000
sleep 1
# RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A KMD 19616.45270312, REVS 389.05771834
fiat/revs sendtoaddress RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A 389.05771834
sleep 1
# RXFr5VB9gQYC5QYv7yVvkxtjDY3zwYuvDx KMD 327.74801651, REVS 6.50475878
fiat/revs sendtoaddress RXFr5VB9gQYC5QYv7yVvkxtjDY3zwYuvDx 6.50475878
sleep 1
# RHUpvFhHv1umX1JsV5S8smAKAsN5CxA4HD KMD 2183.96436714, REVS 2.36599993
fiat/revs sendtoaddress RHUpvFhHv1umX1JsV5S8smAKAsN5CxA4HD 2.36599993
sleep 1
# RAhvJHePdAb1PF9jjZhP2F7r72ebL9pA1f KMD 3457.02047726, REVS 68.56389987
fiat/revs sendtoaddress RAhvJHePdAb1PF9jjZhP2F7r72ebL9pA1f 68.56389987
sleep 1
# RDCjGgoZ1tvCWop6m5wPYkr83wdFrofF6M KMD 76598.36955552, REVS 1519.19347187
fiat/revs sendtoaddress RDCjGgoZ1tvCWop6m5wPYkr83wdFrofF6M 1519.19347187
sleep 1
# RLAEm3H2LMSNzJmveLkcf2nS18AnqWR7pJ KMD 82831.36892196, REVS 1643.94000000
fiat/revs sendtoaddress RLAEm3H2LMSNzJmveLkcf2nS18AnqWR7pJ 1643.94000000
sleep 1
# RSUfnwTLE36E3Nx8PptxVoAfSRtMeGQsFL KMD 67327.03192299, REVS 1282.48928243
fiat/revs sendtoaddress RSUfnwTLE36E3Nx8PptxVoAfSRtMeGQsFL 1282.48928243
sleep 1
# RPkkQmMmyLQe8Th7ZP5GoF6kSUs1DTNfAf KMD 1538.42929417, REVS 30.51202988
fiat/revs sendtoaddress RPkkQmMmyLQe8Th7ZP5GoF6kSUs1DTNfAf 30.51202988
sleep 1
# RSkhXmiPCxqdp4bM4ux7VxAwMoCv2Uar6d KMD 73542.70261753, REVS 1459.56877203
fiat/revs sendtoaddress RSkhXmiPCxqdp4bM4ux7VxAwMoCv2Uar6d 1459.56877203
sleep 1
# RUJvR3TXCAcizk7dXdFc6GKRFS6jZfjtyY KMD 10419.10088055, REVS 206.75776925
fiat/revs sendtoaddress RUJvR3TXCAcizk7dXdFc6GKRFS6jZfjtyY 206.75776925
sleep 1
# RLZmhbeB2tXTas9grzAeqaL2RFAXVmDVpU KMD 43480.56469698, REVS 50.30001915
fiat/revs sendtoaddress RLZmhbeB2tXTas9grzAeqaL2RFAXVmDVpU 50.30001915
sleep 1
# RLCDEXwfJ75P1iKgWGfR9geJmjZ84A4XXJ KMD 105141.23597043, REVS 1006.07261743
fiat/revs sendtoaddress RLCDEXwfJ75P1iKgWGfR9geJmjZ84A4XXJ 1006.07261743
sleep 1
# RW1FmQGcpPv87WZVSCaMgjj74shMb3Y6Zi KMD 33700.59190315, REVS 380.47576230
fiat/revs sendtoaddress RW1FmQGcpPv87WZVSCaMgjj74shMb3Y6Zi 380.47576230
sleep 1
# RQUMrGYr4SsHgbN56WP7tuEpWUcd62KidP KMD 61230.10078656, REVS 600.00100000
fiat/revs sendtoaddress RQUMrGYr4SsHgbN56WP7tuEpWUcd62KidP 600.00100000
sleep 1
# RP8CkGhyfhdoVpGqGbVmEmRL7gGdqKBdkt KMD 153725.02014837, REVS 3049.70000000
fiat/revs sendtoaddress RP8CkGhyfhdoVpGqGbVmEmRL7gGdqKBdkt 3049.70000000
sleep 1
# RRupn47XfLSMhXEuShtCCPBCv8P6LYXrLN KMD 790607.74140148, REVS 15691.16324116
fiat/revs sendtoaddress RRupn47XfLSMhXEuShtCCPBCv8P6LYXrLN 15691.16324116
sleep 1
# RRX73tynW4sxCmqyYBQrS9nMcDUcXuX1yG KMD 26022.54788263, REVS 5.39446042
fiat/revs sendtoaddress RRX73tynW4sxCmqyYBQrS9nMcDUcXuX1yG 5.39446042
sleep 1
# R9u7V63TLwJPH1shvAGHRG61aci61yy7RN KMD 20764.40163902, REVS 291.83028199
fiat/revs sendtoaddress R9u7V63TLwJPH1shvAGHRG61aci61yy7RN 291.83028199
sleep 1
# RKAxvqvC3apzrb8udG9trBxiNhhNXaLkz4 KMD 6483.53169406, REVS 5.41696484
fiat/revs sendtoaddress RKAxvqvC3apzrb8udG9trBxiNhhNXaLkz4 5.41696484
sleep 1
# RV5cgPjqt37QBHr94VL5HnXWqcwdqoqoC3 KMD 81008.20903630, REVS 1607.10337790
fiat/revs sendtoaddress RV5cgPjqt37QBHr94VL5HnXWqcwdqoqoC3 1607.10337790
sleep 1
# RMnuGgpEzWcxYi861E7BjGMURCFX2Szj2v KMD 14010.00244099, REVS 277.86367220
fiat/revs sendtoaddress RMnuGgpEzWcxYi861E7BjGMURCFX2Szj2v 277.86367220
sleep 1
# RF4iG6huXb9u6Pt8281WvnBjhdEtiVUnp4 KMD 674.21697725, REVS 13.37190382
fiat/revs sendtoaddress RF4iG6huXb9u6Pt8281WvnBjhdEtiVUnp4 13.37190382
sleep 1
# RW3gz9fEadohRLZerK9r8zXkugk5swWHrf KMD 21219.62483892, REVS 421.20000000
fiat/revs sendtoaddress RW3gz9fEadohRLZerK9r8zXkugk5swWHrf 421.20000000
sleep 1
# RJ89radoRzRr5oDsf71QZ7BXUTiHcyVSUu KMD 52588.80320859, REVS 1043.00609779
fiat/revs sendtoaddress RJ89radoRzRr5oDsf71QZ7BXUTiHcyVSUu 1043.00609779
sleep 1
# RKenAzKZyD58qPu2zVdjwPjDn71T34sWE4 KMD 668547.16129881, REVS 13259.45302721
fiat/revs sendtoaddress RKenAzKZyD58qPu2zVdjwPjDn71T34sWE4 13259.45302721
sleep 1
# R9ibGGfsFHD8MxLRL4q2a6ezxAaHHPJvLc KMD 241619.45649268, REVS 4792.09548598
fiat/revs sendtoaddress R9ibGGfsFHD8MxLRL4q2a6ezxAaHHPJvLc 4792.09548598
sleep 1
# RGwuMmW1ZBMrHJwJucEy5JEV3BZWv7eQnm KMD 9071868.91817425, REVS 180010.00000000
fiat/revs sendtoaddress RGwuMmW1ZBMrHJwJucEy5JEV3BZWv7eQnm 180010.00000000
sleep 1
# RT6Ckpw8yM2Q7yaCxejiVTrxELGQPtnGPm KMD 25778.27244764, REVS 225.87592741
fiat/revs sendtoaddress RT6Ckpw8yM2Q7yaCxejiVTrxELGQPtnGPm 225.87592741
sleep 1
# RGf4wwbHVYYZrVPVZg6XdS3mWvbzHSebzu KMD 6387.59296405, REVS 126.73871740
fiat/revs sendtoaddress RGf4wwbHVYYZrVPVZg6XdS3mWvbzHSebzu 126.73871740
sleep 1
# RJAbNiCSRaMxUky9h8as6orZY3cu2rSW8z KMD 492782.94486222, REVS 9773.48000000
fiat/revs sendtoaddress RJAbNiCSRaMxUky9h8as6orZY3cu2rSW8z 9773.48000000
sleep 1
# RSW5SvtjWiGYN3iwb2mteYP7Hn223Zk1tP KMD 343847.33707184, REVS 6001.47957339
fiat/revs sendtoaddress RSW5SvtjWiGYN3iwb2mteYP7Hn223Zk1tP 6001.47957339
sleep 1
# RFPKxBL8iLQGmkoUukXdFU7VkXyGJLSsGw KMD 36335.50253541, REVS 413.60001059
fiat/revs sendtoaddress RFPKxBL8iLQGmkoUukXdFU7VkXyGJLSsGw 413.60001059
sleep 1
# RVFspAKoUpDMAiiEUiQQEpqdqXDMB48Jqp KMD 47464.51702590, REVS 634.55156126
fiat/revs sendtoaddress RVFspAKoUpDMAiiEUiQQEpqdqXDMB48Jqp 634.55156126
sleep 1
# RCPys8hvEfFSDkMZL7GtYA8a5GSwih67Q1 KMD 36359.70475507, REVS 100.00000000
fiat/revs sendtoaddress RCPys8hvEfFSDkMZL7GtYA8a5GSwih67Q1 100.00000000
sleep 1
# R9ce1xHEaWnRRP5jrWozEfPf9ZJgX7jnxd KMD 915808.36366861, REVS 18163.44258555
fiat/revs sendtoaddress R9ce1xHEaWnRRP5jrWozEfPf9ZJgX7jnxd 18163.44258555
sleep 1
# RS1rdGqAhXvwFFTVyUCx695y84E3N3emcU KMD 18822.21903353, REVS 360.77089072
fiat/revs sendtoaddress RS1rdGqAhXvwFFTVyUCx695y84E3N3emcU 360.77089072
sleep 1
# RLgKsmgdzwNCt8CgqZ5J6cZhTat9HeZgxG KMD 62376.97840244, REVS 1045.22605497
fiat/revs sendtoaddress RLgKsmgdzwNCt8CgqZ5J6cZhTat9HeZgxG 1045.22605497
sleep 1
# RUBESyzjgZUts3fD6W7abpgMj4qRFSSszC KMD 541390.42407502, REVS 10592.65522652
fiat/revs sendtoaddress RUBESyzjgZUts3fD6W7abpgMj4qRFSSszC 10592.65522652
sleep 1
# RSNu7Kd9p33aDrgT2AM8buy7fUSQZ2N3Gs KMD 130769.80646849, REVS 2593.58831601
fiat/revs sendtoaddress RSNu7Kd9p33aDrgT2AM8buy7fUSQZ2N3Gs 2593.58831601
sleep 1
# RCrCe4dsMzXzzp7GLahubjg73VGK2rnczC KMD 6843.04832293, REVS 25.10000000
fiat/revs sendtoaddress RCrCe4dsMzXzzp7GLahubjg73VGK2rnczC 25.10000000
sleep 1
# RVTCRzofA2cV6FwGcvn1uGjZJmP5s9G1o9 KMD 95283.12042643, REVS 497.50723875
fiat/revs sendtoaddress RVTCRzofA2cV6FwGcvn1uGjZJmP5s9G1o9 497.50723875
sleep 1
# total KMD 45769105.32172734 REVS 426291.27268935

View File

@@ -1,78 +0,0 @@
sleep 9999999
# RA4nyddYYzEzoUqnpLCvTm8d4nKvqQavs4 KMD 205767.24475092, REVS 4084.38717211
sleep 1
fiat/revs sendtoaddress RA4nyddYYzEzoUqnpLCvTm8d4nKvqQavs4 4084.38717211
# RFppcFo1bKQzD4zxrxCbicpAvnrqo99hPx KMD 138163.01002402, REVS 2740.59474723
sleep 1
fiat/revs sendtoaddress RFppcFo1bKQzD4zxrxCbicpAvnrqo99hPx 2740.59474723
# RHfHV1LTG5rz3T2HApavCto9973puD93qt KMD 243998.92767004, REVS 4839.53600000
sleep 1
fiat/revs sendtoaddress RHfHV1LTG5rz3T2HApavCto9973puD93qt 4839.53600000
# RPNRr6efhaPYKHzRyemxYowUbNQ6crBtcy KMD 36785.74330117, REVS 730.28056435
sleep 1
fiat/revs sendtoaddress RPNRr6efhaPYKHzRyemxYowUbNQ6crBtcy 730.28056435
# RTnhkYHVoApyX8Fc2ZEHB2rtW7cLHqZEMB KMD 567760.05597770, REVS 11191.99000000
sleep 1
fiat/revs sendtoaddress RTnhkYHVoApyX8Fc2ZEHB2rtW7cLHqZEMB 11191.99000000
# RER2vwRLHFT4HNQLzyqT1PhbeMCitDaY1u KMD 7771.42052436, REVS 0.62700000
sleep 1
fiat/revs sendtoaddress RER2vwRLHFT4HNQLzyqT1PhbeMCitDaY1u 0.62700000
# RM3onNDjZbjypoN8wqo7Rzz3QEv6EiCfwK KMD 18186.86986853, REVS 143.39272495
sleep 1
fiat/revs sendtoaddress RM3onNDjZbjypoN8wqo7Rzz3QEv6EiCfwK 143.39272495
# RVXTirtRaZkYk1wjAE3mwhdUjTXWKrTnFu KMD 2375.16051963, REVS 47.12337252
sleep 1
fiat/revs sendtoaddress RVXTirtRaZkYk1wjAE3mwhdUjTXWKrTnFu 47.12337252
# RJJBtg8XfxMmb6rg6UMWME6zhxM1n8Umta KMD 70173.29001640, REVS 1392.33555151
sleep 1
fiat/revs sendtoaddress RJJBtg8XfxMmb6rg6UMWME6zhxM1n8Umta 1392.33555151
# REbMisMicS8W7LUqBPJwkVfYHxNfSeW7d8 KMD 220390.81840860, REVS 1384.18511377
sleep 1
fiat/revs sendtoaddress REbMisMicS8W7LUqBPJwkVfYHxNfSeW7d8 1384.18511377
# RRDmaG64XZjdERzojAQ3DwHewBZbXfqpcJ KMD 479029.87110523, REVS 9502.00000000
sleep 1
fiat/revs sendtoaddress RRDmaG64XZjdERzojAQ3DwHewBZbXfqpcJ 9502.00000000
# RTBeZc5Biq3BY1hB1dXi6XTaH8j6FsyGuz KMD 230594.13977661, REVS 8.48502608
sleep 1
fiat/revs sendtoaddress RTBeZc5Biq3BY1hB1dXi6XTaH8j6FsyGuz 8.48502608
# RGbLr8CsszoGATo6uy7fZJ5GJPuXYbA6sv KMD 25505.74161232, REVS 506.00000000
sleep 1
fiat/revs sendtoaddress RGbLr8CsszoGATo6uy7fZJ5GJPuXYbA6sv 506.00000000
# RP7HdvokCK1yJmpVCY49q4LXsVe3qhnEU5 KMD 4516.65527532, REVS 31.96541397
sleep 1
fiat/revs sendtoaddress RP7HdvokCK1yJmpVCY49q4LXsVe3qhnEU5 31.96541397
# RMvpp3QwvYch8hFCjZNXvXkzoFWEw9R5QH KMD 35011.78668474, REVS 310.59835083
sleep 1
fiat/revs sendtoaddress RMvpp3QwvYch8hFCjZNXvXkzoFWEw9R5QH 310.59835083
# R9whNiPsV9NHvyPqg6ranxDFvsM8HsDtks KMD 201.26853079, REVS 3.99180609
sleep 1
fiat/revs sendtoaddress R9whNiPsV9NHvyPqg6ranxDFvsM8HsDtks 3.99180609
# RFfJkcC1fnFZB2G2MUPYdNEeRrZk6njPig KMD 663.13491046, REVS 13.16292943
sleep 1
fiat/revs sendtoaddress RFfJkcC1fnFZB2G2MUPYdNEeRrZk6njPig 13.16292943
# RV49vYgGa9kdzTQ5hq5ra88DkX4wwVdzmK KMD 29548.60287586, REVS 586.04438779
sleep 1
fiat/revs sendtoaddress RV49vYgGa9kdzTQ5hq5ra88DkX4wwVdzmK 586.04438779
# RMYqPrPpgosrjcoS34WmBtG9KDRmE7WcXK KMD 100186.19238242, REVS 1944.84440292
sleep 1
fiat/revs sendtoaddress RMYqPrPpgosrjcoS34WmBtG9KDRmE7WcXK 1944.84440292
# RH1Ug5jz6S5DbJyLENhMthMEAoSBbkXRMq KMD 1853646.03638691, REVS 415.68775429
sleep 1
fiat/revs sendtoaddress RH1Ug5jz6S5DbJyLENhMthMEAoSBbkXRMq 415.68775429
# RFREgr9p32GanT4YcM25hMcPYkvRLDNkja KMD 151544.96672946, REVS 3005.62695376
sleep 1
fiat/revs sendtoaddress RFREgr9p32GanT4YcM25hMcPYkvRLDNkja 3005.62695376
# RFjddDTCuobaHatQtd7kTiSjYv94Mp9Cu4 KMD 295382.69930466, REVS 5860.00000000
sleep 1
fiat/revs sendtoaddress RFjddDTCuobaHatQtd7kTiSjYv94Mp9Cu4 5860.00000000
# RVNWkGzsFG1ZhzKBzzUj7UPzHMu8s1JWfT KMD 59621.32507756, REVS 606.36817953
sleep 1
fiat/revs sendtoaddress RVNWkGzsFG1ZhzKBzzUj7UPzHMu8s1JWfT 606.36817953
# RGwu8hcD19TKuqzPbjdnzKmkMsUUrdsw5p KMD 23159.75532541, REVS 459.58469952
sleep 1
fiat/revs sendtoaddress RGwu8hcD19TKuqzPbjdnzKmkMsUUrdsw5p 459.58469952
# RMwP7F2QRMprthjNwT7gHWjHvvqtefwRsJ KMD 77304.58455563, REVS 1533.20000000
sleep 1
fiat/revs sendtoaddress RMwP7F2QRMprthjNwT7gHWjHvvqtefwRsJ 1533.20000000
# total KMD 0.00000000 REVS 51342.01215065

View File

@@ -1,25 +0,0 @@
b35af354357e56e2cb628d6b871b29ccecc9451d81428920e99e096be6769f7a
826e2d89119eb6bef82515cbe13c155cdbda7fe6f69f7710e9cc5ce8e9e32c0d
9f9e1bc5277765087b5a1102599745eccd88ba7e5480bcd67a326e9450c8c3ce
74c469d3659d3a21354fe29abd611ad536bb1525bd05e3ddd208860c1d195b60
4863817beae6277158d4993a3919b5285706743d24865cd3d8cdd02f595abc13
727210250e6144f72ed11bbcc14a6c4f49293fcd6e3140e431268e9645a2c000
221fa9b9d8904c669bf5404d4c2bd23f3de85cfb1638550d94b8eaa3880c7442
5d8e3dcc179dfe9610bb7f55fe14674924abb8049e44e797beb1117651a679f4
3fa7ecd3ced13aebdbba27d1f276f19ba6787a118c1db9a5d70b60b49ce8b4c7
a48c18753fa85a9b8a4d8dd33ae984828277d1f0b3105479f838bdb9339efc1a
fdffe296333e9101e6c86b0d4d6562c6e53e303ea26d0741caa94d681d1764aa
6d4a5569b3f02148e579a09829d732ce6a4adada2eaacf5be2656619599818ea
8628904bff0ee39c4f70275e9011a6606bacad8a5ffa3d81a82b0ca659e04f0f
62ee7a9f2aecbb287a6f589a803fc9164ab3132f3c48b19be8de29ee6f07ac3b
d7093749b27f66af626c716aec55abb35c19f7d06b0006d0340b8f5f902b74e3
4e6893dc5cc35cae915f5fb29cc8780bff9c1c92975a83ca779f74a5efcba3fd
0f089e6e19c490ff25f8df648a3c692a4ebbc439c6e21962d8fc4c19749b5df3
d790f0c31ef22d61cab33fd067b004093b5b39dccda0015df5cf096d666f81b5
0193eb50a1c1f255f391e03a83a11ea3f59dff8aa66fad44eeb20bc10b3eff66
07157664c81db45d96a3e92f2719cffa058e4b1e61fbf83873470a1ceb195a70
f311706621dc0e5abb2af3e75fbabeb42fc08fe6a2ef73689089374f724a024f
800c9a65a0a1e7ad1381dc1770aed25fc0c7869d84f24de55861accb679f228b
40cd628126f1b9791e67c2fc2ef091c1a1fdf9a59739cb048084d76054235f23
9786cfe6f46932d70282ff9252bcc088bce2a4aab2f03a369a2596c9964eea51
bed3728d27935b12889559b05133418becd7daac6b12155e4bfc60c32bc6720f

View File

@@ -1,48 +0,0 @@
sleep 999999
# RU18xoQZeK4Kno2ER7mv8ZEKLHiTECRhkU KMD 501.64865701, REVS 9.95750000
sleep 1
fiat/revs sendtoaddress RU18xoQZeK4Kno2ER7mv8ZEKLHiTECRhkU 9.95750000
# RJxiu5FTx2Nqr9xHvwdq1xynExUjFKVPdf KMD 62103.45021354, REVS 50.00000000
sleep 1
fiat/revs sendtoaddress RJxiu5FTx2Nqr9xHvwdq1xynExUjFKVPdf 50.00000000
# RB95bkGifi94Z4VSHGULKhCU8ML7tUbQ71 KMD 12520.16564088, REVS 138.94305839
sleep 1
fiat/revs sendtoaddress RB95bkGifi94Z4VSHGULKhCU8ML7tUbQ71 138.94305839
# RKb5ay26iSzmBoqm51vPveyErH9BYG3dry KMD 3674.15911735, REVS 72.89043156
sleep 1
fiat/revs sendtoaddress RKb5ay26iSzmBoqm51vPveyErH9BYG3dry 72.89043156
# RVeVZrr24524LhN3VRhLqNG6qgH9tBPixx KMD 612851.03780014, REVS 5433.13031755
sleep 1
fiat/revs sendtoaddress RVeVZrr24524LhN3VRhLqNG6qgH9tBPixx 5433.13031755
# RFBxwyTKGy5DtxR5CLLZSjKL5jU6fm13kp KMD 519232.27493854, REVS 10298.05578171
sleep 1
fiat/revs sendtoaddress RFBxwyTKGy5DtxR5CLLZSjKL5jU6fm13kp 10298.05578171
# RB1cuwtKBpwZPZnwyJeznaij53ovj8Dm8i KMD 19106.59220646, REVS 374.39305755
sleep 1
fiat/revs sendtoaddress RB1cuwtKBpwZPZnwyJeznaij53ovj8Dm8i 374.39305755
# RCZriSKpiSSmgwjumuiMP2XEC2FgYgTrBf KMD 1212.14061568, REVS 24.05385000
sleep 1
fiat/revs sendtoaddress RCZriSKpiSSmgwjumuiMP2XEC2FgYgTrBf 24.05385000
# RDx4sokytAASudNuMDDdk4R6RHJ4P8aPza KMD 10347.76210933, REVS 205.22959870
sleep 1
fiat/revs sendtoaddress RDx4sokytAASudNuMDDdk4R6RHJ4P8aPza 205.22959870
# RAPJuPCGMoPwfeHuckiea21LMek8BkH8Zr KMD 71712.83911390, REVS 500.67180183
sleep 1
fiat/revs sendtoaddress RAPJuPCGMoPwfeHuckiea21LMek8BkH8Zr 500.67180183
# RSWsxgczqH1uYyY6MMPePJY5jNjj7uD7Xr KMD 16435.34703311, REVS 114.80740001
sleep 1
fiat/revs sendtoaddress RSWsxgczqH1uYyY6MMPePJY5jNjj7uD7Xr 114.80740001
# RVxvCQ393MRnsQ8Fn8qiKm5yP6pk9GVgEr KMD 17137.93285029, REVS 340.00462653
sleep 1
fiat/revs sendtoaddress RVxvCQ393MRnsQ8Fn8qiKm5yP6pk9GVgEr 340.00462653
# RG5eabU8sYvrfWrCu1wb2Go5vxhyVXsbAF KMD 409543.68954327, REVS 8123.68911362
sleep 1
fiat/revs sendtoaddress RG5eabU8sYvrfWrCu1wb2Go5vxhyVXsbAF 8123.68911362
# RYTMDSu1BjaQAdvh6a9CQFCr7h1rsGi48d KMD 302.06577591, REVS 5.99094155
sleep 1
fiat/revs sendtoaddress RYTMDSu1BjaQAdvh6a9CQFCr7h1rsGi48d 5.99094155
# RVLd4HkkB8SsyXfXHQeHHNouNer7nv3mkL KMD 30407.13753317, REVS 411.30538288
sleep 1
fiat/revs sendtoaddress RVLd4HkkB8SsyXfXHQeHHNouNer7nv3mkL 411.30538288
# total KMD 0.00000000 REVS 26103.12286188

View File

@@ -1,15 +0,0 @@
bc4eca8000603d16ae491bf1bf4f5fda622f54d3b0ffdaefe12337461bb88d5f
cda5da13119d348565085119b37951f0ee2f6866d677bbca2295d5d44e365b4a
ce9516059a943070ec233716c878e90bfcf6456c9a35c587fc9f6c74008d2d72
c1f32cbd341d9e7e51046378ad072b0aaa55d1fc3b970b606ed708d3bb02d7d6
f2a2f2a2b4cc99b5cc89fefe8340252b0bbb7ecd83df809f2bf782a06d9bcdd0
5e44a6d50cd1cb64fa6349b49d5793d12988c4c3d517bb271f396a9fd66d3cae
6f6771ef52833bf504397c80f06e58a77e58387d809b42c8ae3bb6301796dcf0
96d12c7828f3f3fa7983aac02b724f5a53897856b7419e0728d78ae7e3756765
84fde41cd955564a18f6141349dffb26dc8ad498fcb3494052a8aeb0157ffb3c
93d6d89195f5332f7bae6e9ffc65d5892fa169446d90ed3d7d5017389a2a3ff6
2dc7e37ff11703c01e1a6301746d2586549fe091bbf6cf7bf80c6b49c1f38d1c
1732b6942035ba7482f9a6c77a47f90b529c51d8b22c4d14a7a430d7b8cf3303
733a0ef1b7ef603664271f7a3667e39809f9a4f7b618a4a9c00c3e8a6876d57c
cf2ed6deeaf6600b2fff0b5db13c5f950dc655b06420eee816edbfad7c07c991
16ae9bf3ed2d47c8b8fc088a6773c3316642c97ff573d5f2e185f89dadf39b14

View File

@@ -1,44 +0,0 @@
sleep 9999999
# RSVzs8BLvCrmvNF1MbqEpAwx9VHinmAxDg KMD 5669.98491054, REVS 112.56208000
sleep 1
fiat/revs sendtoaddress RSVzs8BLvCrmvNF1MbqEpAwx9VHinmAxDg 112.56208000
# RLqqYX4oMVz6c6s52bLnYdfi9qZ56bEK3W KMD 43088.74729573, REVS 470.87980000
sleep 1
fiat/revs sendtoaddress RLqqYX4oMVz6c6s52bLnYdfi9qZ56bEK3W 470.87980000
# RY5qhTwDGWQy4LsG2M3R8zyJz51KaMgCLW KMD 55892.82951156, REVS 1070.41924580
sleep 1
fiat/revs sendtoaddress RY5qhTwDGWQy4LsG2M3R8zyJz51KaMgCLW 1070.41924580
# RMx1MCvzuaiuRpS3rXV4LURWgZVRnLJCYK KMD 335.54240549, REVS 6.65853993
sleep 1
fiat/revs sendtoaddress RMx1MCvzuaiuRpS3rXV4LURWgZVRnLJCYK 6.65853993
# RNdQAbnuehuF5RnYiaLkWoWktpaxzfvNXh KMD 163589.49612623, REVS 3245.93000000
sleep 1
fiat/revs sendtoaddress RNdQAbnuehuF5RnYiaLkWoWktpaxzfvNXh 3245.93000000
# RXX1kbdye39h9g7oFnP6cMZ6EEePCPRYnc KMD 98858.55994787, REVS 1384.95819177
sleep 1
fiat/revs sendtoaddress RXX1kbdye39h9g7oFnP6cMZ6EEePCPRYnc 1384.95819177
# RUV5xgcHVavuxKkvMduhjXPVKA7oa1QCK9 KMD 5226.14889591, REVS 103.72248253
sleep 1
fiat/revs sendtoaddress RUV5xgcHVavuxKkvMduhjXPVKA7oa1QCK9 103.72248253
# RGFv6LBE1xgiu34SqSh6wjn3fpr973sREK KMD 159251.95713851, REVS 3160.13095281
sleep 1
fiat/revs sendtoaddress RGFv6LBE1xgiu34SqSh6wjn3fpr973sREK 3160.13095281
# RQFihaDjPvCwhENGhB163D7e8Wc8LURtKq KMD 28529.48507541, REVS 566.06461415
sleep 1
fiat/revs sendtoaddress RQFihaDjPvCwhENGhB163D7e8Wc8LURtKq 566.06461415
# RDjm2Xec5UTWiz3Yku8sUce8ZWxe8mTh72 KMD 8637.01756743, REVS 171.30000000
sleep 1
fiat/revs sendtoaddress RDjm2Xec5UTWiz3Yku8sUce8ZWxe8mTh72 171.30000000
# total KMD 0.00000000 REVS 10292.62590699
17f76404644686bdc3f58c562fb86036d9d13e540486a13f9c89daa26449ca45
df9e8d5430fd80035a4397a464a5a1b75a168e94c660a7f5eb9ac30f992ba3df
0a6c099f5dd33803223e743f099530df86d7a0bd3c2ab29d1de99ccf8d854b46
4ed406ac9e171d930460659d9a5f3c806d51313516b4fbf3812c1bc3f27e1106
83d733a0004ab00dc2106368405ec00f2a641721c9bdbdf24d7e88ce5f99df5c
76eb52c04c27566aa6181d1523e2cb6db413419b3a1ffe1b18ade8669de9f20b
be8fbc1408d013e586add3ca8c3677c17079d52f9d10a6e3fc08ed51dabc2598
cec00429c9802cea98789c73426294ba065d99dc29400a329c2a510a50160651
30500a29f6e9da29c67ea51a2718421e0ca945018f8a6eee1622c7462b9fed4a
ebc16e614204d51e09c23df54d0888741d3a40bea3c05bf3898a64fbf9826444

View File

@@ -1,94 +0,0 @@
8f7d4648657dd7f8aa70d8e83539ae0592cbfafc6a961fe75d7f7f613b4d5737
5669.98491054 <- expected amount RSVzs8BLvCrmvNF1MbqEpAwx9VHinmAxDg
0f5681bbc1441e39cd3226847e3863489bc3ffe6b00c161e453a897b6a4e1268
8353.36815152 <- expected amount RXbWQbnpsQ3iSBBj5bn2HDq3WvqRPJg5Ek
34cfb92756c33c9fc2b0f1126884044711a83a6deb05c8b38cc744b7a87f34f5
9683.15249375 <- expected amount RKCDBxUx7mbCnViLt423jdLt6oNpW7SH7z
cad96a82897ec8d240bb410a1c1b54922444d7bc6383ef31ae153646d4cb0837
43088.74729573 <- expected amount RLqqYX4oMVz6c6s52bLnYdfi9qZ56bEK3W
ccef457f43908a2f18c86c3c1431a9b3857263413a756ca46117655fae2acec3
50806.03038250 <- expected amount RRCvM3vVV6FPwayTevCCvkpXY2V8RxjEct
216f60dff778c0701def1ea8eb582959591369c7a67864bf2ef20ca99178138b
2015.79933830 <- expected amount RDqaDbfFHrnPAnyLY6b9A3CFZZjivhdYSJ
96e0916f1598824cfa1e2a590a0dc683be93c6fa8dbffb6153b341906de84398
48415.76246875 <- expected amount RBGX2Z43Fiey6tkgRCL9rzc3gNhdcvQyzf
e0b44fb9e74984823a307c82b70ddb7a173976fa43aec61440d9cd53654a8e93
7885.04483652 <- expected amount RWdo833bYVhMUHRdr8hMs7HHVcG2UNPwcZ
6bff9d66cafe0f249de24a6be6312f75ea97cce10c40bd2ffd4a785758787782
2076.57141858 <- expected amount RVUby7nAZAEKQc1mNu89KGchwgVN6H74Pb
d4c509d86d3ddeb3be1ea733e2c79c816c0639f3ba1738d1f50140915292949e
55892.82951156 <- expected amount RY5qhTwDGWQy4LsG2M3R8zyJz51KaMgCLW
615c5efe7cbddd2e07d2282d215f307cbdc7e102ce4e3c1e134b96086736e459
110983.78643539 <- expected amount RPAueErz2MDLv1T4VNVRkkWRPmUKDXxNyW
1baad4f5d826832d13b0ddc7379b7235a38caa42b5098f273811109b974a6dbf
135104.07865436 <- expected amount RQ2pMNHbPGagXKQoVzrgF2o718GmP7A74Z
c70b43c915aac7f917026d6229f5a7ce15184de37ed5f8aa4756d8416a3cde70
8376.94442691 <- expected amount RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3
8ceab84b76f983a4bc0ba4743027666fae243fa463f3b51bfd4cb26c39bc7731
47849.00411034 <- expected amount RHSA9ocZc77tHiFvVQ2h26AJQFsionWAXK
4b08e4b3ea8608e97d8ccdd30c4785f03c443002127269c1936134c9f2cc717d
15163.82967582 <- expected amount RS8F3LcQ8DUSoBacUKBKzMR2Wxe3hCSToY
d2c320a2fafa054cd166b331937fd5fe005f07ec02f9fd5977ca466ed663d0eb
3002.22564175 <- expected amount RLijku3v2wyCcGykdbsUViqDCNaVkVkQpc
cf93b70a0ff58ec115c03e0a395a5b413610437f40bd496707ae426df1a46aa8
14101.70011189 <- expected amount RMeaeKG7vrTpryBGVEWQ8twjQDnRVAhpqH
6be9eb9a87781ebcbd633946c891b98499001d38c934e827371a7b79d57b0de0
5832.55634776 <- expected amount RUDEQESpyWvpwdfrieiBoNo93WHaKhGxGf
e63deddaf983e5cf537f34b9777a65f001f4dda5bb86dc8b1c8f5d0ead105435
890.85002942 <- expected amount RMat1mSDDigFHhVL74mjBia9uHo5w24MLQ
f382d7ec4a9f9cf4283776449521e6c2c73a44863f119a6fa3ddd319c042f08c
335.54240549 <- expected amount RMx1MCvzuaiuRpS3rXV4LURWgZVRnLJCYK
f04aaada09059b8df995cf29c7f6d0c7ca20ed7e70d698bd21df1e61c70d2cca
19366.30498750 <- expected amount RVcMp4KgwCg6GnUJAAU2dmCvPjAa9JrEds
8496fcbe66360a2753f1795dc4b0bb1a93fa121de4b521410e046611bc04f2e5
163589.49612623 <- expected amount RNdQAbnuehuF5RnYiaLkWoWktpaxzfvNXh
9b3e499b36112979a084534143826776699b2a5def69e656d7aa7dc98a381501
3873.26099750 <- expected amount RB1j3QidCF9PTKQaZMGKe6Hzm5jdY8Mzus
17e55956fe10117b7e65a272fed473efa2dd387ab794932eebb9924e434719f0
7746.52199500 <- expected amount RFcH8p3Ke5y4UL3pdL9KCkJWp3aRdBwWpg
4499caf8325016189dc4cbaf102d3c5a358105c135defd90afbc000fbed92795
16670.51967129 <- expected amount RJDkJJd66n4Q4jVWbZJQKyXTf29ZqzeXac
41d0583c6f0720b27976f717d729c7445e10264b0663af6baa43e2ad0fe5fff0
7746.52199500 <- expected amount RKzELkcNJu4g9DWQsFFeQtFZQE5u9vevuK
eb979d5a6d79b6e0466fc3dbdd2a2f73812fb5788bfcad2b160da1e1b96828c5
74455.81274009 <- expected amount RKpUFnxUn9mJCZmNECEQT7xEubHECUPCem
2ec16b1596c2daa8d14642478d0ad6e6fa5d143980794f1c717c4e7ba2765749
98858.55994787 <- expected amount RXX1kbdye39h9g7oFnP6cMZ6EEePCPRYnc
4d59bf3a6dcd11242c3a7c20402c38e41fb8f936d63e0c5b3f6490248fd989ed
5226.14889591 <- expected amount RUV5xgcHVavuxKkvMduhjXPVKA7oa1QCK9
505e5b9d3e9ac0ee9a435e7fdb9819b53fd1169fceb9c6e4b3b2173031beac16
753.34926401 <- expected amount RBtfFBdYiryB6fyWoubm4XNqZwXqzAbJEK
b2243873085e98d346e3f2341a203c3644f1fb78fe60294f5838eff96f2121dd
159251.95713851 <- expected amount RGFv6LBE1xgiu34SqSh6wjn3fpr973sREK
75740f609901350eebc9493aff3dcfb070e107b493a2b51aa1acccfb9dedd88c
693.08132289 <- expected amount RAaszCNodXXu9rJL6qqVMZDykXncDecTMS
9beeaaa5dd83e3967f35d60073f88a320276e7a3aa61a4a06b7f8b46079fa4b4
2304.59029350 <- expected amount RT1xC82iwXtZeDLLYz3tgQRCHKsRD62Jt5
b7508390ec18fc559112de1f5ddcd6f27c74f9a41415ae97c89b01c6718afc64
6506.14889316 <- expected amount RGPEHHmPFaMPSLMQxEao2uVPTfN8vBCmym
c6eb29abc0c447043f94cac4df49b3ce640d27be2730d18c7ba3f0fe7d21861b
38732.60997500 <- expected amount RBUEoAzoydjckYewPsW2kfTr8TGFgnR2Ec
bf0e8dff8de3ce4c07b7cc09703978d7db0dc7660f312186b4c3eff2a97fd638
916.79536397 <- expected amount RVQS9NGKsbBJuKDhJnPssTRevrE428dxDK
186e0d779d5a6a644e7d972aecafe4fb1739059933a0e50ad9a82ced1c8974e4
48415.76246875 <- expected amount RHiUqYUohv49bvB2wbDe1mAkwyEFwUEnrb
37ed3649d5e2f83a0c4ee11748b076fffe8a2fb16650cad7fa39cbbe3ddc9246
16542.25810519 <- expected amount RSWPtfGaHPL1g7SMqbLm1YZ8o3QM6krzo1
2dc98a59906d57f9e57b3231d19749eb9979533d3a2c35ec5adb3cb91bfd7c7b
2322923.09575692 <- expected amount RFMcTK36Wzjo5QEk1wAH2CbATqsYvzgwXH
35a28b0551bbe3d3e5cfa989b5a073bea55784a9df162ebcafc61bffb8ff5834
28529.48507541 <- expected amount RQFihaDjPvCwhENGhB163D7e8Wc8LURtKq
3b3aabeb6483d8c37265d24ef76389f96158970485866de1005ba28d8069877b
8637.01756743 <- expected amount RDjm2Xec5UTWiz3Yku8sUce8ZWxe8mTh72
684728bb5ff281762990da11e7463c6e992b5e98cb0cc7965a3470b8a664484a
1212.26932063 <- expected amount RCZriSKpiSSmgwjumuiMP2XEC2FgYgTrBf
a021d23ab591ed687f7ba0bccbd98ecbb7d8d1f967176bb2f2e1e6fe1d83af34
32148.06627925 <- expected amount RBD72Bh4wxGi8q8xQbLfwMF2RAkTZ7sVZT
b9ab02076864711a964c149346141f01f686b50fd345e6eb5bc3f218b40c4c50
1924.55258644 <- expected amount RVih8N9Qh1jf4CCF5ySsAY8DR42eTxYqpB
d5760b4049c8818f6486d1b81b0715f6971f88b0f49e8daab4382fe6980ddd85
44542.50147125 <- expected amount RWez2L8rPoTmqj8kYKqxLdeD9BFuDibMyJ
c9bb31764aab4cd631fa733940c0b35470cad48d247ef227372cc84375cd8d8b
49199.88128813 <- expected amount RUuWvTwNAMGLpuY3GLPBAmMp8ptShkMSyN
08075d8b984266c27ed5f029b88b682596ace07cc43b2db50d4491dc810ced04
30170.24616125 <- expected amount RRTks3iwSe4oR3UDmRfGszcNcfAv6Rb5es

View File

@@ -1,27 +0,0 @@
sleep 999999
# RPYGEUfYMHizer5siX2CNpQ6xHAbjtgQuB KMD 843.49707566, REVS 16.72927581
sleep 1
fiat/revs sendtoaddress RPYGEUfYMHizer5siX2CNpQ6xHAbjtgQuB 16.72927581
# RTrZWBu7SUZWf4ZdyUVddRPxsnDhZnre7n KMD 3090.02793673, REVS 3.67077856
sleep 1
fiat/revs sendtoaddress RTrZWBu7SUZWf4ZdyUVddRPxsnDhZnre7n 3.67077856
# RRixT2CqGcr5cdPoP3G2rhrWDfSbVZR6sk KMD 79613.96546024, REVS 1579.43521640
sleep 1
fiat/revs sendtoaddress RRixT2CqGcr5cdPoP3G2rhrWDfSbVZR6sk 1579.43521640
# RQgfzPR4zeCyLWaddHysGEVzoKLZa5E4Ut KMD 20106.39865075, REVS 0.09000000
sleep 1
fiat/revs sendtoaddress RQgfzPR4zeCyLWaddHysGEVzoKLZa5E4Ut 0.09000000
# RA9G36WwA9K95bn8Cbycq5ZnoxhSzzhhBw KMD 867960.91662544, REVS 11685.48356181
sleep 1
fiat/revs sendtoaddress RA9G36WwA9K95bn8Cbycq5ZnoxhSzzhhBw 11685.48356181
# RVcSdFR5fC3Qjk3CARvQSkra5PQwC8U3uj KMD 19695.58704144, REVS 390.89494454
sleep 1
fiat/revs sendtoaddress RVcSdFR5fC3Qjk3CARvQSkra5PQwC8U3uj 390.89494454
# RQokxkBAizLmegMeWK5TyTpSHn2vP5adjo KMD 2981.62619009, REVS 30.35300490
sleep 1
fiat/revs sendtoaddress RQokxkBAizLmegMeWK5TyTpSHn2vP5adjo 30.35300490
# RAMvDwi58oyArqfGseWZsYbR2BN3L7ghVX KMD 40914.30625015, REVS 476.17156540
sleep 1
fiat/revs sendtoaddress RAMvDwi58oyArqfGseWZsYbR2BN3L7ghVX 476.17156540
# total KMD 0.00000000 REVS 14182.82834742

View File

@@ -1,107 +0,0 @@
f8b8a27ca722196f5f745f7778fc8aed873c3b040a1a964e704e63ebf5185edd
b7e28fadcedd54f973a9e91df42c3d02bd1436f2377f28e6c866cafadf2c947b
dc3adb9035b939ce50e4144920acb9fc4ff1fc36b226bf6cca13e1d2a7ab36c8
8c64142d44edd729b9972361b8dbd14e5f3f022daee1b2ec1ff3b3f69a755884
d15d1de5f494c22bcd4b9717ba416efbecb78d9d143209b31fd9362be13b9dea
4b99586c873574fd4e6f2055130a85e194ea7da61303ccd2b6839f7d6754ad92
0645a7c8a584e9fe3f5dce8cb5972b9ab15f580abcd4fd12bdd19bd2bbca5d4b
a8ca857443e07b225d8a6271ab761e7636c568159582e7d8540998fe47b37b86
20b13d8b02b1f728c2b19a09876e2eeab68aa3a51cd1c0b539c18f980e244106
84491a5ed8421013e546f32e6407d4d916297176944fbc1daa99b4b7d30673db
0ff635aadfdbdb4d6887d04a1ecaed449bf708c36da782781dec0601057c6ede
4034cf5a74b9a0c5ea725ff6d227b738b1015dafb88e610d2c42bc2e56f4cd9a
7644c293c0b80e186ac8f73eeef1390458b1a2febbffe6e03442809c7a1b52ca
f6f2ceee809d3a02d32c08839965f90cc9783c7c0c979df48f17f63702bc26e2
8be21cf583d6fff597bba5fb537ae2c29b9f797f31c5d33641e377332a14396e
32652dd110bc58128354a8f1b55d027c21cf805f34183c746494d763dc5f944a
26a8db0f5dfa4f8dc0ac40f409070e7ba0bb507bb99138639382f503dbbaa11b
5f8ca3d9d4360990b7f164b0c8a6f8541e449395a17c0024b593346454cee653
6ef36fb6b117c326819d644ad59eaa17834b1bd4d2565906f39d0c239b3ee5fa
6a9664882c7fa2c033db4fba4d25d10db381e0005e10d08034d569c97849046e
0ef90e1eb2c1d73dca4270e16511bca3458f040ad066965859aec3c660609aaf
c6ece66a5a6254774b799ca3a167d3d28567e0239ff2738d90497a271b5e1113
feaaa2e13f87b1116969f1eba327d9a1ce9f3bdf900c5413a12172b4b425421d
411823d20770f587c4b77140680516964f178e143249da0fd643141b422bb4e5
15c646b807f0bfde249e7db39cf2734712ab35487bd69797473973c87ea96945
7a8a83984b699741d2ecad3c8cba537762106648bae8a590bb8468e84d1749a5
4bcd8c28879d255d53c56475a0d8aa2be0bf831db6f7e15ad1f77a0841e950a6
d472c0868258d14810ceeaaac010bb1f927ece44b55d7e2cda42214baddb0ea0
69acf622b21eb4eba6af5d506d4d11831ee4533814ba6a0300072354de25a625
20bcdf8d19f96fea65b7130193e0d5ab54b5e4a2150b8a6ade3bf4e98bf98d0c
0c5bad3e366c301e730fbf58a83b219f5265f0a596feb89bbe0306bd87a4b72b
33744e5ee5df4dd46a7e133825a5af4734baafbe3f1d3c849e5d36e8c038b282
d4cce84308b475327d6fec1505cb12f30a1cd266b34c9dc810a14df5eac5f825
eafe1f16f6bf6ef1fe987039e2daf80723fc78752d2896ff6d99ae9cd0143a26
a7033c2b1772e461a897012c9ecca796a9f3f9f0622beb006f3dbabdcbeaa5f1
bb35fa7bed699d2c1188a0df41371e4fac1ca34eefdcfb4cd7cba398300493c3
3de0201d7b0e0d531116c457dd857e1b92ad4ba99b1283f4e6ea346641ba270b
fa1641370e84b65f43086c90f37a0c79d918cb7330f95977849560f5db90ec7a
0dcbe1b19e716b2ae5ebe7ecce917e26fb09a8890480f2b7e8315f7b6fdf9de8
35a134a0ca04f3cf402827df17616f64e0b488ddfa277f9d287a3aa524258a0b
08e7c05da62f384287ed42ac138d1d5da6968d3320fb855cf66a3a72685f6ec7
fa0b0b65fb2f66f26379c6eb7f0b299d916ed0dbf7a569d7bae4fc455cb6cfc2
88794bbb699f130951c40dc99a27d2c7c7016e12824fd1040cbedf86980de04d
3d2b8a2bd53af7f871d9c5c3ada5a8742b9ca14918efbdc0b50655fbd6a9c43c
91928c3a9e0ab6710cf6b517234420ba8455592af3c9da7662f8a3ce2fa1e823
1e311229a68642300d6e4cae166334df4a3e87c0e52e86760ccc0234d2ebecd1
9a82ddea65986359f0e69bd9d06db7f0f3ab99bf6be2ae2cfaa24e3de74ec170
c0a151d520e4c11eb23f75a0b3b3a09c5dcdb4283edc5f7aaa5082336337e3c4
ca850ff82776e1e72d82a2d0c4c35235e4841cec6f2b36d8d4e37aa46d06a5e4
5b4060b77f23488e5f2ad57c775dfb62e235140f42d57720cb985ee218d97d64
403183a0ab2a672c6968e9c88190910d8949bd03808b353291e150ac6e5e49a4
5a86136b1ecf2d9a43dd42d3d902653ca24c8ecc71001097ca035e3750ba8998
780ea40a7fea9bab8547c2917c60c90a7a88ce38bb1f3af06197dd3341504987
4e1b419e3d67c35351fe18e2f001a404c08c04f8b6148412c7a5d7ee01f91a73
4231eb801746ac3bd08e57533498a74400570c28f4bc4c2f8a1424be3d4b1bb1
e1bc9dcf2dd758717480f29e62a24a9e250b356d5ef275de46bc580002ed85d0
25e0a1f1c0d8db40acedfd491ae445e2242d6fa0ca39b18ccb4e9d6eff86dbb0
053839195f085b1586d46ab54dd05b17e91e4f0876d0a53832543774a8fb0b1d
9deeabbcaca2e613254eca4b15dea6e86d6fa7ec8893baffe713b8ed796fc3cb
c6e0f0089b9741e4c75d3080a1549cd5ea87e7605501e2419ee9186817c60a8a
a1bca1dd1011c23bde3babeff2120ebd48282b3a9b41c10a0b80dc38e3efdef9
563f1812684dc33528418877fa5bbcb15b83c4d3496b076f4f3bdad38f0fdb6a
06a3ca90a32455b03b5f6008737d25fab7fc02f0126b40e25f440d4ad8c98caf
36b8f751739ec405427830b06b8020f9975bc29ea93faf72e1e99c22231bed88
ef9247fd847739e2ec786a23663da32efff73c6e4b9b02f43411332ad1eac945
1d3fe9e86a4692029ea13b153f423fc9be211dd3d7207f374e5360a8a1812f0a
afe379fcb8d097448decdcaebc8669c2b6f05c9a593f89265b44280231d900f2
07873c642e76432ae77193bdee90fb21c3fe1d2d47cb87689d20feb47ecf6884
904c0e81c754b190b459be69c5ac925d274aa91e8d69639375adfc7bc3659c23
34cbc40d34fcc916845b7a991f3d430831a919c782556a0dab5b4083cf0b277d
38c0d0d6055d6e37513af175c5232a97a04e16a6c64d2e5711e0ed0e01868264
e1988acd516c445a36a425d4e881b6ba620ec31be7fc2e86ff40113030611a41
0472010fbe40e01a55bdca2bfe06b9383c41ec8a4d70c54ecb32b7f1765a85f4
4058e9174d9fbdf611c481552a0c9038b4905341ad31156fadb62e924156b971
c0b23f4f41480765fda1efb44af0eb118685e70392e004e5b5a68ae4cb741452
dde373fff9ce038d5b2524506038f0986b459fca9550452e3248c34b40041ece
98e70c5491278d48f0ee5fbaf63a1ffac7ab7975ec8def8e711f8821df214c32
45e995c9a816a7ccfd34823ae88375f7e7b2d52a9fe5f1953748d06c8c9f920b
d3196f666e093f6295ff5d9bbb5fad3d735c79efc3a0ef2682a5d10abbc047d9
47819cadf315ee1931a475219d61fa2367a73310749f23cfa994ef9e0324fff3
aa4719fd7745191531c68c140ec52728cb9d3ffaea5875967f75dbb7ab7a2b57
83dfacc40a05c80e1a8e4cae7a0cbb98a30f76ad010efb63b9a515b490f7676e
4c118313fff51fc72ec2c49045679e6bb9a9aeb7143b576b1f3eb07429a0b806
f208fd7abeb82b6aa0218db68421045078cde1521129029dd2ffafa759208cbc
cf58359f2b61ab6fd73f176bd094154d04f83752a86bd91a2b7879123a51cbf0
3e10f831b75abd7bb89fa74dd6b74d5f07a2d818c44eccec496896dfadac9534
250204ddd107ece1d5092a4cd1163115ede9e754ef136d80d912ccfc132e0ac5
676d1ea16b0fd80025953ecc999213d4e0b1b002f2b4193d7616ec97a269a49f
4ca289d052c847b502ce756ed65f035e38e78575ee9fa0e68df89595151967fb
ccdec5f135b9dee61540fb3f0cca5a372189d69c1461242eaa11c788557740d8
f3ebba346b9ad00771ce1ee67dafab3f875c307ba39ab8439f63822d4c78c656
4496f369401f0e7778fbaa9199505f8ab093c0cc22fdefe3a6d0a465b3c0d078
b0eb34108101f19e10248066d9a339596bded6dd7a84d0be64c701e837b5f596
796577570b9a7dce40bcc476c95c72d903531367db6ebc9d5d457d77634d0123
26ee642aaa9f2fbeb1603ac695ce13dcfa8709af07e0cd71bce85c2ccb3ac4cf
ada15a386b1ded5afb41bd30946b9bac14a5bf8912ffcd12f086f29dfe31b3b2
073202790ae224da09b17aed4c18d8395433d5e6ea910bd04c1b952444b8a239
cb38a03e8afa8b0dfcdbe13070ea6d048ea1cc9a1054ba86c6ab88511e2661d4
e8dba03f46da7dfa258be5376fc1dec714c0104423191b3ad14a476bbcbce929
6c9dd8171202deab1d5d8af6aa1b7c1ea6f4cb8654cb3241040659674b700308
49f2add7db2978cacc1798cd08b67f33d435606d2b3dc877a673dfdeaa7617b3
84ae90011844413779316580fc2731e391829237e7b356354ae1266e5712ac3d
efffc292acaa38e458ef396c818dda28c9e2971065f65abeaa0a4d951b141dfe
f03e0af2f1fd32263d5a4149fedd9128c3bc7616088c208abbd5c1f065cb5249
1814b8d5550ceb07acecc3c4995dd2d582af9bf6f6e6b5a40319f824570f18c9
73e622d891f13d8c136214eaeeddc2c9e7d721844abf797916fb0c4b2a9e9e49
6cee8ae520488bbe9cb516490e94876e0828c27bffdb72f7e9695d5ec9ee3b2c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -307,5 +307,31 @@
"157.230.45.184",
"165.22.52.123"
]
}
},
{
"ac_name": "COMMOD",
"ac_supply": "0",
"ac_reward": "204800000000,100000000",
"ac_end": "482130,0",
"ac_halving": "43830,525960",
"ac_decay": "50000000,10000000",
"ac_eras": "2",
"ac_cc": "777",
"ac_public": "1",
"addnode": [
"34.246.186.176",
"34.251.151.148"
]
},
{
"ac_name": "WLC21",
"ac_supply": "21000000",
"ac_reward": "190258751",
"ac_staked": "90",
"ac_public": "1",
"addnode": [
"37.187.225.231",
"51.38.38.134"
]
}
]

View File

@@ -20,16 +20,16 @@
#include "CCinclude.h"
bool GatewaysValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4);
std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount);
std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount);
std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount);
std::string GatewaysPartialSign(uint64_t txfee,uint256 txidaddr,std::string refcoin,std::string hex);
std::string GatewaysCompleteSigning(uint64_t txfee,uint256 txidaddr,std::string refcoin,std::string hex);
std::string GatewaysMarkDone(uint64_t txfee,uint256 withdrawtxid,std::string refcoin);
UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin);
UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin);
UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin);
UniValue GatewaysBind(const CPubKey& pk, uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4);
UniValue GatewaysDeposit(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount);
UniValue GatewaysClaim(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount);
UniValue GatewaysWithdraw(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount);
UniValue GatewaysPartialSign(const CPubKey& pk, uint64_t txfee,uint256 txidaddr,std::string refcoin,std::string hex);
UniValue GatewaysCompleteSigning(const CPubKey& pk, uint64_t txfee,uint256 txidaddr,std::string refcoin,std::string hex);
UniValue GatewaysMarkDone(const CPubKey& pk, uint64_t txfee,uint256 withdrawtxid,std::string refcoin);
UniValue GatewaysPendingDeposits(const CPubKey& pk, uint256 bindtxid,std::string refcoin);
UniValue GatewaysPendingWithdraws(const CPubKey& pk, uint256 bindtxid,std::string refcoin);
UniValue GatewaysProcessedWithdraws(const CPubKey& pk, uint256 bindtxid,std::string refcoin);
// CCcustom
UniValue GatewaysInfo(uint256 bindtxid);

View File

@@ -20,11 +20,11 @@
#include "CCinclude.h"
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format);
std::string OracleFund(int64_t txfee,uint256 oracletxid);
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee);
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);
std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data);
UniValue OracleCreate(const CPubKey& pk, int64_t txfee,std::string name,std::string description,std::string format);
UniValue OracleFund(const CPubKey& pk, int64_t txfee,uint256 oracletxid);
UniValue OracleRegister(const CPubKey& pk, int64_t txfee,uint256 oracletxid,int64_t datafee);
UniValue OracleSubscribe(const CPubKey& pk, int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);
UniValue OracleData(const CPubKey& pk, int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data);
// CCcustom
UniValue OracleDataSample(uint256 reforacletxid,uint256 txid);
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num);

View File

@@ -22,14 +22,14 @@
bool PegsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
// CCcustom
std::string PegsCreate(uint64_t txfee,int64_t amount,std::vector<uint256> bindtxids);
std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid);
std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint256 liquidatetxid);
std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsAccountHistory(uint256 pegstxid);
UniValue PegsAccountInfo(uint256 pegstxid);
UniValue PegsCreate(const CPubKey& pk,uint64_t txfee,int64_t amount,std::vector<uint256> bindtxids);
UniValue PegsFund(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsGet(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsRedeem(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid);
UniValue PegsLiquidate(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint256 liquidatetxid);
UniValue PegsExchange(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsAccountHistory(const CPubKey& pk,uint256 pegstxid);
UniValue PegsAccountInfo(const CPubKey& pk,uint256 pegstxid);
UniValue PegsWorstAccounts(uint256 pegstxid);
UniValue PegsInfo(uint256 pegstxid);

View File

@@ -19,6 +19,7 @@
#include "komodo_defs.h"
#include "CCinclude.h"
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
extern void GetKomodoEarlytxidScriptPub();
extern CScript KOMODO_EARLYTXID_SCRIPTPUB;

View File

@@ -19,7 +19,6 @@
UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
{
static uint256 zero;
UniValue result(UniValue::VARR);
struct CCcontract_info *cpAssets, assetsC;
@@ -35,7 +34,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
std::vector<uint8_t> origpubkey;
CTransaction ordertx;
uint8_t funcid, evalCode;
char numstr[32], funcidstr[16], origaddr[64], origtokenaddr[64], assetidstr[65];
char numstr[32], funcidstr[16], origaddr[64], origtokenaddr[64];
txid = it->first.txhash;
LOGSTREAM("ccassets", CCLOG_DEBUG2, stream << "addOrders() checking txid=" << txid.GetHex() << std::endl);
@@ -46,8 +45,8 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
{
LOGSTREAM("ccassets", CCLOG_DEBUG2, stream << "addOrders() checking ordertx.vout.size()=" << ordertx.vout.size() << " funcid=" << (char)(funcid ? funcid : ' ') << " assetid=" << assetid.GetHex() << std::endl);
if (refassetid != zero && assetid == refassetid ||
pk != CPubKey() && pk == pubkey2pk(origpubkey) && (funcid == 'S' || funcid == 's'))
if (pk == CPubKey() && (refassetid == zeroid || assetid == refassetid) // tokenorders
|| pk != CPubKey() && pk == pubkey2pk(origpubkey) && (funcid == 'S' || funcid == 's')) // mytokenorders, returns only asks (is this correct?)
{
LOGSTREAM("ccassets", CCLOG_DEBUG2, stream << "addOrders() it->first.index=" << it->first.index << " ordertx.vout[it->first.index].nValue=" << ordertx.vout[it->first.index].nValue << std::endl);
@@ -61,7 +60,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
funcidstr[0] = funcid;
funcidstr[1] = 0;
item.push_back(Pair("funcid", funcidstr));
item.push_back(Pair("txid", uint256_str(assetidstr, txid)));
item.push_back(Pair("txid", txid.GetHex()));
item.push_back(Pair("vout", (int64_t)it->first.index));
if (funcid == 'b' || funcid == 'B')
{
@@ -77,18 +76,17 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
sprintf(numstr, "%llu", (long long)ordertx.vout[0].nValue);
item.push_back(Pair("askamount", numstr));
}
if (origpubkey.size() == 33)
if (origpubkey.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE)
{
GetCCaddress(cp, origaddr, pubkey2pk(origpubkey));
item.push_back(Pair("origaddress", origaddr));
GetTokensCCaddress(cpTokens, origtokenaddr, pubkey2pk(origpubkey));
item.push_back(Pair("origtokenaddress", origtokenaddr));
}
if (assetid != zeroid)
item.push_back(Pair("tokenid", uint256_str(assetidstr, assetid)));
item.push_back(Pair("tokenid", assetid.GetHex()));
if (assetid2 != zeroid)
item.push_back(Pair("otherid", uint256_str(assetidstr, assetid2)));
item.push_back(Pair("otherid", assetid2.GetHex()));
if (price > 0)
{
if (funcid == 's' || funcid == 'S' || funcid == 'e' || funcid == 'e')

View File

@@ -21,12 +21,12 @@
#define CHANNELS_MAXPAYMENTS 1000
bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment,uint256 tokenid);
std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint256 secret);
std::string ChannelClose(uint64_t txfee,uint256 opentxid);
std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid);
UniValue ChannelsList();
UniValue ChannelOpen(const CPubKey& pk,uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment,uint256 tokenid);
UniValue ChannelPayment(const CPubKey& pk,uint64_t txfee,uint256 opentxid,int64_t amount, uint256 secret);
UniValue ChannelClose(const CPubKey& pk,uint64_t txfee,uint256 opentxid);
UniValue ChannelRefund(const CPubKey& pk,uint64_t txfee,uint256 opentxid,uint256 closetxid);
UniValue ChannelsList(const CPubKey& pk);
// CCcustom
UniValue ChannelsInfo(uint256 opentxid);
UniValue ChannelsInfo(const CPubKey& pk,uint256 opentxid);
#endif

View File

@@ -25,8 +25,8 @@
bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
// CCcustom
std::string FaucetFund(uint64_t txfee,int64_t funds);
std::string FaucetGet(uint64_t txfee);
UniValue FaucetFund(const CPubKey& mypk,uint64_t txfee,int64_t funds);
UniValue FaucetGet(const CPubKey& mypk,uint64_t txfee);
UniValue FaucetInfo();
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@
#define CC_REWARDS_H
#include "CCinclude.h"
#include <gmp.h>
#define EVAL_REWARDS 0xe5
#define REWARDSCC_MAXAPR (COIN * 25)

View File

@@ -824,9 +824,8 @@ std::string CreateToken(int64_t txfee, int64_t tokensupply, std::string name, st
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (AddNormalinputs(mtx, mypk, tokensupply + 2 * txfee, 64) > 0)
if (AddNormalinputs2(mtx, tokensupply + 2 * txfee, 64) > 0) // add normal inputs only from mypk
{
int64_t mypkInputs = TotalPubkeyNormalInputs(mtx, mypk);
if (mypkInputs < tokensupply) { // check that tokens amount are really issued with mypk (because in the wallet there maybe other privkeys)
CCerror = "some inputs signed not with -pubkey=pk";

View File

@@ -19,14 +19,7 @@
std::vector<CPubKey> NULL_pubkeys;
struct NSPV_CCmtxinfo NSPV_U;
/*
FinalizeCCTx is a very useful function that will properly sign both CC and normal inputs, adds normal change and the opreturn.
This allows the contract transaction functions to create the appropriate vins and vouts and have FinalizeCCTx create a properly signed transaction.
By using -addressindex=1, it allows tracking of all the CC addresses
*/
/* see description to function definition in CCinclude.h */
bool SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey)
{
#ifdef ENABLE_WALLET
@@ -41,17 +34,35 @@ bool SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScrip
return(false);
}
std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret,std::vector<CPubKey> pubkeys)
/*
FinalizeCCTx is a very useful function that will properly sign both CC and normal inputs, adds normal change and the opreturn.
This allows the contract transaction functions to create the appropriate vins and vouts and have FinalizeCCTx create a properly signed transaction.
By using -addressindex=1, it allows tracking of all the CC addresses
*/
std::string FinalizeCCTx(uint64_t CCmask, struct CCcontract_info *cp, CMutableTransaction &mtx, CPubKey mypk, uint64_t txfee, CScript opret, std::vector<CPubKey> pubkeys)
{
UniValue sigData = FinalizeCCTxExt(false, CCmask, cp, mtx, mypk, txfee, opret, pubkeys);
return sigData[JSON_HEXTX].getValStr();
}
// extended version that supports signInfo object with conds to vins map for remote cc calls
UniValue FinalizeCCTxExt(bool remote, uint64_t CCmask, struct CCcontract_info *cp, CMutableTransaction &mtx, CPubKey mypk, uint64_t txfee, CScript opret, std::vector<CPubKey> pubkeys)
{
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
CTransaction vintx; std::string hex; CPubKey globalpk; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0;
int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0;
int32_t i,flag,mgret,utxovout,n,err = 0;
char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64], unspendabletokensaddr[64],CC1of2CCaddr[64];
uint8_t *privkey, myprivkey[32], unspendablepriv[32], /*tokensunspendablepriv[32],*/ *msg32 = 0;
uint8_t *privkey = NULL, myprivkey[32] = { '\0' }, unspendablepriv[32] = { '\0' }, /*tokensunspendablepriv[32],*/ *msg32 = 0;
CC *mycond=0, *othercond=0, *othercond2=0,*othercond4=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond=0, *condCC2=0,*mytokenscond = NULL, *mysingletokenscond = NULL, *othertokenscond = NULL;
CPubKey unspendablepk /*, tokensunspendablepk*/;
struct CCcontract_info *cpTokens, tokensC;
UniValue sigData(UniValue::VARR),result(UniValue::VOBJ);
const UniValue sigDataNull = NullUniValue;
globalpk = GetUnspendable(cp,0);
n = mtx.vout.size();
for (i=0; i<n; i++)
@@ -63,9 +74,18 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
if ( (n= mtx.vin.size()) > CC_MAXVINS )
{
fprintf(stderr,"FinalizeCCTx: %d is too many vins\n",n);
return("0");
result.push_back(Pair(JSON_HEXTX, "0"));
return result;
}
Myprivkey(myprivkey);
//Myprivkey(myprivkey); // for NSPV mode we need to add myprivkey for the explicitly defined mypk param
#ifdef ENABLE_WALLET
// get privkey for mypk
CKeyID keyID = mypk.GetID();
CKey vchSecret;
if (pwalletMain->GetKey(keyID, vchSecret))
memcpy(myprivkey, vchSecret.begin(), sizeof(myprivkey));
#endif
GetCCaddress(cp,myaddr,mypk);
mycond = MakeCCcond1(cp->evalcode,mypk);
@@ -109,7 +129,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{
fprintf(stderr,"vin.%d vout.%d is bigger than vintx.%d\n",i,mtx.vin[i].prevout.n,(int32_t)vintx.vout.size());
memset(myprivkey,0,32);
return("");
return UniValue(UniValue::VOBJ);
}
}
if (normalvins>1 && ccvins)
@@ -164,8 +184,18 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{
if ( KOMODO_NSPV_FULLNODE )
{
if ( SignTx(mtx,i,vintx.vout[utxovout].nValue,vintx.vout[utxovout].scriptPubKey) == 0 )
fprintf(stderr,"signing error for vini.%d of %llx\n",i,(long long)vinimask);
if (!remote)
{
if (SignTx(mtx, i, vintx.vout[utxovout].nValue, vintx.vout[utxovout].scriptPubKey) == 0)
fprintf(stderr, "signing error for vini.%d of %llx\n", i, (long long)vinimask);
}
else
{
// if no myprivkey for mypk it means remote call from nspv superlite client
// add sigData for superlite client
UniValue cc(UniValue::VNULL);
AddSigData2UniValue(sigData, i, cc, HexStr(vintx.vout[utxovout].scriptPubKey), vintx.vout[utxovout].nValue ); // store vin i with scriptPubKey
}
}
else
{
@@ -282,7 +312,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{
fprintf(stderr,"CC signing error: vini.%d has unknown CC address.(%s)\n",i,destaddr);
memset(myprivkey,0,32);
return("");
return sigDataNull;
}
}
uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL,utxovalues[i],consensusBranchId, &txdata);
@@ -296,15 +326,33 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
fprintf(stderr," sighash [%d] %.8f %x\n",i,(double)utxovalues[i]/COIN,consensusBranchId);
}
if ( cc_signTreeSecp256k1Msg32(cond,privkey,sighash.begin()) != 0 )
if (!remote) // we have privkey in the wallet
{
mtx.vin[i].scriptSig = CCSig(cond);
if (cc_signTreeSecp256k1Msg32(cond, privkey, sighash.begin()) != 0)
{
mtx.vin[i].scriptSig = CCSig(cond);
}
else
{
fprintf(stderr, "vini.%d has CC signing error address.(%s) %s\n", i, destaddr, EncodeHexTx(mtx).c_str());
memset(myprivkey, 0, sizeof(myprivkey));
return sigDataNull;
}
}
else
else // no privkey locally - remote call
{
fprintf(stderr,"vini.%d has CC signing error address.(%s) %s\n",i,destaddr,EncodeHexTx(mtx).c_str());
memset(myprivkey,0,sizeof(myprivkey));
return("");
// serialize cc:
UniValue ccjson;
ccjson.read(cc_conditionToJSONString(cond));
if (ccjson.empty())
{
fprintf(stderr, "vini.%d can't serialize CC.(%s) %s\n", i, destaddr, EncodeHexTx(mtx).c_str());
memset(myprivkey, 0, sizeof(myprivkey));
return sigDataNull;
}
AddSigData2UniValue(sigData, i, ccjson, std::string(), vintx.vout[utxovout].nValue); // store vin i with scriptPubKey
}
}
} else fprintf(stderr,"FinalizeCCTx2 couldnt find %s mgret.%d\n",mtx.vin[i].prevout.hash.ToString().c_str(),mgret);
@@ -334,8 +382,12 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
memset(myprivkey,0,sizeof(myprivkey));
std::string strHex = EncodeHexTx(mtx);
if ( strHex.size() > 0 )
return(strHex);
else return("0");
result.push_back(Pair(JSON_HEXTX, strHex));
else {
result.push_back(Pair(JSON_HEXTX, "0"));
}
if (sigData.size() > 0) result.push_back(Pair(JSON_SIGDATA,sigData));
return result;
}
void NSPV_CCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag);
@@ -412,7 +464,10 @@ void SetCCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t
{
if ( GetAddressIndex((*it).first, (*it).second, addressIndex) == 0 )
return;
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it1=addressIndex.begin(); it1!=addressIndex.end(); it1++) txids.push_back(it1->first.txhash);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it1=addressIndex.begin(); it1!=addressIndex.end(); it1++)
{
if (it1->second>=0) txids.push_back(it1->first.txhash);
}
}
}
@@ -579,11 +634,15 @@ int32_t CC_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *
else return(belowi);
}
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs)
int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs)
{
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up;
if ( KOMODO_NSPV_SUPERLITE )
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
// if (mypk != pubkey2pk(Mypubkey())) //remote superlite mypk, do not use wallet since it is not locked for non-equal pks (see rpcs with nspv support)!
// return(AddNormalinputs3(mtx, mypk, total, maxinputs));
#ifdef ENABLE_WALLET
assert(pwalletMain != NULL);
const CKeyStore& keystore = *pwalletMain;
@@ -675,12 +734,20 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
return(0);
}
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs)
// always uses -pubkey param as mypk
int64_t AddNormalinputs2(CMutableTransaction &mtx, int64_t total, int32_t maxinputs)
{
CPubKey mypk = pubkey2pk(Mypubkey());
return AddNormalinputsRemote(mtx, mypk, total, maxinputs);
}
// has additional mypk param for nspv calls
int64_t AddNormalinputsRemote(CMutableTransaction &mtx, CPubKey mypk, int64_t total, int32_t maxinputs)
{
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
if ( KOMODO_NSPV_SUPERLITE )
return(NSPV_AddNormalinputs(mtx,pubkey2pk(Mypubkey()),total,maxinputs,&NSPV_U));
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos));
if ( maxinputs > CC_MAXVINS )
maxinputs = CC_MAXVINS;
@@ -688,7 +755,7 @@ int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinput
threshold = total/maxinputs;
else threshold = total;
sum = 0;
Getscriptaddress(coinaddr,CScript() << Mypubkey() << OP_CHECKSIG);
Getscriptaddress(coinaddr,CScript() << vscript_t(mypk.begin(), mypk.end()) << OP_CHECKSIG);
SetCCunspents(unspentOutputs,coinaddr,false);
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
@@ -766,3 +833,21 @@ int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinput
}
return(0);
}
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs,bool remote)
{
if (!remote) return (AddNormalinputsLocal(mtx,mypk,total,maxinputs));
else return (AddNormalinputsRemote(mtx,mypk,total,maxinputs));
}
void AddSigData2UniValue(UniValue &sigdata, int32_t vini, UniValue& ccjson, std::string sscriptpubkey, int64_t amount)
{
UniValue elem(UniValue::VOBJ);
elem.push_back(Pair("vin", vini));
if (!ccjson.empty())
elem.push_back(Pair("cc", ccjson));
if (!sscriptpubkey.empty())
elem.push_back(Pair("scriptPubKey", sscriptpubkey));
elem.push_back(Pair("amount", amount));
sigdata.push_back(elem);
}

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* Copyright <EFBFBD> 2014-2019 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@@ -93,13 +93,23 @@ CPubKey buf2pk(uint8_t *buf33)
return(pk);
}
CPubKey pubkey2pk(std::vector<uint8_t> pubkey)
CPubKey pubkey2pk(std::vector<uint8_t> vpubkey)
{
CPubKey pk; int32_t i,n; uint8_t *dest,*pubkey33;
n = pubkey.size();
dest = (uint8_t *)pk.begin();
pubkey33 = (uint8_t *)pubkey.data();
for (i=0; i<n; i++)
dest[i] = pubkey33[i];
CPubKey pk;
pk.Set(vpubkey.begin(), vpubkey.end());
return(pk);
}
void CCLogPrintStr(const char *category, int level, const std::string &str)
{
if (level < 0)
level = 0;
if (level > CCLOG_MAXLEVEL)
level = CCLOG_MAXLEVEL;
for (int i = level; i <= CCLOG_MAXLEVEL; i++)
if (LogAcceptCategory((std::string(category) + std::string("-") + std::to_string(i)).c_str()) || // '-debug=cctokens-0', '-debug=cctokens-1',...
i == 0 && LogAcceptCategory(std::string(category).c_str())) { // also supporting '-debug=cctokens' for CCLOG_INFO
LogPrintStr(str);
break;
}
}

View File

@@ -16,6 +16,7 @@
/*
CCutils has low level functions that are universally useful for all contracts.
*/
#include "CCinclude.h"
#include "komodo_structs.h"
#include "key_io.h"
@@ -169,7 +170,12 @@ bool CheckTxFee(const CTransaction &tx, uint64_t txfee, uint32_t height, uint64_
return true;
}
// set additional 'unspendable' addr
uint32_t GetLatestTimestamp(int32_t height)
{
if ( KOMODO_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
return(komodo_heightstamp(height));
} // :P
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
{
cp->unspendableEvalcode2 = evalcode;
@@ -178,7 +184,6 @@ void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *
strcpy(cp->unspendableaddr2,coinaddr);
}
// set yet another additional 'unspendable' addr
void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
{
cp->unspendableEvalcode3 = evalcode;
@@ -187,7 +192,6 @@ void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *
strcpy(cp->unspendableaddr3,coinaddr);
}
// set pubkeys, myprivkey and 1of2 cc addr for spending from 1of2 cryptocondition vout:
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr)
{
cp->coins1of2pk[0] = pk1;
@@ -196,8 +200,6 @@ void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t
strcpy(cp->coins1of2addr,coinaddr);
}
// set pubkeys, myprivkey and 1of2 cc addr for spending from 1of2 token cryptocondition vout
// to get tokenaddr use GetTokensCCaddress()
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *tokenaddr)
{
cp->tokens1of2pk[0] = pk1;
@@ -358,7 +360,6 @@ bool GetCCaddress1of2(struct CCcontract_info *cp,char *destaddr,CPubKey pk,CPubK
return(destaddr[0] != 0);
}
// get scriptPubKey adddress for three/dual eval token 1of2 cc vout
bool GetTokensCCaddress1of2(struct CCcontract_info *cp, char *destaddr, CPubKey pk, CPubKey pk2)
{
CC *payoutCond;

116
src/cc/COptCCParams.cpp Normal file
View File

@@ -0,0 +1,116 @@
/*Descriptson and examples of COptCCParams class found in:
script/standard.h/cpp
class COptCCParams
structure of data in vData payload attached to end of CCvout:
param
OP_1
param
OP_2 ... etc until OP_16
OP_PUSHDATA4 is the last OP code to tell things its at the end.
taken from standard.cpp line 22: COptCCParams::COptCCParams(std::vector<unsigned char> &vch)
EXAMPLE taken from Verus how to create scriptPubKey from COptCCParams class:
EXAMPLE taken from Verus how to decode scriptPubKey from COptCCParams class:
*/
bool MakeGuardedOutput(CAmount value, CPubKey &dest, CTransaction &stakeTx, CTxOut &vout)
{
CCcontract_info *cp, C;
cp = CCinit(&C,EVAL_STAKEGUARD);
CPubKey ccAddress = CPubKey(ParseHex(cp->CChexstr));
// return an output that is bound to the stake transaction and can be spent by presenting either a signed condition by the original
// destination address or a properly signed stake transaction of the same utxo on a fork
vout = MakeCC1of2vout(EVAL_STAKEGUARD, value, dest, ccAddress);
std::vector<CPubKey> vPubKeys = std::vector<CPubKey>();
vPubKeys.push_back(dest);
vPubKeys.push_back(ccAddress);
std::vector<std::vector<unsigned char>> vData = std::vector<std::vector<unsigned char>>();
CVerusHashWriter hw = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
hw << stakeTx.vin[0].prevout.hash;
hw << stakeTx.vin[0].prevout.n;
uint256 utxo = hw.GetHash();
vData.push_back(std::vector<unsigned char>(utxo.begin(), utxo.end())); // Can we use any data here to construct vector?
CStakeParams p;
if (GetStakeParams(stakeTx, p))
{
// prev block hash and height is here to make validation easy
vData.push_back(std::vector<unsigned char>(p.prevHash.begin(), p.prevHash.end()));
std::vector<unsigned char> height = std::vector<unsigned char>(4);
for (int i = 0; i < 4; i++)
{
height[i] = (p.blkHeight >> (8 * i)) & 0xff;
}
vData.push_back(height);
COptCCParams ccp = COptCCParams(COptCCParams::VERSION, EVAL_STAKEGUARD, 1, 2, vPubKeys, vData);
vout.scriptPubKey << ccp.AsVector() << OP_DROP;
return true;
}
return false;
}
bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTransaction &stakeTx, bool &cheating)
{
// an invalid or non-matching stake transaction cannot cheat
cheating = false;
//printf("ValidateMatchingStake: ccTx.vin[0].prevout.hash: %s, ccTx.vin[0].prevout.n: %d\n", ccTx.vin[0].prevout.hash.GetHex().c_str(), ccTx.vin[0].prevout.n);
if (ccTx.IsCoinBase())
{
CStakeParams p;
if (ValidateStakeTransaction(stakeTx, p))
{
std::vector<std::vector<unsigned char>> vParams = std::vector<std::vector<unsigned char>>();
CScript dummy;
if (ccTx.vout[voutNum].scriptPubKey.IsPayToCryptoCondition(&dummy, vParams) && vParams.size() > 0)
{
COptCCParams ccp = COptCCParams(vParams[0]);
if (ccp.IsValid() & ccp.vData.size() >= 3 && ccp.vData[2].size() <= 4)
{
CVerusHashWriter hw = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
hw << stakeTx.vin[0].prevout.hash;
hw << stakeTx.vin[0].prevout.n;
uint256 utxo = hw.GetHash();
uint32_t height = 0;
int i, dataLen = ccp.vData[2].size();
for (i = dataLen - 1; i >= 0; i--)
{
height = (height << 8) + ccp.vData[2][i];
}
// for debugging strange issue
// printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen);
if (utxo == uint256(ccp.vData[0]))
{
if (p.prevHash != uint256(ccp.vData[1]) && p.blkHeight >= height)
{
cheating = true;
return true;
}
// if block height is equal and we are at the else, prevHash must have been equal
else if (p.blkHeight == height)
{
return true;
}
}
}
}
}
}
return false;
}

View File

@@ -570,7 +570,7 @@ std::string Faucet2Fund(struct CCcontract_info *cp,uint64_t txfee,int64_t funds)
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
cclibpk = GetUnspendable(cp,0);
if ( AddNormalinputs(mtx,mypk,funds+txfee,64) > 0 )
if ( AddNormalinputs2(mtx,funds+txfee,64) > 0 )
{
mtx.vout.push_back(MakeCC1vout(cp->evalcode,funds,cclibpk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,opret));

View File

@@ -461,30 +461,32 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C
else return 0;
}
std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment, uint256 tokenid)
UniValue ChannelOpen(const CPubKey& pk, uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment, uint256 tokenid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
uint8_t hash[32],hashdest[32]; uint64_t amount,tokens=0,funds; int32_t i; uint256 hashchain,entropy,hentropy;
CPubKey mypk; struct CCcontract_info *cp,*cpTokens,C,CTokens;
if ( numpayments <= 0 || payment <= 0 || numpayments > CHANNELS_MAXPAYMENTS )
{
CCerror = strprintf("invalid ChannelOpen param numpayments.%d max.%d payment.%lld\n",numpayments,CHANNELS_MAXPAYMENTS,(long long)payment);
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid ChannelOpen param numpayments." << numpayments << " payment." << payment << " - max_numpayments." << CHANNELS_MAXPAYMENTS);
if (!destpub.IsFullyValid())
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid destination pubkey");
if (numpayments <1)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid number of payments, must be greater than 0");
if (payment <1)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid payment amount, must be greater than 0");
cp = CCinit(&C,EVAL_CHANNELS);
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
funds = numpayments * payment;
if (tokenid!=zeroid)
{
amount=AddNormalinputs(mtx,mypk,txfee+2*CC_MARKER_VALUE,5);
amount=AddNormalinputs(mtx,mypk,txfee+2*CC_MARKER_VALUE,5,pk.IsValid());
tokens=AddTokenCCInputs(cpTokens, mtx, mypk, tokenid, funds, 64);
}
else amount=AddNormalinputs(mtx,mypk,funds+txfee+2*CC_MARKER_VALUE,64);
else amount=AddNormalinputs(mtx,mypk,funds+txfee+2*CC_MARKER_VALUE,64,pk.IsValid());
if (amount+tokens >= funds+txfee+2*CC_MARKER_VALUE)
{
hentropy = DiceHashEntropy(entropy,mtx.vin[0].prevout.hash,mtx.vin[0].prevout.n,1);
@@ -500,14 +502,12 @@ std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64
mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,mypk));
mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,destpub));
if (tokenid!=zeroid && tokens>funds) mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS,tokens-funds,mypk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeChannelsOpRet('O',tokenid,zeroid,mypk,destpub,numpayments,payment,hashchain)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeChannelsOpRet('O',tokenid,zeroid,mypk,destpub,numpayments,payment,hashchain)));
}
CCerror = strprintf("error adding funds");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding funds");
}
std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint256 secret)
UniValue ChannelPayment(const CPubKey& pk, uint64_t txfee,uint256 opentxid,int64_t amount, uint256 secret)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,srcpub,destpub; uint256 txid,hashchain,gensecret,hashblock,entropy,hentropy,prevtxid,param3,tokenid;
@@ -519,41 +519,23 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
cp = CCinit(&C,EVAL_CHANNELS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
{
CCerror = strprintf("invalid channel open txid");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if (amount <1)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid payment amount, must be greater than 0");
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open txid");
if ((numvouts=channelOpenTx.vout.size()) > 0 && DecodeChannelsOpRet(channelOpenTx.vout[numvouts-1].scriptPubKey, tokenid, txid, srcpub, destpub, totalnumpayments, payment, hashchain)=='O')
{
if (mypk != srcpub && mypk != destpub)
{
CCerror = strprintf("this is not our channel");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (mypk != srcpub && mypk != destpub)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "this is not our channel");
else if (amount % payment != 0 || amount<payment)
{
CCerror = strprintf("invalid amount, not a magnitude of payment size");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid amount, not a magnitude of payment size");
else if (mypk == destpub && secret==zeroid) CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid secret, secret is necessary when making payment from destination");
}
else
{
CCerror = strprintf("invalid channel open tx");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
if (komodo_txnotarizedconfirmed(opentxid)==false)
{
CCerror = strprintf("channelsopen tx not yet confirmed/notarized");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3) > 0)
else
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open tx");
if (komodo_txnotarizedconfirmed(opentxid)==false) CCERR_RESULT("channelscc",CCLOG_INFO, stream << "channelsopen tx not yet confirmed/notarized");
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3,pk.IsValid()) > 0)
{
if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && (change=funds-amount)>=0)
{
@@ -563,16 +545,9 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
(funcid == 'P' || funcid=='O'))
{
if (numpayments > prevdepth)
{
CCerror = strprintf("not enough funds in channel for that amount");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
} else if (numpayments == 0)
{
CCerror = strprintf("invalid amount");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "not enough funds in channel for that amount");
else if (numpayments == 0)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid amount");
if (secret!=zeroid)
{
endiancpy(hash, (uint8_t * ) & secret, 32);
@@ -582,12 +557,7 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
memcpy(hash, hashdest, 32);
}
endiancpy((uint8_t * ) & gensecret, hashdest, 32);
if (gensecret!=hashchain)
{
CCerror = strprintf("invalid secret supplied");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (gensecret!=hashchain) CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid secret supplied");
}
else
{
@@ -605,33 +575,23 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
else endiancpy((uint8_t * ) & secret, (uint8_t * ) & hentropy, 32);
}
}
else
{
CCerror = strprintf("invalid previous tx");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
else
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid previous tx");
if (tokenid!=zeroid) mtx.vout.push_back(MakeTokensCC1of2vout(EVAL_CHANNELS, change, srcpub, destpub));
else mtx.vout.push_back(MakeCC1of2vout(EVAL_CHANNELS, change, srcpub, destpub));
mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,srcpub));
mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,destpub));
if (tokenid!=zeroid) mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS, amount, destpub));
else mtx.vout.push_back(CTxOut(amount, CScript() << ParseHex(HexStr(destpub)) << OP_CHECKSIG));
return (FinalizeCCTx(0, cp, mtx, mypk, txfee, EncodeChannelsOpRet('P', tokenid, opentxid, srcpub, destpub, prevdepth-numpayments, numpayments, secret)));
}
else
{
CCerror = strprintf("error adding CC inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
return (FinalizeCCTxExt(pk.IsValid(), 0, cp, mtx, mypk, txfee, EncodeChannelsOpRet('P', tokenid, opentxid, srcpub, destpub, prevdepth-numpayments, numpayments, secret)));
}
else
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding CC inputs");
}
CCerror = strprintf("error adding normal inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string ChannelClose(uint64_t txfee,uint256 opentxid)
UniValue ChannelClose(const CPubKey& pk, uint64_t txfee,uint256 opentxid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,srcpub,destpub; struct CCcontract_info *cp,C;
@@ -644,32 +604,16 @@ std::string ChannelClose(uint64_t txfee,uint256 opentxid)
cp = CCinit(&C,EVAL_CHANNELS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
{
CCerror = strprintf("invalid channel open txid");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open txid");
if ((numvouts=channelOpenTx.vout.size()) < 1 || DecodeChannelsOpRet(channelOpenTx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,numpayments,payment,hashchain)!='O')
{
CCerror = strprintf("invalid channel open tx");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open tx");
if (komodo_txnotarizedconfirmed(opentxid)==false)
{
CCerror = strprintf("channelsopen tx not yet confirmed/notarized");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream <<"channelsopen tx not yet confirmed/notarized");
if (mypk != srcpub)
{
CCerror = strprintf("cannot close, you are not channel owner");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3) > 0 )
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "cannot close, you are not channel owner");
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3,pk.IsValid()) > 0 )
{
if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && funds>0)
{
@@ -680,18 +624,12 @@ std::string ChannelClose(uint64_t txfee,uint256 opentxid)
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeChannelsOpRet('C',tokenid,opentxid,mypk,destpub,funds/payment,payment,zeroid)));
}
else
{
CCerror = strprintf("error adding CC inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding CC inputs");
}
CCerror = strprintf("error adding normal inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
UniValue ChannelRefund(const CPubKey& pk, uint64_t txfee,uint256 opentxid,uint256 closetxid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk; struct CCcontract_info *cp,C; int64_t funds,payment,param2;
@@ -704,56 +642,24 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
cp = CCinit(&C,EVAL_CHANNELS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if (myGetTransaction(closetxid,channelCloseTx,hashblock) == 0)
{
CCerror = strprintf("invalid channel close txid");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel close txid");
if ((numvouts=channelCloseTx.vout.size()) < 1 || DecodeChannelsOpRet(channelCloseTx.vout[numvouts-1].scriptPubKey,tokenid,txid,srcpub,destpub,param1,param2,param3)!='C')
{
CCerror = strprintf("invalid channel close tx");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel close tx");
if (komodo_txnotarizedconfirmed(closetxid)==false)
{
CCerror = strprintf("channelsclose tx not yet confirmed/notarized");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "channelsclose tx not yet confirmed/notarized");
if (txid!=opentxid)
{
CCerror = strprintf("open and close txid are not from same channel");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "open and close txid are not from same channel");
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
{
CCerror = strprintf("invalid channel open txid");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open txid");
if (komodo_txnotarizedconfirmed(opentxid)==false)
{
CCerror = strprintf("channelsopen tx not yet confirmed/notarized");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "channelsopen tx not yet confirmed/notarized");
if ((numvouts=channelOpenTx.vout.size()) < 1 || DecodeChannelsOpRet(channelOpenTx.vout[numvouts-1].scriptPubKey,tokenid,txid,srcpub,destpub,numpayments,payment,hashchain)!='O')
{
CCerror = strprintf("invalid channel open tx");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return ("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "invalid channel open tx");
if (mypk != srcpub)
{
CCerror = strprintf("cannot refund, you are not the channel owner");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3) > 0 )
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "cannot refund, you are not the channel owner");
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,3,pk.IsValid()) > 0 )
{
if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && funds>0)
{
@@ -767,32 +673,22 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeChannelsOpRet('R',tokenid,opentxid,mypk,destpub,funds/payment,payment,closetxid)));
}
else
{
CCerror = strprintf("previous tx is invalid");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "previous tx is invalid");
}
else
{
CCerror = strprintf("error adding CC inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding CC inputs");
}
CCerror = strprintf("error adding normal inputs");
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("channelscc",CCLOG_INFO, stream << "error adding normal inputs");
}
UniValue ChannelsList()
UniValue ChannelsList(const CPubKey& pk)
{
UniValue result(UniValue::VOBJ); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock,tmp_txid,param3,tokenid;
CTransaction tx; char myCCaddr[65],addr[65],str[256]; CPubKey mypk,srcpub,destpub; int32_t vout,numvouts,param1;
CTransaction tx; char myCCaddr[65],str[512],pub[34]; CPubKey mypk,srcpub,destpub; int32_t vout,numvouts,param1;
int64_t nValue,param2;
cp = CCinit(&C,EVAL_CHANNELS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
GetCCaddress(cp,myCCaddr,mypk);
SetCCtxids(txids,myCCaddr,true,EVAL_CHANNELS,zeroid,'O');
result.push_back(Pair("result","success"));
@@ -804,8 +700,7 @@ UniValue ChannelsList()
{
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O')
{
GetCCaddress1of2(cp,addr,srcpub,destpub);
sprintf(str,"%s - %lld payments of %lld satoshi",addr,(long long)param1,(long long)param2);
sprintf(str,"%lld payments of %lld satoshi to %s",(long long)param1,(long long)param2,pubkey33_str(pub,(uint8_t *)&destpub));
result.push_back(Pair(txid.GetHex().data(),str));
}
}
@@ -813,7 +708,7 @@ UniValue ChannelsList()
return(result);
}
UniValue ChannelsInfo(uint256 channeltxid)
UniValue ChannelsInfo(const CPubKey& pk,uint256 channeltxid)
{
UniValue result(UniValue::VOBJ),array(UniValue::VARR); CTransaction tx,opentx; uint256 txid,tmp_txid,hashBlock,param3,opentxid,hashchain,tokenid;
struct CCcontract_info *cp,C; char CCaddr[65],addr[65],str[512]; int32_t vout,numvouts,param1,numpayments;
@@ -821,7 +716,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
std::vector<uint256> txids; std::vector<CTransaction> txs;
cp = CCinit(&C,EVAL_CHANNELS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if (myGetTransaction(channeltxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 &&
(DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,opentxid,srcpub,destpub,param1,param2,param3) == 'O'))

View File

@@ -62,7 +62,7 @@ UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
if ( txfee == 0 )
txfee = CUSTOM_TXFEE;
mypk = pubkey2pk(Mypubkey());
if ( AddNormalinputs(mtx,mypk,COIN+txfee,64) >= COIN+txfee ) // add utxo to mtx
if ( AddNormalinputs2(mtx,COIN+txfee,64) >= COIN+txfee ) // add utxo to mtx
{
// make op_return payload as normal.
CScript opret = custom_opret('1',mypk);

View File

@@ -15,12 +15,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <memory.h>
#include "cJSON.c"
bits256 zeroid;
void myprintf(const char* format, ...)
{
va_list marker;
va_start( marker, format );
vfprintf(stdout, format, marker);
fflush(stdout);
va_end( marker );
}
char hexbyte(int32_t c)
{
c &= 0xf;
@@ -64,7 +74,7 @@ int32_t unhex(char c)
int32_t hex;
if ( (hex= _unhex(c)) < 0 )
{
//printf("unhex: illegal hexchar.(%c)\n",c);
//myprintf("unhex: illegal hexchar.(%c)\n",c);
}
return(hex);
}
@@ -74,7 +84,7 @@ unsigned char _decode_hex(char *hex) { return((unhex(hex[0])<<4) | unhex(hex[1])
int32_t decode_hex(unsigned char *bytes,int32_t n,char *hex)
{
int32_t adjust,i = 0;
//printf("decode.(%s)\n",hex);
//myprintf("decode.(%s)\n",hex);
if ( is_hexstr(hex,n) <= 0 )
{
memset(bytes,0,n);
@@ -89,7 +99,7 @@ int32_t decode_hex(unsigned char *bytes,int32_t n,char *hex)
if ( n > 0 )
{
bytes[0] = unhex(hex[0]);
printf("decode_hex n.%d hex[0] (%c) -> %d hex.(%s) [n*2+1: %d] [n*2: %d %c] len.%ld\n",n,hex[0],bytes[0],hex,hex[n*2+1],hex[n*2],hex[n*2],(long)strlen(hex));
myprintf("decode_hex n.%d hex[0] (%c) -> %d hex.(%s) [n*2+1: %d] [n*2: %d %c] len.%ld\n",n,hex[0],bytes[0],hex,hex[n*2+1],hex[n*2],hex[n*2],(long)strlen(hex));
}
bytes++;
hex++;
@@ -116,10 +126,10 @@ int32_t init_hexbytes_noT(char *hexbytes,unsigned char *message,long len)
{
hexbytes[i*2] = hexbyte((message[i]>>4) & 0xf);
hexbytes[i*2 + 1] = hexbyte(message[i] & 0xf);
//printf("i.%d (%02x) [%c%c]\n",i,message[i],hexbytes[i*2],hexbytes[i*2+1]);
//myprintf("i.%d (%02x) [%c%c]\n",i,message[i],hexbytes[i*2],hexbytes[i*2+1]);
}
hexbytes[len*2] = 0;
//printf("len.%ld\n",len*2+1);
//myprintf("len.%ld\n",len*2+1);
return((int32_t)len*2+1);
}
@@ -143,7 +153,7 @@ char *clonestr(char *str)
char *clone;
if ( str == 0 || str[0]==0)
{
printf("warning cloning nullstr.%p\n",str);
myprintf("warning cloning nullstr.%p\n",str);
//#ifdef __APPLE__
// while ( 1 ) sleep(1);
//#endif
@@ -165,8 +175,8 @@ int32_t safecopy(char *dest,char *src,long len)
dest[i] = src[i];
if ( i == len )
{
printf("safecopy: %s too long %ld\n",src,len);
//printf("divide by zero! %d\n",1/zeroval());
myprintf("safecopy: %s too long %ld\n",src,len);
//myprintf("divide by zero! %d\n",1/zeroval());
#ifdef __APPLE__
//getchar();
#endif
@@ -236,7 +246,7 @@ void *loadfile(char *fname,uint8_t **bufp,long *lenp,long *allocsizep)
{
fclose(fp);
*lenp = 0;
//printf("loadfile null size.(%s)\n",fname);
//myprintf("loadfile null size.(%s)\n",fname);
return(0);
}
if ( filesize > buflen )
@@ -246,17 +256,17 @@ void *loadfile(char *fname,uint8_t **bufp,long *lenp,long *allocsizep)
}
rewind(fp);
if ( buf == 0 )
printf("Null buf ???\n");
myprintf("Null buf ???\n");
else
{
if ( fread(buf,1,(long)filesize,fp) != (unsigned long)filesize )
printf("error reading filesize.%ld\n",(long)filesize);
myprintf("error reading filesize.%ld\n",(long)filesize);
buf[filesize] = 0;
}
fclose(fp);
*lenp = filesize;
//printf("loaded.(%s)\n",buf);
} //else printf("OS_loadfile couldnt load.(%s)\n",fname);
//myprintf("loaded.(%s)\n",buf);
} //else myprintf("OS_loadfile couldnt load.(%s)\n",fname);
return(buf);
}
@@ -284,7 +294,7 @@ cJSON *get_urljson(char *url,char *fname)
char *jsonstr; cJSON *json = 0;
if ( (jsonstr= send_curl(url,fname)) != 0 )
{
//printf("(%s) -> (%s)\n",url,jsonstr);
//myprintf("(%s) -> (%s)\n",url,jsonstr);
json = cJSON_Parse(jsonstr);
free(jsonstr);
}
@@ -303,7 +313,7 @@ uint64_t get_btcusd()
if ( (bpi= jobj(pjson,"bpi")) != 0 && (usd= jobj(bpi,"USD")) != 0 )
{
btcusd = jdouble(usd,"rate_float") * SATOSHIDEN;
printf("BTC/USD %.4f\n",dstr(btcusd));
myprintf("BTC/USD %.4f\n",dstr(btcusd));
}
free_json(pjson);
}
@@ -319,13 +329,13 @@ cJSON *get_cli(char *refcoin,char **retstrp,char *acname,char *method,char *arg0
if ( acname[0] != 0 )
{
if ( refcoin[0] == 0 )
printf("must supply reference coin\n");
myprintf("must supply reference coin\n");
sprintf(cmdstr,"./komodo-cli -ac_name=%s %s %s %s %s %s > %s 2>/tmp/oraclefeed.error\n",acname,method,arg0,arg1,arg2,arg3,fname);
}
else if ( REFCOIN_CLI != 0 && REFCOIN_CLI[0] != 0 )
{
sprintf(cmdstr,"%s %s %s %s %s %s > %s 2>/tmp/oraclefeed.error\n",REFCOIN_CLI,method,arg0,arg1,arg2,arg3,fname);
//printf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr);
//myprintf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr);
}
#ifdef TESTMODE
fprintf(stderr,"cmd: %s\n",cmdstr);
@@ -355,7 +365,7 @@ bits256 broadcasttx(char *refcoin,char *acname,cJSON *hexjson)
{
if ( (retjson= get_cli(refcoin,&retstr,acname,"sendrawtransaction",hexstr,"","","")) != 0 )
{
if (strcmp("error",jstr(retjson,"result"))==0) printf("%s\n",jstr(retjson,"error"));
if (strcmp("error",jstr(retjson,"result"))==0) myprintf("%s\n",jstr(retjson,"error"));
free_json(retjson);
}
else if ( retstr != 0 )
@@ -457,7 +467,7 @@ cJSON *get_gatewayspending(int8_t type,char *refcoin,char *acname,char *bindtxid
else if (type==1) sprintf(function,"%s","importgatewaypendingwithdraws");
if ( (retjson= get_cli(refcoin,&retstr,acname,function,bindtxidstr,refcoin,"","")) != 0 )
{
//printf("pending.(%s)\n",jprint(retjson,0));
//myprintf("pending.(%s)\n",jprint(retjson,0));
return(retjson);
}
else if ( retstr != 0 )
@@ -476,7 +486,7 @@ cJSON *get_gatewaysprocessed(int8_t type,char *refcoin,char *acname,char *bindtx
else if (type==1) sprintf(function,"%s","importgatewayprocessed");
if ( (retjson= get_cli(refcoin,&retstr,acname,function,bindtxidstr,refcoin,"","")) != 0 )
{
//printf("pending.(%s)\n",jprint(retjson,0));
//myprintf("pending.(%s)\n",jprint(retjson,0));
return(retjson);
}
else if ( retstr != 0 )
@@ -492,7 +502,7 @@ cJSON *get_rawmempool(char *refcoin,char *acname)
cJSON *retjson; char *retstr;
if ( (retjson= get_cli(refcoin,&retstr,acname,"getrawmempool","","","","")) != 0 )
{
//printf("mempool.(%s)\n",jprint(retjson,0));
//myprintf("mempool.(%s)\n",jprint(retjson,0));
return(retjson);
}
else if ( retstr != 0 )
@@ -507,11 +517,11 @@ cJSON *get_addressutxos(char *refcoin,char *acname,char *coinaddr)
{
cJSON *retjson; char *retstr,jsonbuf[256];
if ( refcoin[0] != 0 && strcmp(refcoin,"KMD") != 0 )
printf("warning: assumes %s has addressindex enabled\n",refcoin);
myprintf("warning: assumes %s has addressindex enabled\n",refcoin);
sprintf(jsonbuf,"{\\\"addresses\\\":[\\\"%s\\\"]}",coinaddr);
if ( (retjson= get_cli(refcoin,&retstr,acname,"getaddressutxos",jsonbuf,"","","")) != 0 )
{
//printf("addressutxos.(%s)\n",jprint(retjson,0));
//myprintf("addressutxos.(%s)\n",jprint(retjson,0));
return(retjson);
}
else if ( retstr != 0 )
@@ -561,7 +571,7 @@ void importaddress(char *refcoin,char *acname,char *depositaddr, char *label,int
else strcpy(rescanstr,"false");
if ( (retjson= get_cli(refcoin,&retstr,acname,"importaddress",depositaddr,label,rescanstr,"")) != 0 )
{
printf("importaddress.(%s)\n",jprint(retjson,0));
myprintf("importaddress.(%s)\n",jprint(retjson,0));
free_json(retjson);
}
else if ( retstr != 0 )
@@ -585,7 +595,7 @@ void addmultisigaddress(char *refcoin,char *acname,int32_t M, char *pubkeys)
{
sprintf(addr,"\"%s\"",retstr);
get_cli(refcoin,&retstr,acname,"importaddress",addr,"\"\"","false","");
printf("addmultisigaddress.(%s)\n",retstr);
myprintf("addmultisigaddress.(%s)\n",retstr);
free_json(retjson);
}
}
@@ -628,7 +638,7 @@ char *createrawtx(char *refcoin,char *acname,char *depositaddr,char *withdrawadd
else txfee = 10000;
if ( satoshis < txfee )
{
printf("createrawtx: satoshis %.8f < txfee %.8f\n",(double)satoshis/SATOSHIDEN,(double)txfee/SATOSHIDEN);
myprintf("createrawtx: satoshis %.8f < txfee %.8f\n",(double)satoshis/SATOSHIDEN,(double)txfee/SATOSHIDEN);
return(0);
}
sprintf(array,"\'[\"%s\"]\'",depositaddr);
@@ -655,26 +665,26 @@ char *createrawtx(char *refcoin,char *acname,char *depositaddr,char *withdrawadd
sprintf(argB,"\'%s\'",tmpB);
if ( (retjson2= get_cli(refcoin,&txstr,acname,"createrawtransaction",argA,argB,"","")) != 0 )
{
printf("createrawtx: unexpected JSON2.(%s)\n",jprint(retjson2,0));
myprintf("createrawtx: unexpected JSON2.(%s)\n",jprint(retjson2,0));
free_json(retjson2);
}
else if ( txstr == 0 )
printf("createrawtx: null txstr and JSON2\n");
myprintf("createrawtx: null txstr and JSON2\n");
free(tmpA);
free(tmpB);
free(argA);
free(argB);
}
else printf("not enough funds to create withdraw tx\n");
else myprintf("not enough funds to create withdraw tx\n");
}
free_json(retjson);
}
else if ( retstr != 0 )
{
printf("createrawtx: unexpected null JSON, retstr.(%s)\n",retstr);
myprintf("createrawtx: unexpected null JSON, retstr.(%s)\n",retstr);
free(retstr);
}
else printf("createrawtx: null retstr and JSON\n");
else myprintf("createrawtx: null retstr and JSON\n");
return(txstr);
}
@@ -694,7 +704,7 @@ cJSON *addsignature(char *refcoin,char *acname,char *rawtx, int M)
}
else if ( retstr != 0 )
{
printf("error parsing signrawtransaction.(%s)\n",retstr);
myprintf("error parsing signrawtransaction.(%s)\n",retstr);
free(retstr);
}
return(0);
@@ -708,13 +718,13 @@ bits256 gatewayspartialsign(int8_t type,char *refcoin,char *acname,bits256 txid,
if ( (retjson= get_cli(refcoin,&retstr,acname,function,bits256_str(str,txid),refcoin,hex,"")) != 0 )
{
if (strcmp("error",jstr(retjson,"result"))!=0) txid=broadcasttx(refcoin,acname,retjson);
else printf("%s\n",jstr(retjson,"error"));
else myprintf("%s\n",jstr(retjson,"error"));
free(retjson);
return (txid);
}
else if ( retstr != 0 )
{
printf("error parsing gatewayspartialsing.(%s)\n",retstr);
myprintf("error parsing gatewayspartialsing.(%s)\n",retstr);
free(retstr);
}
return (zeroid);
@@ -729,13 +739,13 @@ bits256 gatewayscompletesigning(int8_t type,char *refcoin,char *acname,bits256 w
if ( (retjson= get_cli(refcoin,&retstr,acname,function,bits256_str(str,withtxid),refcoin,hex,"")) != 0 )
{
if (strcmp("error",jstr(retjson,"result"))!=0) txid=broadcasttx(refcoin,acname,retjson);
else printf("%s\n",jstr(retjson,"error"));
else myprintf("%s\n",jstr(retjson,"error"));
free(retjson);
return (txid);
}
else if ( retstr != 0 )
{
printf("error parsing gatewayscompletesigning.(%s)\n",retstr);
myprintf("error parsing gatewayscompletesigning.(%s)\n",retstr);
free(retstr);
}
return (zeroid);
@@ -750,13 +760,13 @@ bits256 gatewaysmarkdone(int8_t type,char *refcoin,char *acname,bits256 withtxid
if ( (retjson= get_cli(refcoin,&retstr,acname,function,bits256_str(str,withtxid),refcoin,"","")) != 0 )
{
if (strcmp("error",jstr(retjson,"result"))!=0) txid=broadcasttx(refcoin,acname,retjson);
else printf("%s\n",jstr(retjson,"error"));
else myprintf("%s\n",jstr(retjson,"error"));
free(retjson);
return (txid);
}
else if ( retstr != 0 )
{
printf("error parsing gatewaysmarkdone.(%s)\n",retstr);
myprintf("error parsing gatewaysmarkdone.(%s)\n",retstr);
free(retstr);
}
return (zeroid);
@@ -778,7 +788,7 @@ int32_t get_gatewaysinfo(int8_t type,char *refcoin,char *acname,char *depositadd
*Mp = jint(retjson,"M");
*Np = jint(retjson,"N");
}
else printf("coin.%s vs %s\n",jstr(retjson,"coin"),coin);
else myprintf("coin.%s vs %s\n",jstr(retjson,"coin"),coin);
if ((pubarray=jarray(&n,retjson,"pubkeys"))!=0)
{
*pubkeys=malloc((sizeof(char)*70*n)+64);
@@ -797,7 +807,7 @@ int32_t get_gatewaysinfo(int8_t type,char *refcoin,char *acname,char *depositadd
}
else if ( retstr != 0 )
{
printf("error parsing get_gatewaysinfo.(%s)\n",retstr);
myprintf("error parsing get_gatewaysinfo.(%s)\n",retstr);
free(retstr);
}
if ( *Mp <= 0 || *Np <= 0 )
@@ -1049,10 +1059,10 @@ int32_t main(int32_t argc,char **argv)
cJSON *clijson,*clijson2,*regjson,*item; int32_t type,i,retval,M,N,n,height,prevheight = 0; char *pubkeys,*format,*acname,*oraclestr,*bindtxidstr,*pkstr,*pubstr,*retstr,*retstr2,depositaddr[64],hexstr[4096],refcoin[64]; uint64_t price; bits256 txid;
if ( argc < 6 )
{
printf("usage: oraclefeed $ACNAME $ORACLETXID $MYPUBKEY $FORMAT $BINDTXID [refcoin_cli]\n");
myprintf("usage: oraclefeed $ACNAME $ORACLETXID $MYPUBKEY $FORMAT $BINDTXID [refcoin_cli]\n");
return(-1);
}
printf("Powered by CoinDesk (%s) %.8f\n","https://www.coindesk.com/price/",dstr(get_btcusd()));
myprintf("Powered by CoinDesk (%s) %.8f\n","https://www.coindesk.com/price/",dstr(get_btcusd()));
acname = argv[1];
oraclestr = argv[2];
pkstr = argv[3];
@@ -1063,7 +1073,7 @@ int32_t main(int32_t argc,char **argv)
else REFCOIN_CLI = "./komodo-cli";
if ( strncmp(format,"Ihh",3) != 0 && format[0] != 'L' )
{
printf("only formats of L and Ihh are supported now\n");
myprintf("only formats of L and Ihh are supported now\n");
return(-1);
}
M = N = 0;
@@ -1078,7 +1088,7 @@ int32_t main(int32_t argc,char **argv)
strcpy(refcoin,jstr(clijson,"name"));
if ( strcmp("KMD",refcoin) != 0 && argc != 7 )
{
printf("need to specify path to refcoin's cli as last argv\n");
myprintf("need to specify path to refcoin's cli as last argv\n");
exit(0);
}
pubkeys=0;
@@ -1086,7 +1096,7 @@ int32_t main(int32_t argc,char **argv)
else if ( get_gatewaysinfo(1,refcoin,acname,depositaddr,&M,&N,bindtxidstr,refcoin,oraclestr,&pubkeys) == 0 ) type=1;
else
{
printf("cant find bindtxid.(%s)\n",bindtxidstr);
myprintf("cant find bindtxid.(%s)\n",bindtxidstr);
exit(0);
}
if (validateaddress(refcoin,"",depositaddr,"iswatchonly")==0 && validateaddress(refcoin,"",depositaddr,"ismine")==0)
@@ -1095,7 +1105,7 @@ int32_t main(int32_t argc,char **argv)
else addmultisigaddress(refcoin,"",M,pubkeys);
}
if (pubkeys!=0) free(pubkeys);
printf("set refcoin %s <- %s [%s] M.%d of N.%d\n",depositaddr,refcoin,REFCOIN_CLI,M,N);
myprintf("set refcoin %s <- %s [%s] M.%d of N.%d\n",depositaddr,refcoin,REFCOIN_CLI,M,N);
}
if ( (regjson= jarray(&n,clijson,"registered")) != 0 )
{
@@ -1112,14 +1122,14 @@ int32_t main(int32_t argc,char **argv)
if ( bits256_nonz(txid) != 0 )
{
prevheight = height;
printf("%s ht.%d <- %s\n",refcoin,height,hexstr);
myprintf("%s ht.%d <- %s\n",refcoin,height,hexstr);
update_gatewayspending(type,refcoin,acname,bindtxidstr,M,N);
}
free_json(clijson2);
}
else if ( retstr2 != 0 )
{
printf("error parsing oraclesdata.(%s)\n",retstr2);
myprintf("error parsing oraclesdata.(%s)\n",retstr2);
free(retstr2);
}
}
@@ -1131,7 +1141,7 @@ int32_t main(int32_t argc,char **argv)
}
if ( retstr != 0 )
{
printf("got json parse error.(%s)\n",retstr);
myprintf("got json parse error.(%s)\n",retstr);
free(retstr);
}
sleep(10);

View File

@@ -1,4 +1,3 @@
// Copyright 2019 The Hush developers
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@@ -37,6 +36,7 @@
* there should be a code identifying it. For example,
* a possible code is EVAL_BITCOIN_SCRIPT, where the entire binary
* after the code is interpreted as a bitcoin script.
* Verus EVAL_STAKEGUARD is 0x01
*/
#define FOREACH_EVAL(EVAL) \
EVAL(EVAL_IMPORTPAYOUT, 0xe1) \

View File

@@ -172,20 +172,20 @@ int64_t AddFaucetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub
if ( (total > 0 && totalinputs >= total) || (maxinputs > 0 && n >= maxinputs) )
break;
} else fprintf(stderr,"vout.%d nValue %.8f too small or already spent in mempool\n",vout,(double)nValue/COIN);
} else fprintf(stderr,"couldnt get tx\n");
} else fprintf(stderr,"couldn't get tx\n");
}
return(totalinputs);
}
std::string FaucetGet(uint64_t txfee)
UniValue FaucetGet(const CPubKey& pk, uint64_t txfee)
{
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,faucetpk; int64_t inputs,CCchange=0,nValue=FAUCETSIZE; struct CCcontract_info *cp,C; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
CPubKey faucetpk; int64_t inputs,CCchange=0,nValue=FAUCETSIZE; struct CCcontract_info *cp,C; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
cp = CCinit(&C,EVAL_FAUCET);
if ( txfee == 0 )
txfee = 10000;
faucetpk = GetUnspendable(cp,0);
mypk = pubkey2pk(Mypubkey());
CPubKey mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if ( (inputs= AddFaucetInputs(cp,mtx,faucetpk,nValue+txfee,60)) > 0 )
{
if ( inputs > nValue )
@@ -198,42 +198,40 @@ std::string FaucetGet(uint64_t txfee)
for (i=0; i<1000000; i++,j++)
{
tmpmtx = mtx;
rawhex = FinalizeCCTx(-1LL,cp,tmpmtx,mypk,txfee,CScript() << OP_RETURN << E_MARSHAL(ss << (uint8_t)EVAL_FAUCET << (uint8_t)'G' << j));
if ( (len= (int32_t)rawhex.size()) > 0 && len < 65536 )
UniValue result = FinalizeCCTxExt(pk.IsValid (),-1LL,cp,tmpmtx,mypk,txfee,CScript() << OP_RETURN << E_MARSHAL(ss << (uint8_t)EVAL_FAUCET << (uint8_t)'G' << j));
if ( (len= (int32_t)result[JSON_HEXTX].getValStr().size()) > 0 && len < 65536 )
{
len >>= 1;
decode_hex(buf,len,(char *)rawhex.c_str());
decode_hex(buf,len,(char *)result[JSON_HEXTX].getValStr().c_str());
hash = bits256_doublesha256(0,buf,len);
if ( (hash.bytes[0] & 0xff) == 0 && (hash.bytes[31] & 0xff) == 0 )
{
fprintf(stderr,"found valid txid after %d iterations %u\n",i,(uint32_t)time(NULL));
return(rawhex);
return result;
}
//fprintf(stderr,"%02x%02x ",hash.bytes[0],hash.bytes[31]);
}
}
fprintf(stderr,"couldnt generate valid txid %u\n",(uint32_t)time(NULL));
return("");
} else fprintf(stderr,"cant find faucet inputs\n");
return("");
CCERR_RESULT("faucet",CCLOG_ERROR, stream << "couldn't generate valid txid " << (uint32_t)time(NULL));
} else CCERR_RESULT("faucet",CCLOG_ERROR, stream << "can't find faucet inputs");
}
std::string FaucetFund(uint64_t txfee,int64_t funds)
UniValue FaucetFund(const CPubKey& pk, uint64_t txfee,int64_t funds)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,faucetpk; CScript opret; struct CCcontract_info *cp,C;
CPubKey faucetpk; CScript opret; struct CCcontract_info *cp,C;
cp = CCinit(&C,EVAL_FAUCET);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
CPubKey mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
faucetpk = GetUnspendable(cp,0);
if ( AddNormalinputs(mtx,mypk,funds+txfee,64) > 0 )
if ( AddNormalinputs(mtx,mypk,funds+txfee,64,pk.IsValid()) > 0 )
{
mtx.vout.push_back(MakeCC1vout(EVAL_FAUCET,funds,faucetpk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,opret));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,opret));
}
return("");
CCERR_RESULT("faucet",CCLOG_ERROR, stream << "can't find normal inputs");
}
UniValue FaucetInfo()

View File

@@ -862,12 +862,12 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
return(0);
}
std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4)
UniValue GatewaysBind(const CPubKey& pk, uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CTransaction oracletx; uint8_t taddr,prefix,prefix2,wiftype; CPubKey mypk,gatewayspk; CScript opret; uint256 hashBlock;
struct CCcontract_info *cp,*cpTokens,C,CTokens; std::string name,description,format; int32_t i,numvouts; int64_t fullsupply;
char destaddr[64],coinaddr[64],myTokenCCaddr[64],str[65],*fstr;
char destaddr[64],coinaddr[64],myTokenCCaddr[64],*fstr;
cp = CCinit(&C,EVAL_GATEWAYS);
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
@@ -887,118 +887,64 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t
LOGSTREAM("gatewayscc",CCLOG_DEBUG1, stream << "set prefix " << prefix << ", prefix2 " << prefix2 << ", wiftype " << wiftype << ", taddr " << taddr << " for " << coin << std::endl);
}
if ( N == 0 || N > 15 || M > N )
{
CCerror = strprintf("illegal M.%d or N.%d",M,N);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "illegal M." << M << " or N." << N);
if ( pubkeys.size() != N )
{
CCerror = strprintf("M.%d N.%d but pubkeys[%d]",M,N,(int32_t)pubkeys.size());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "M."<< M << " N." << N << " but pubkeys[" <<( int32_t)pubkeys.size() << "]");
for (i=0; i<N; i++)
{
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkeys[i])) << OP_CHECKSIG);
if ( CCaddress_balance(coinaddr,0) == 0 )
{
CCerror = strprintf("M.%d N.%d but pubkeys[%d] has no balance",M,N,i);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "M." << M << " N." << N << " but pubkeys[" << i << "] has no balance");
}
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
_GetCCaddress(myTokenCCaddr,EVAL_TOKENS,mypk);
gatewayspk = GetUnspendable(cp,0);
if ( _GetCCaddress(destaddr,EVAL_GATEWAYS,gatewayspk) == 0 )
{
CCerror = strprintf("Gateway bind.%s (%s) cant create globaladdr",coin.c_str(),uint256_str(str,tokenid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "Gateway bind." << coin << " (" << tokenid.GetHex() << ") cant create globaladdr");
if ( (fullsupply=CCfullsupply(tokenid)) != totalsupply )
{
CCerror = strprintf("Gateway bind.%s (%s) globaladdr.%s totalsupply %.8f != fullsupply %.8f",coin.c_str(),uint256_str(str,tokenid),cp->unspendableCCaddr,(double)totalsupply/COIN,(double)fullsupply/COIN);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "Gateway bind." << coin << " ("<< tokenid.GetHex() << ") globaladdr." <<cp->unspendableCCaddr << " totalsupply " << (double)totalsupply/COIN << " != fullsupply " << (double)fullsupply/COIN);
if ( CCtoken_balance(myTokenCCaddr,tokenid) != totalsupply )
{
CCerror = strprintf("token balance on %s %.8f != %.8f",myTokenCCaddr,(double)CCtoken_balance(myTokenCCaddr,tokenid)/COIN,(double)totalsupply/COIN);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "token balance on " << myTokenCCaddr << " " << (double)CCtoken_balance((char *)myTokenCCaddr,tokenid)/COIN << "!=" << (double)totalsupply/COIN);
if ( myGetTransaction(oracletxid,oracletx,hashBlock) == 0 || (numvouts= oracletx.vout.size()) <= 0 )
{
CCerror = strprintf("cant find oracletxid %s",uint256_str(str,oracletxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) != 'C' )
{
CCerror = strprintf("mismatched oracle name %s != %s",name.c_str(),coin.c_str());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "mismatched oracle name " << name << " != " << coin);
if ( (fstr=(char *)format.c_str()) == 0 || strncmp(fstr,"Ihh",3) != 0 )
{
CCerror = strprintf("illegal format (%s) != (%s)",fstr,(char *)"Ihh");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "illegal format (" << fstr << ") != (Ihh)");
if ( GatewaysBindExists(cp,gatewayspk,tokenid) != 0 )
{
CCerror = strprintf("Gateway bind.%s (%s) already exists",coin.c_str(),uint256_str(str,tokenid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2) > 0 )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "Gateway bind." << coin << " (" << tokenid.GetHex() << ") already exists");
if ( AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2,pk.IsValid()) > 0 )
{
if (AddTokenCCInputs(cpTokens, mtx, mypk, tokenid, totalsupply, 64)>0)
{
mtx.vout.push_back(MakeTokensCC1vout(cp->evalcode,totalsupply,gatewayspk));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,gatewayspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysBindOpRet('B',tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysBindOpRet('B',tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)));
}
}
CCerror = strprintf("cant find enough inputs");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find enough inputs");
}
std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount)
UniValue GatewaysDeposit(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CTransaction bindtx; CPubKey mypk; uint256 oracletxid,merkleroot,mhash,hashBlock,tokenid,txid;
CTransaction tx; CPubKey mypk; uint256 oracletxid,merkleroot,mhash,hashBlock,tokenid,txid;
int64_t totalsupply; int32_t i,m,n,numvouts; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::string coin; struct CCcontract_info *cp,C;
std::vector<CPubKey> pubkeys,publishers; std::vector<uint256>txids; char str[67],depositaddr[64],txidaddr[64];
std::vector<CPubKey> pubkeys,publishers; std::vector<uint256>txids; char str[65],depositaddr[64],txidaddr[64];
cp = CCinit(&C,EVAL_GATEWAYS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
LOGSTREAM("gatewayscc",CCLOG_DEBUG1, stream << "GatewaysDeposit ht." << height << " " << refcoin << " " << (double)amount/COIN << " numpks." << (int32_t)pubkeys.size() << std::endl);
if ( myGetTransaction(bindtxid,bindtx,hashBlock) == 0 || (numvouts= bindtx.vout.size()) <= 0 )
{
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( DecodeGatewaysBindOpRet(depositaddr,bindtx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B' || refcoin != coin )
{
CCerror = strprintf("invalid coin - bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find bindtxid " << bindtxid.GetHex());
if ( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B' || refcoin != coin )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid coin - bindtxid " << bindtxid.GetHex() << " coin." << coin);
if (komodo_txnotarizedconfirmed(bindtxid)==false)
{
CCerror = strprintf("gatewaysbind tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewaysbind tx not yet confirmed/notarized");
n = (int32_t)pubkeys.size();
merkleroot = zeroid;
for (i=m=0; i<n; i++)
@@ -1017,141 +963,80 @@ std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::
}
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << "cointxid." << cointxid.GetHex() << " m." << m << " of n." << n << std::endl);
if ( merkleroot == zeroid || m < n/2 )
{
CCerror = strprintf("couldnt find merkleroot for ht.%d %s oracle.%s m.%d vs n.%d",height,coin.c_str(),uint256_str(str,oracletxid),m,n);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "couldnt find merkleroot for ht." << height << " " << coin << " oracle." << oracletxid.GetHex() << " m." << m << " vs n." << n);
if ( CCCointxidExists("gatewayscc-1",cointxid) != 0 )
{
CCerror = strprintf("cointxid.%s already exists",uint256_str(str,cointxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cointxid." << cointxid.GetHex() << " already exists");
if ( GatewaysVerify(depositaddr,oracletxid,claimvout,coin,cointxid,deposithex,proof,merkleroot,destpub,taddr,prefix,prefix2) != amount )
{
CCerror = strprintf("deposittxid didnt validate");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( AddNormalinputs(mtx,mypk,txfee+2*CC_MARKER_VALUE,3) > 0 )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "deposittxid didnt validate");
if ( AddNormalinputs(mtx,mypk,txfee+2*CC_MARKER_VALUE,3,pk.IsValid()) > 0 )
{
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,destpub));
mtx.vout.push_back(CTxOut(CC_MARKER_VALUE,CScript() << ParseHex(HexStr(CCtxidaddr(txidaddr,cointxid))) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysDepositOpRet('D',bindtxid,coin,publishers,txids,height,cointxid,claimvout,deposithex,proof,destpub,amount)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysDepositOpRet('D',bindtxid,coin,publishers,txids,height,cointxid,claimvout,deposithex,proof,destpub,amount)));
}
CCerror = strprintf("cant find enough inputs");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find enough inputs");
}
std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount)
UniValue GatewaysClaim(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CTransaction tx; CPubKey mypk,gatewayspk,tmpdestpub; struct CCcontract_info *cp,C; uint8_t M,N,taddr,prefix,prefix2,wiftype;
std::string coin, deposithex; std::vector<CPubKey> msigpubkeys,publishers; int64_t totalsupply,depositamount,tmpamount,inputs,CCchange=0;
std::string coin, deposithex; std::vector<CPubKey> pubkeys,publishers; int64_t totalsupply,depositamount,tmpamount,inputs,CCchange=0;
int32_t numvouts,claimvout,height; std::vector<uint8_t> proof;
uint256 hashBlock,tokenid,oracletxid,tmptxid,cointxid; char str[65],depositaddr[64],coinaddr[64],destaddr[64]; std::vector<uint256> txids;
uint256 hashBlock,tokenid,oracletxid,tmptxid,cointxid; char depositaddr[64],coinaddr[64],destaddr[64]; std::vector<uint256> txids;
cp = CCinit(&C,EVAL_GATEWAYS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
{
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,msigpubkeys,taddr,prefix,prefix2,wiftype) != 'B' || coin != refcoin )
{
CCerror = strprintf("invalid coin - bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find bindtxid " << bindtxid.GetHex());
if ( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B' || refcoin != coin )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid coin - bindtxid " << bindtxid.GetHex() << " coin." << coin);
if (komodo_txnotarizedconfirmed(bindtxid)==false)
{
CCerror = strprintf("gatewaysbind tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewaysbind tx not yet confirmed/notarized");
if ( myGetTransaction(deposittxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
{
CCerror = strprintf("cant find deposittxid %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find deposittxid " << bindtxid.GetHex());
if (DecodeGatewaysDepositOpRet(tx.vout[numvouts-1].scriptPubKey,tmptxid,coin,publishers,txids,height,cointxid,claimvout,deposithex,proof,tmpdestpub,tmpamount) != 'D' || coin != refcoin)
{
CCerror = strprintf("invalid coin - deposittxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid coin - deposittxid " << bindtxid.GetHex() << " coin." << coin);
if (komodo_txnotarizedconfirmed(deposittxid)==false)
{
CCerror = strprintf("gatewaysdeposit tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewaysdeposit tx not yet confirmed/notarized");
if (tmpdestpub!=destpub)
{
CCerror = strprintf("different destination pubkey from desdeposit tx");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "different destination pubkey from desdeposit tx");
if ( (depositamount=GatewaysDepositval(tx,mypk)) != amount )
{
CCerror = strprintf("invalid Gateways deposittxid %s %.8f != %.8f",uint256_str(str,deposittxid),(double)depositamount/COIN,(double)amount/COIN);
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid Gateways deposittxid " << deposittxid.GetHex() << " " << (double)depositamount/COIN << " != " << (double)amount/COIN << ", remember claim must be done from destination pubkey from deposit tx!");
if ((inputs=AddGatewaysInputs(cp, mtx, gatewayspk, bindtxid, amount, 60)) > 0)
{
if ( inputs > amount ) CCchange = (inputs - amount);
mtx.vin.push_back(CTxIn(deposittxid,0,CScript()));
mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS,amount,destpub));
if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount)));
}
CCerror = strprintf("cant find enough tokens in gateways address for given amount");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find enough tokens in gateways address for given amount");
}
std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount)
UniValue GatewaysWithdraw(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CTransaction tx; CPubKey mypk,gatewayspk,signerpk; uint256 txid,tokenid,hashBlock,oracletxid,tmptokenid,tmpbindtxid,withdrawtxid; int32_t vout,numvouts;
int64_t nValue,totalsupply,inputs,CCchange=0,tmpamount; uint8_t funcid,K,M,N,taddr,prefix,prefix2,wiftype; std::string coin,hex;
std::vector<CPubKey> msigpubkeys; char depositaddr[64],str[65],coinaddr[64]; struct CCcontract_info *cp,C,*cpTokens,CTokens;
std::vector<CPubKey> pubkeys; char depositaddr[64],coinaddr[64]; struct CCcontract_info *cp,C,*cpTokens,CTokens;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
cp = CCinit(&C,EVAL_GATEWAYS);
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp, 0);
if( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
{
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,msigpubkeys,taddr,prefix,prefix2,wiftype) != 'B' || coin != refcoin )
{
CCerror = strprintf("invalid bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str());
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find bindtxid " << bindtxid.GetHex());
if ( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B' || refcoin != coin )
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid coin - bindtxid " << bindtxid.GetHex() << " coin." << coin);
if (komodo_txnotarizedconfirmed(bindtxid)==false)
{
CCerror = strprintf("gatewaysbind tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewaysbind tx not yet confirmed/notarized");
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
SetCCunspents(unspentOutputs,coinaddr,true);
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
@@ -1165,23 +1050,14 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
{
if (funcid=='W' && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
&& refcoin==coin && tmptokenid==tokenid && tmpbindtxid==bindtxid)
{
CCerror = strprintf("unable to create withdraw, another withdraw pending");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "unable to create withdraw, another withdraw pending");
else if (funcid=='P' && DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)=='P' &&
myGetTransaction(withdrawtxid,tx,hashBlock)!=0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
&& refcoin==coin && tmptokenid==tokenid && tmpbindtxid==bindtxid)
{
CCerror = strprintf("unable to create withdraw, another withdraw pending");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "unable to create withdraw, another withdraw pending");
}
}
if( AddNormalinputs(mtx, mypk, txfee+CC_MARKER_VALUE, 2) > 0 )
if( AddNormalinputs(mtx, mypk, txfee+CC_MARKER_VALUE, 2,pk.IsValid()) > 0 )
{
if ((inputs = AddTokenCCInputs(cpTokens, mtx, mypk, tokenid, amount, 60)) > 0)
{
@@ -1189,286 +1065,159 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
mtx.vout.push_back(MakeCC1vout(EVAL_GATEWAYS,CC_MARKER_VALUE,gatewayspk));
mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,amount,gatewayspk));
if ( CCchange != 0 ) mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS, CCchange, mypk));
return(FinalizeCCTx(0, cpTokens, mtx, mypk, txfee,EncodeGatewaysWithdrawOpRet('W',tokenid,bindtxid,refcoin,withdrawpub,amount)));
return(FinalizeCCTxExt(pk.IsValid(),0, cpTokens, mtx, mypk, txfee,EncodeGatewaysWithdrawOpRet('W',tokenid,bindtxid,refcoin,withdrawpub,amount)));
}
else
{
CCerror = strprintf("not enough balance of tokens for withdraw");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "not enough balance of tokens for withdraw");
}
CCerror = strprintf("cant find enough normal inputs");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cant find enough normal inputs");
}
std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refcoin, std::string hex)
UniValue GatewaysPartialSign(const CPubKey& pk, uint64_t txfee,uint256 lasttxid,std::string refcoin, std::string hex)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,withdrawpub,signerpk,gatewayspk; struct CCcontract_info *cp,C; CTransaction tx,tmptx;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; char funcid,str[65],depositaddr[64];
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; char funcid,depositaddr[64];
int32_t numvouts; uint256 withdrawtxid,hashBlock,bindtxid,tokenid,oracletxid,tmptokenid; std::string coin,tmphex; int64_t amount,totalsupply;
uint8_t K=0,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
cp = CCinit(&C,EVAL_GATEWAYS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|| (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
{
CCerror = strprintf("can't find last tx %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find last tx " << lasttxid.GetHex());
if (funcid=='W')
{
withdrawtxid=lasttxid;
if (DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin)
{
CCerror = strprintf("invalid withdraw tx %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid withdraw tx " << lasttxid.GetHex());
else if (komodo_txnotarizedconfirmed(withdrawtxid)==false)
{
CCerror = strprintf("gatewayswithdraw tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewayswithdraw tx not yet confirmed/notarized");
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
{
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find bind tx " << bindtxid.GetHex());
else if (DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B'
|| refcoin!=coin || tokenid!=tmptokenid)
{
CCerror = strprintf("invalid bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid bind tx " << bindtxid.GetHex());
}
else if (funcid=='P')
{
if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,tmphex)!='P' || refcoin!=coin)
{
CCerror = strprintf("cannot decode partialsign tx opret %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cannot decode partialsign tx opret " << lasttxid.GetHex());
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0)
{
CCerror = strprintf("can't find withdraw tx %s",uint256_str(str,withdrawtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find withdraw tx " << withdrawtxid.GetHex());
else if (DecodeGatewaysWithdrawOpRet(tmptx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W'
|| refcoin!=coin)
{
CCerror = strprintf("invalid withdraw tx %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid withdraw tx " << withdrawtxid.GetHex());
else if (komodo_txnotarizedconfirmed(withdrawtxid)==false)
{
CCerror = strprintf("gatewayswithdraw tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewayswithdraw tx not yet confirmed/notarized");
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
{
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find bind tx " << bindtxid.GetHex());
else if (DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B'
|| refcoin!=coin || tokenid!=tmptokenid)
{
CCerror = strprintf("invalid bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid bind tx " << bindtxid.GetHex());
}
if (AddNormalinputs(mtx,mypk,txfee,1)!=0)
if (AddNormalinputs(mtx,mypk,txfee,1,pk.IsValid())!=0)
{
mtx.vin.push_back(CTxIn(tx.GetHash(),0,CScript()));
mtx.vout.push_back(MakeCC1vout(EVAL_GATEWAYS,CC_MARKER_VALUE,gatewayspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysPartialOpRet('P',withdrawtxid,refcoin,K+1,mypk,hex)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysPartialOpRet('P',withdrawtxid,refcoin,K+1,mypk,hex)));
}
CCerror = strprintf("error adding funds for partialsign");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "error adding funds for partialsign");
}
std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string refcoin,std::string hex)
UniValue GatewaysCompleteSigning(const CPubKey& pk, uint64_t txfee,uint256 lasttxid,std::string refcoin,std::string hex)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,gatewayspk,signerpk,withdrawpub; struct CCcontract_info *cp,C; char funcid,str[65],depositaddr[64]; int64_t amount,totalsupply;
CPubKey mypk,gatewayspk,signerpk,withdrawpub; struct CCcontract_info *cp,C; char funcid,depositaddr[64]; int64_t amount,totalsupply;
std::string coin,tmphex; CTransaction tx,tmptx; uint256 withdrawtxid,hashBlock,tokenid,tmptokenid,bindtxid,oracletxid; int32_t numvouts;
uint8_t K=0,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
cp = CCinit(&C,EVAL_GATEWAYS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
if ( txfee == 0 )
txfee = 10000;
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|| (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
{
CCerror = strprintf("invalid last txid %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid last txid " << lasttxid.GetHex());
if (funcid=='W')
{
withdrawtxid=lasttxid;
if (DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin)
{
CCerror = strprintf("cannot decode withdraw tx opret %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
{
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid withdraw tx " << lasttxid.GetHex());
else if (komodo_txnotarizedconfirmed(withdrawtxid)==false)
{
CCerror = strprintf("gatewayswithdraw tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewayswithdraw tx not yet confirmed/notarized");
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find bind tx " << bindtxid.GetHex());
else if (DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B'
|| refcoin!=coin || tokenid!=tmptokenid)
{
CCerror = strprintf("invalid bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid bind tx " << bindtxid.GetHex());
}
else if (funcid=='P')
{
if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,tmphex)!='P' || refcoin!=coin)
{
CCerror = strprintf("cannot decode partialsign tx opret %s",uint256_str(str,lasttxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())==0)
{
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
else if (DecodeGatewaysWithdrawOpRet(tmptx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin)
{
CCerror = strprintf("cannot decode withdraw tx opret %s",uint256_str(str,withdrawtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,tmphex)!='P' || refcoin!=coin)
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cannot decode partialsign tx opret " << lasttxid.GetHex());
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0)
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find withdraw tx " << withdrawtxid.GetHex());
else if (DecodeGatewaysWithdrawOpRet(tmptx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W'
|| refcoin!=coin)
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid withdraw tx " << withdrawtxid.GetHex());
else if (komodo_txnotarizedconfirmed(withdrawtxid)==false)
{
CCerror = strprintf("gatewayswithdraw tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewayswithdraw tx not yet confirmed/notarized");
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
{
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find bind tx " << bindtxid.GetHex());
else if (DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B'
|| refcoin!=coin || tokenid!=tmptokenid)
{
CCerror = strprintf("invalid bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid bind tx " << bindtxid.GetHex());
}
if (AddNormalinputs(mtx,mypk,txfee,1)!=0)
if (AddNormalinputs(mtx,mypk,txfee,1,pk.IsValid())!=0)
{
mtx.vin.push_back(CTxIn(lasttxid,0,CScript()));
mtx.vout.push_back(MakeCC1vout(EVAL_GATEWAYS,CC_MARKER_VALUE,gatewayspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysCompleteSigningOpRet('S',withdrawtxid,refcoin,K+1,hex)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysCompleteSigningOpRet('S',withdrawtxid,refcoin,K+1,hex)));
}
CCerror = strprintf("error adding funds for completesigning");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "error adding funds for completesigning");
}
std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string refcoin)
UniValue GatewaysMarkDone(const CPubKey& pk, uint64_t txfee,uint256 completetxid,std::string refcoin)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk; struct CCcontract_info *cp,C; char str[65],depositaddr[64]; CTransaction tx; int32_t numvouts;
CPubKey mypk; struct CCcontract_info *cp,C; char depositaddr[64]; CTransaction tx; int32_t numvouts;
uint256 withdrawtxid,bindtxid,oracletxid,tokenid,tmptokenid,hashBlock; std::string coin,hex;
uint8_t K,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; int64_t amount,totalsupply; CPubKey withdrawpub;
cp = CCinit(&C,EVAL_GATEWAYS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if ( txfee == 0 )
txfee = 10000;
if (myGetTransaction(completetxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0)
{
CCerror = strprintf("invalid completesigning txid %s",uint256_str(str,completetxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid completesigning txid " << completetxid.GetHex());
else if (DecodeGatewaysCompleteSigningOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,hex)!='S' || refcoin!=coin)
{
CCerror = strprintf("cannot decode completesigning tx opret %s",uint256_str(str,completetxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cannot decode completesigning tx opret " << completetxid.GetHex());
if (komodo_txnotarizedconfirmed(completetxid)==false)
{
CCerror = strprintf("gatewayscompletesigning tx not yet confirmed/notarized");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "gatewayscompletesigning tx not yet confirmed/notarized");
else if (myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())==0)
{
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid withdraw txid " << withdrawtxid.GetHex());
else if (DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin)
{
CCerror = strprintf("cannot decode withdraw tx opret %s\n",uint256_str(str,withdrawtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "cannot decode withdraw tx opret " << withdrawtxid.GetHex());
else if (myGetTransaction(bindtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "can't find bind tx " << bindtxid.GetHex());
else if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B'
|| refcoin!=coin || tokenid!=tmptokenid)
{
CCerror = strprintf("invalid bind tx %s",uint256_str(str,bindtxid));
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (AddNormalinputs(mtx,mypk,txfee,1)!=0)
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "invalid bind tx " << bindtxid.GetHex());
if (AddNormalinputs(mtx,mypk,txfee,1,pk.IsValid())!=0)
{
mtx.vin.push_back(CTxIn(completetxid,0,CScript()));
mtx.vout.push_back(CTxOut(CC_MARKER_VALUE,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysMarkDoneOpRet('M',withdrawtxid,refcoin,completetxid)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeGatewaysMarkDoneOpRet('M',withdrawtxid,refcoin,completetxid)));
}
CCerror = strprintf("error adding funds for markdone");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("gatewayscc",CCLOG_INFO, stream << "error adding funds for markdone");
}
UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
UniValue GatewaysPendingDeposits(const CPubKey& pk, uint256 bindtxid,std::string refcoin)
{
UniValue result(UniValue::VOBJ),pending(UniValue::VARR); CTransaction tx; std::string coin,hex,pub;
CPubKey mypk,gatewayspk,destpub; std::vector<CPubKey> pubkeys,publishers; std::vector<uint256> txids;
@@ -1478,7 +1227,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
cp = CCinit(&C,EVAL_GATEWAYS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
_GetCCaddress(coinaddr,EVAL_GATEWAYS,mypk);
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
@@ -1523,7 +1272,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
return(result);
}
UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
UniValue GatewaysPendingWithdraws(const CPubKey& pk, uint256 bindtxid,std::string refcoin)
{
UniValue result(UniValue::VOBJ),pending(UniValue::VARR); CTransaction tx; std::string coin,hex; CPubKey mypk,gatewayspk,withdrawpub,signerpk;
std::vector<CPubKey> msigpubkeys; uint256 hashBlock,tokenid,txid,tmpbindtxid,tmptokenid,oracletxid,withdrawtxid; uint8_t K,M,N,taddr,prefix,prefix2,wiftype;
@@ -1532,7 +1281,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
cp = CCinit(&C,EVAL_GATEWAYS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
GetTokensCCaddress(cp,tokensaddr,gatewayspk);
@@ -1611,7 +1360,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
return(result);
}
UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
UniValue GatewaysProcessedWithdraws(const CPubKey& pk, uint256 bindtxid,std::string refcoin)
{
UniValue result(UniValue::VOBJ),processed(UniValue::VARR); CTransaction tx; std::string coin,hex;
CPubKey mypk,gatewayspk,withdrawpub; std::vector<CPubKey> msigpubkeys;
@@ -1621,7 +1370,7 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
cp = CCinit(&C,EVAL_GATEWAYS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
gatewayspk = GetUnspendable(cp,0);
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )

View File

@@ -628,72 +628,79 @@ template <typename Helper> UniValue _HeirFund(int64_t txfee, int64_t amount, std
CPubKey myPubkey = pubkey2pk(Mypubkey());
if (AddNormalinputs(mtx, myPubkey, markerfee, 3) > 0) {
int64_t inputs, change;
if ((inputs=Helper::addOwnerInputs(tokenid, mtx, myPubkey, amount, (int32_t)64)) > 0) {
mtx.vout.push_back(Helper::make1of2Vout(amount, myPubkey, heirPubkey));
// add a marker for finding all plans in HeirList()
// TODO: change marker either to cc or normal txidaddr unspendable
struct CCcontract_info *cpHeir, heirC;
cpHeir = CCinit(&heirC, EVAL_HEIR);
CPubKey heirUnspendablePubKey = GetUnspendable(cpHeir, 0);
// mtx.vout.push_back(CTxOut(txfee, CScript() << ParseHex(HexStr(heirUnspendablePubKey)) << OP_CHECKSIG)); <-- bad marker cause it was spendable by anyone
mtx.vout.push_back(MakeCC1vout(EVAL_HEIR, markerfee, heirUnspendablePubKey)); // this marker spending is disabled in the validation code
// calc and add change vout:
if (inputs > amount)
change = (inputs - amount); // -txfee <-- txfee pays user
//std::cerr << "HeirFund() inputs=" << inputs << " amount=" << amount << " txfee=" << txfee << " change=" << change << '\n';
if (change != 0) { // vout[1]
mtx.vout.push_back(Helper::makeUserVout(change, myPubkey));
}
// check owner pubkey in vins
bool hasMypubkey = false;
bool hasNotMypubkey = false;
CheckVinPubkey(mtx.vin, myPubkey, hasMypubkey, hasNotMypubkey);
// for initial funding do not allow to sign by non-owner key:
if (hasNotMypubkey) {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "using non-owner inputs not allowed"));
return result;
}
// add 1of2 vout validation pubkeys:
std::vector<CPubKey> voutTokenPubkeys;
voutTokenPubkeys.push_back(myPubkey);
voutTokenPubkeys.push_back(heirPubkey);
// add change for txfee and opreturn vouts and sign tx:
std::string rawhextx = FinalizeCCTx(0, cp, mtx, myPubkey, txfee,
Helper::makeCreateOpRet(tokenid, voutTokenPubkeys, myPubkey, heirPubkey, inactivityTimeSec, heirName, memo));
if (!rawhextx.empty()) {
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", rawhextx));
}
else {
std::cerr << "HeirAdd error in FinalizeCCtx" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "sign error"));
}
}
else { // TODO: need result return unification with heiradd and claim
std::cerr << "HeirFund() could not find owner cc inputs" << std::endl;
if (!tokenid.IsNull()) // add normals only for tokens
{
if (AddNormalinputs(mtx, myPubkey, txfee + markerfee, 4) < txfee + markerfee)
{
std::cerr << "HeirFund() could not find normal inputs for txfee" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "could not find owner cc inputs"));
result.push_back(Pair("error", "could not find normal inputs for txfee"));
return result;
}
}
else {
std::cerr << "HeirFund() could not find normal inputs" << std::endl;
int64_t inputs;
int64_t addAmount = tokenid.IsNull() ? (txfee + markerfee + amount) : amount; // for coins add txfee markerfee amount in one call
if ((inputs=Helper::addOwnerInputs(tokenid, mtx, myPubkey, addAmount, (int32_t)64)) >= addAmount)
{
mtx.vout.push_back(Helper::make1of2Vout(amount, myPubkey, heirPubkey));
// add a marker for finding all plans in HeirList()
// TODO: change marker either to cc or normal txidaddr unspendable
struct CCcontract_info *cpHeir, heirC;
cpHeir = CCinit(&heirC, EVAL_HEIR);
CPubKey heirUnspendablePubKey = GetUnspendable(cpHeir, 0);
// mtx.vout.push_back(CTxOut(txfee, CScript() << ParseHex(HexStr(heirUnspendablePubKey)) << OP_CHECKSIG)); <-- bad marker cause it was spendable by anyone
mtx.vout.push_back(MakeCC1vout(EVAL_HEIR, markerfee, heirUnspendablePubKey)); // this marker spending is disabled in the validation code
if (!tokenid.IsNull())
{
int64_t ccChange = 0;
// calc and add token change vout:
if (inputs > amount)
ccChange = (inputs - amount); // -txfee <-- txfee pays user
//std::cerr << "HeirFund() inputs=" << inputs << " amount=" << amount << " txfee=" << txfee << " change=" << change << '\n';
if (ccChange != 0)
mtx.vout.push_back(Helper::makeUserVout(ccChange, myPubkey));
}
// check owner pubkey in vins
bool hasMypubkey = false;
bool hasNotMypubkey = false;
CheckVinPubkey(mtx.vin, myPubkey, hasMypubkey, hasNotMypubkey);
// for initial funding do not allow to sign by non-owner key:
if (hasNotMypubkey) {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "using non-owner inputs not allowed"));
return result;
}
// add 1of2 vout token validation pubkeys - used only for tokens
std::vector<CPubKey> voutTokenPubkeys;
voutTokenPubkeys.push_back(myPubkey);
voutTokenPubkeys.push_back(heirPubkey);
// add change for txfee and opreturn vouts and sign tx:
std::string rawhextx = FinalizeCCTx(0, cp, mtx, myPubkey, txfee,
Helper::makeCreateOpRet(tokenid, voutTokenPubkeys, myPubkey, heirPubkey, inactivityTimeSec, heirName, memo));
if (!rawhextx.empty()) {
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", rawhextx));
}
else {
std::cerr << "HeirAdd error in FinalizeCCtx" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "sign error"));
}
}
else { // TODO: need result return unification with heiradd and claim
std::cerr << "HeirFund() could not find owner inputs for amount (normal inputs for coins, cc inputs for tokens)" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "could not find normal inputs"));
result.push_back(Pair("error", "could not find owner inputs"));
}
return result;
}
@@ -716,7 +723,6 @@ template <class Helper> UniValue _HeirAdd(uint256 fundingtxid, int64_t txfee, in
{
UniValue result(UniValue::VOBJ);
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
int64_t inputs, CCchange = 0;
struct CCcontract_info *cp, C;
std::string rawhex;
@@ -736,89 +742,93 @@ template <class Helper> UniValue _HeirAdd(uint256 fundingtxid, int64_t txfee, in
return result;
}
if (AddNormalinputs(mtx, myPubkey, markerfee, 3) > 0) { // some for marker
int64_t inputs, change;
if ((inputs = Helper::addOwnerInputs(tokenid, mtx, myPubkey, amount, 64)) > 0) { // TODO: why 64 max inputs?
// we do not use markers anymore - storing data in opreturn is better
// add marker vout:
/* char markeraddr[64];
CPubKey markerpubkey = CCtxidaddr(markeraddr, fundingtxid);
mtx.vout.push_back(CTxOut(txfee, CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG)); // txfee 1, txfee 2 - for miners
std::cerr << "HeirAdd() adding markeraddr=" << markeraddr << '\n'; */
// add cryptocondition to spend this funded amount for either pk
mtx.vout.push_back(Helper::make1of2Vout(amount, ownerPubkey, heirPubkey));
if (!tokenid.IsNull()) // add normals only for tokens
{
if (AddNormalinputs(mtx, myPubkey, txfee + markerfee, 4) < txfee + markerfee)
{
std::cerr << "HeirFund() could not find normal inputs for txfee" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "could not find normal inputs for txfee"));
return result;
}
}
char markeraddr[64];
CPubKey markerPubkey = CCtxidaddr(markeraddr, fundingtxid);
mtx.vout.push_back(CTxOut(markerfee, CScript() << ParseHex(HexStr(markerPubkey)) << OP_CHECKSIG)); // marker to prevent archiving of the funds add vouts
int64_t inputs;
int64_t addAmount = tokenid.IsNull() ? (txfee + markerfee + amount) : amount; // for coins add txfee markerfee amount in one call
if ((inputs = Helper::addOwnerInputs(tokenid, mtx, myPubkey, addAmount, 64)) >= addAmount) { // TODO: why 64 max inputs?
// we do not use markers anymore - storing data in opreturn is better
// add marker vout:
/* char markeraddr[64];
CPubKey markerpubkey = CCtxidaddr(markeraddr, fundingtxid);
mtx.vout.push_back(CTxOut(txfee, CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG)); // txfee 1, txfee 2 - for miners
std::cerr << "HeirAdd() adding markeraddr=" << markeraddr << '\n'; */
// add cryptocondition to spend this funded amount for either pk
mtx.vout.push_back(Helper::make1of2Vout(amount, ownerPubkey, heirPubkey));
char markeraddr[64];
CPubKey markerPubkey = CCtxidaddr(markeraddr, fundingtxid);
mtx.vout.push_back(CTxOut(markerfee, CScript() << ParseHex(HexStr(markerPubkey)) << OP_CHECKSIG)); // marker to prevent archiving of the funds add vouts
if (!tokenid.IsNull())
{
int64_t ccChange = 0;
if (inputs > amount)
change = (inputs - amount); // -txfee <-- txfee pays user
ccChange = (inputs - amount); // -txfee <-- txfee pays user
//std::cerr << "HeirAdd() inputs=" << inputs << " amount=" << amount << " txfee=" << txfee << " change=" << change << '\n';
if (change != 0) { // vout[1]
mtx.vout.push_back(Helper::makeUserVout(change, myPubkey));
}
// check owner pubkey in vins
bool hasMypubkey = false;
bool hasNotMypubkey = false;
CheckVinPubkey(mtx.vin, myPubkey, hasMypubkey, hasNotMypubkey);
// for additional funding do not allow to sign by both owner and non-owner keys (is this a donation or not?):
if (hasMypubkey && hasNotMypubkey) {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "using both owner and non-owner inputs is not allowed"));
return result;
}
// warn the user he's making a donation if this is all non-owner keys:
if (hasNotMypubkey) {
result.push_back(Pair("result", "warning"));
result.push_back(Pair("warning", "you are about to make a donation to heir fund"));
}
else {
result.push_back(Pair("result", "success"));
}
// add 1of2 vout validation pubkeys - needed only for tokens:
std::vector<CPubKey> voutTokenPubkeys;
voutTokenPubkeys.push_back(ownerPubkey);
voutTokenPubkeys.push_back(heirPubkey);
// add opreturn 'A' and sign tx: // this txfee ignored
std::string rawhextx = (FinalizeCCTx(0, cp, mtx, myPubkey, txfee,
Helper::makeAddOpRet(tokenid, voutTokenPubkeys, fundingtxid, hasHeirSpendingBegun)));
if (!rawhextx.empty()) {
result.push_back(Pair("hex", rawhextx));
}
else {
std::cerr << "HeirAdd error in FinalizeCCtx" << std::endl;
result.clear();
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "sign error"));
}
if (ccChange != 0)
mtx.vout.push_back(Helper::makeUserVout(ccChange, myPubkey));
}
else {
std::cerr << "HeirAdd cannot find owner cc inputs" << std::endl;
// check owner pubkey in vins
bool hasMypubkey = false;
bool hasNotMypubkey = false;
CheckVinPubkey(mtx.vin, myPubkey, hasMypubkey, hasNotMypubkey);
// for additional funding do not allow to sign by both owner and non-owner keys (is this a donation or not?):
if (hasMypubkey && hasNotMypubkey) {
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "using both owner and non-owner inputs is not allowed"));
return result;
}
// warn the user he's making a donation if this is all non-owner keys:
if (hasNotMypubkey) {
result.push_back(Pair("result", "warning"));
result.push_back(Pair("warning", "you are about to make a donation to heir fund"));
}
else {
result.push_back(Pair("result", "success"));
}
// add 1of2 vout validation pubkeys - needed only for tokens:
std::vector<CPubKey> voutTokenPubkeys;
voutTokenPubkeys.push_back(ownerPubkey);
voutTokenPubkeys.push_back(heirPubkey);
// add opreturn 'A' and sign tx:
std::string rawhextx = (FinalizeCCTx(0, cp, mtx, myPubkey, txfee,
Helper::makeAddOpRet(tokenid, voutTokenPubkeys, fundingtxid, hasHeirSpendingBegun)));
if (!rawhextx.empty()) {
result.push_back(Pair("hex", rawhextx));
}
else {
std::cerr << "HeirAdd error in FinalizeCCtx" << std::endl;
result.clear();
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "can't find owner cc inputs"));
result.push_back(Pair("error", "sign error"));
}
}
else {
std::cerr << "HeirAdd cannot find normal inputs for tx fee" << std::endl;
std::cerr << "HeirAdd cannot find owner inputs for amount (normal inputs for coins, cc inputs for tokens)" << std::endl;
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "can't find normal inputs for tx fee"));
}
result.push_back(Pair("error", "can't find owner inputs"));
}
return result;
}
@@ -833,10 +843,12 @@ UniValue HeirAddCaller(uint256 fundingtxid, int64_t txfee, std::string strAmount
std::string heirName, memo;
uint8_t hasHeirSpendingBegun = 0;
if ((latesttxid = FindLatestFundingTx(fundingtxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, heirName, memo, hasHeirSpendingBegun)) != zeroid) {
// get latest tx to see if it is a token or coin
if ((latesttxid = FindLatestFundingTx(fundingtxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, heirName, memo, hasHeirSpendingBegun)) != zeroid)
{
if (tokenid == zeroid) {
int64_t amount = (int64_t)(atof(strAmount.c_str()) * COIN);
if (amount <= 0) {
int64_t amount = 0;
if (!ParseFixedPoint(strAmount, 8, &amount) || amount <= 0 ) {
UniValue result(UniValue::VOBJ);
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "invalid amount"));
@@ -844,7 +856,8 @@ UniValue HeirAddCaller(uint256 fundingtxid, int64_t txfee, std::string strAmount
}
return _HeirAdd<CoinHelper>(fundingtxid, txfee, amount, latesttxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, hasHeirSpendingBegun);
}
else {
else
{
int64_t amount = atoll(strAmount.c_str());
if (amount <= 0) {
UniValue result(UniValue::VOBJ);
@@ -1003,15 +1016,18 @@ UniValue HeirClaimCaller(uint256 fundingtxid, int64_t txfee, std::string strAmou
std::string heirName, memo;
uint8_t hasHeirSpendingBegun = 0;
if ((latesttxid = FindLatestFundingTx(fundingtxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, heirName, memo, hasHeirSpendingBegun)) != zeroid) {
if (tokenid == zeroid) {
int64_t amount = (int64_t)(atof(strAmount.c_str()) * COIN);
if (amount < 0) {
UniValue result(UniValue::VOBJ);
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "invalid amount"));
return result;
}
// find latest tx to see if it is a token or coin:
if ((latesttxid = FindLatestFundingTx(fundingtxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, heirName, memo, hasHeirSpendingBegun)) != zeroid)
{
if (tokenid == zeroid)
{
int64_t amount = 0;
if (!ParseFixedPoint(strAmount, 8, &amount) || amount <= 0) { // using ParseFixedPoint instead atof to avoid round errors
UniValue result(UniValue::VOBJ);
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "invalid amount"));
return result;
}
return _HeirClaim<CoinHelper>(fundingtxid, txfee, amount, latesttxid, funcId, tokenid, ownerPubkey, heirPubkey, inactivityTimeSec, hasHeirSpendingBegun);
}
else {

View File

@@ -1,65 +0,0 @@
How this works:
- earlytxid must be a transaction included in the chain before block KOMODO_EARLYTXID_HEIGHT. The chain MUST not have any other of these type of tx before block KOMODO_EARLYTXID_HEIGHT, or someone may be able to change it and mess things up.
- When it gets to block KOMODO_EARLYTXID_HEIGHT, it takes the txid specified by the -earlytxid param (does not affect magic)
- Looks up the transaction searches for the opreturn, then permenantly appends it to the end of ac_script in RAM.
- After every daemon restart, the first time the daemon mines a block, or receives a block that pays ac_script it will look up the op_return and save it again.
- this enables it to always reach consensus but doesnt need to constantly keep looking up the tx in the chain.
- The trick is to use ac_founders=101 or higher so that nothing is ever paid to the unspendable CC address. Although it should still work without this it burns coins.
-ac_script can be any Global CC address you can spend to with an OP_RETURN. Here we use example of paymentsCC being used to fund a rewards plan, and a set of founders address's.
you can get the ac_script from another chain, but the op_return payload must generated on the chain itself. this command gives you the needed info to get the scripPubKey Hex:
./komodo-cli -ac_name=TEST paymentsfund '["5d536f54332db09f2be04593c54f764cf569e225f4d8df5155658c679e663682",1000]'
append: b8, to the end of ac_script, this changes magic value for -earlytxid chains vs normal ac_script and allows bypass of ac_supply paid to the scritpt as it would be unspendable and you would be unable to create the needed plans with no coins.
-ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8
-testnode=1 is not affecting magic and allows mining on a single node, we can use this to bootstrap the chain before syncing a second node to save time.
start chain and make sure to do the following steps before block 100 (set generate false/true is a good idea between steps)
./komodod -ac_name=TESTHC -ac_supply=1000000 -ac_reward=100000000000 -ac_cc=2 -ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8 -ac_founders=150 -ac_blocktime=20 -ac_nk=96,5 -testnode=1
create rewards plan and fund it with all or a % of the premine. Must be some amount. eg.
./komodo-cli -ac_name=TESTHC rewardscreatefunding test 50000 25 0 2 500
do rewards add funding:
./komodo-cli -ac_name=TESTHC rewardsaddfunding test 47a3150150bd196bd2086cae5e0c6b01a23785a04139fa660d169121a534b38e 1000
and get the script pubkey and op_return from this tx (no need to send it)
./komodo-cli -ac_name=TESTHC decoderawtransaction 010000000204ca4c7aaae62bb8fc9412ac010e047fa8d33c3f87d2adeb3e02170642ddfe370000000049483045022100d7b9a
4f28ca3a35f34dcdb6075e905cde1eaa962bd0619d0a8ed8e17e952bc99022077308e12325fc2a02c752ec3df9aeee1fc219ea54a4d3884834582b75c89815e01ffffffff08800132da3233d80c65e87b6db6a76dcf
188e4fdfa23198d69f647e67754cfb0000000049483045022100d6a8f7a1c4f6013f5897768ae0117fe61dfb72352d3e6652e64a6588db3ffcb102202aa1d041b24f9cbbf7028295b7c5e7f18b4f95ae39c13031dab
7f06634438e6801ffffffff0300e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccf0c0764817000000232103bbec93af84
0933ae2d35fc56eff24f34dbe26871402552f84c44f690945ccd79ac00000000000000002c6a2ae54174657374000000008eb334a52191160d66fa3941a08537a2016b0c5eae6c08d26b19bd500115a34700000000
From the return of this you need the scriptpubkey hex of vout 0:
scriptPubKey: 2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc
and the scriptpubkey hex of the OP_RETURN in vout 2.
OP_RETURN: 6a2ae54174657374000000008eb334a52191160d66fa3941a08537a2016b0c5eae6c08d26b19bd500115a347
create txidopreturn for this payment:
./komodo-cli -ac_name=TESTHC paymentstxidopret '[50,"2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc","6a2ae54174657374000000008eb334a52191160d66fa3941a08537a2016b0c5eae6c08d26b19bd500115a347"]'
create the txidopret for the founders reward(s) pubkeys: should be able to be a few here, not sure of max number yet. These can pay anything that does not need an opreturn. allocation and scriptpubkey hex.
./komodo-cli -ac_name=TESTHC paymentstxidopret '[50,"76a9146bf5dd9f679c87a3f83ea176f82148d26653c04388ac"]'
create payments plan:
./komodo-cli -ac_name=TESTHC paymentscreate '[0,0,"61f55f2f87dad3a37d42731a8cb73b3ebea1817abfa176218162c360a8bd7145","0550014823ffa0aa99d7dd7ca5292f4dd0a1b9156eddec03412c953f095181bc"]'
gives plan txid: ee7765be874fb084c00538b1b0488e8ecb857de253f09a9ba6ea8d3579b77d33
paymentsfund:
To do this you first need to change the type of tx generated by paymentsfund RPC. in payments.cpp go to line: 639 and comment it out, then uncomment the block of code under this.
change the line 646 to line 647 with comments, and line 650/651 aswell. This enables the RPC to generate the ccvout opreturn payload you need without sending the payment on the chain. Just decode the raw hex.
./komodo-cli -ac_name=TESTHC paymentsfund '["ee7765be874fb084c00538b1b0488e8ecb857de253f09a9ba6ea8d3579b77d33",1000,1]'
get the payment fund scriptpubkey hex from vout 0: (the split it at OP_CHECKCRYPTOCONDITION or 'cc' )
2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401cc 2a0401f00101246a22f046337db779358deaa69b9af053e27d85cb8e8e48b0b13805c084b04f87be6577ee75
put the second half into an OP_RETURN: (the remaining part of the the above scriptpubkey) eg.
./komodo-cli -ac_name=TESTHC opreturn_burn 1 2a0401f00101246a22f046337db779358deaa69b9af053e27d85cb8e8e48b0b13805c084b04f87be6577ee75
opret_burn takes any burn amount and arbitrary hex string. (RPC works, but may have bugs, likely use this for LABS too with some fixes)
this gives a raw hex. Decode it and check the OP_RETURN is right before sending.
-earlytxid=810bd62fb8353fad20267ff2050684b8829affa3edf6b366633931530791dfce
restart the chain with earlytxid param before height 100 on all nodes (if not using -testnode=1)
./komodod -ac_name=TESTHC -ac_supply=1000000 -ac_reward=100000000000 -ac_cc=2 -ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8 -ac_founders=150 -ac_blocktime=20 -ac_nk=96,5 -earlytxid=810bd62fb8353fad20267ff2050684b8829affa3edf6b366633931530791dfce
once the payments plan has been funded with the mined coinbase you can issue payments release when conditions of the plan are met to fund founders reward/rewards plan. eg.
./komodo-cli -ac_name=TESTHC paymentsrelease '["ee7765be874fb084c00538b1b0488e8ecb857de253f09a9ba6ea8d3579b77d33",500]'

View File

@@ -639,15 +639,15 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
else return(true);
}
int32_t GetLatestTimestamp(int32_t height)
/*nt32_t GetLatestTimestamp(int32_t height)
{
if ( KOMODO_NSPV_SUPERLITE ) return (NSPV_blocktime(height));
return(komodo_heightstamp(height));
}
} */
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
{
uint256 oracletxid,batontxid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; int64_t amount; uint256 hashblock;
uint256 oracletxid,batontxid,txid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; int64_t amount; uint256 hashblock;
uint8_t *script; std::vector<uint8_t> vopret,data; CPubKey publisher,tmppk,oraclespk; char tmpaddress[64],vinaddress[64],oraclesaddr[64];
CTransaction tmptx; std::string name,desc,format;
@@ -702,10 +702,16 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
return eval->Invalid("invalid marker for oraclescreate!");
else if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
return eval->Invalid("vin.0 is normal for oraclesregister!");
else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0
else if ((*cp->ismyvin)(tx.vin[1].scriptSig) == 0 && (*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0)
return eval->Invalid("there is no CC vin from oraclesfund tx");
else if ((*cp->ismyvin)(tx.vin[1].scriptSig) == 1 && (myGetTransaction(tx.vin[1].prevout.hash,tmptx,hashblock)==0 || DecodeOraclesOpRet(tmptx.vout[tmptx.vout.size()-1].scriptPubKey,txid,tmppk,amount)!='F'
|| tmptx.vout[tx.vin[1].prevout.n].nValue!=CC_MARKER_VALUE || !Getscriptaddress(vinaddress,tmptx.vout[tx.vin[1].prevout.n].scriptPubKey)
|| !GetCCaddress(cp,tmpaddress,tmppk) || strcmp(tmpaddress,vinaddress)!=0) || oracletxid!=txid)
return eval->Invalid("invalid vin.1 for oraclesregister, it must be CC vin or pubkey not same as vin pubkey, register and fund tx must be done from owner of pubkey that registers to oracle!!");
else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 1 && (myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0 || DecodeOraclesOpRet(tmptx.vout[tmptx.vout.size()-1].scriptPubKey,txid,tmppk,amount)!='F'
|| tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE || !Getscriptaddress(vinaddress,tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].scriptPubKey)
|| !GetCCaddress(cp,tmpaddress,tmppk) || strcmp(tmpaddress,vinaddress)!=0)
return eval->Invalid("vin."+std::to_string(tx.vin.size()-1)+" is CC for oraclesregister or pubkey not same as vin pubkey, register must be done from owner of pubkey that registers to oracle!!");
|| !GetCCaddress(cp,tmpaddress,tmppk) || strcmp(tmpaddress,vinaddress)!=0) || oracletxid!=txid)
return eval->Invalid("invalid vin."+std::to_string(tx.vin.size()-1)+" for oraclesregister, it must be CC vin or pubkey not same as vin pubkey, register and fund tx must be done from owner of pubkey that registers to oracle!!");
else if (CCtxidaddr(tmpaddress,oracletxid).IsValid() && ConstrainVout(tx.vout[0],0,tmpaddress,txfee)==0)
return eval->Invalid("invalid marker for oraclesregister!");
else if (!Getscriptaddress(tmpaddress,CScript() << ParseHex(HexStr(tmppk)) << OP_CHECKSIG) || ConstrainVout(tx.vout[2],0,tmpaddress,CC_MARKER_VALUE)==0)
@@ -851,18 +857,20 @@ int64_t AddMyOraclesFunds(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
return (0);
}
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format)
UniValue OracleCreate(const CPubKey& pk, int64_t txfee,std::string name,std::string description,std::string format)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,Oraclespk; struct CCcontract_info *cp,C; char fmt;
CPubKey mypk,Oraclespk; struct CCcontract_info *cp,C; char fmt;
cp = CCinit(&C,EVAL_ORACLES);
if ( name.size() > 32 || description.size() > 4096 || format.size() > 4096 )
{
CCerror = strprintf("name.%d or description.%d is too big",(int32_t)name.size(),(int32_t)description.size());
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
if ( name.size() > 32)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "name."<< (int32_t)name.size() << " must be less then 32");
if (description.size() > 4096)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "description."<< (int32_t)description.size() << " must be less then 4096");
if (format.size() > 4096 )
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "format."<< (int32_t)format.size() << " must be less then 4096");
if ( name.size() == 0 )
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "name must not be empty");
for(int i = 0; i < format.size(); i++)
{
fmt=format[i];
@@ -872,154 +880,125 @@ std::string OracleCreate(int64_t txfee,std::string name,std::string description,
case 'c': case 'C': case 't': case 'T':
case 'i': case 'I': case 'l': case 'L':
case 'h': break;
default: CCerror = strprintf("invalid format type");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
default: CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "invalid format type");
}
}
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
Oraclespk = GetUnspendable(cp,0);
if ( AddNormalinputs(mtx,mypk,2*txfee,3) > 0 )
if ( AddNormalinputs(mtx,mypk,2*txfee,3,pk.IsValid()) > 0 )
{
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(Oraclespk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesCreateOpRet('C',name,description,format)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeOraclesCreateOpRet('C',name,description,format)));
}
CCerror = strprintf("error adding normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string OracleFund(int64_t txfee,uint256 oracletxid)
UniValue OracleFund(const CPubKey& pk, int64_t txfee,uint256 oracletxid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); CTransaction tx;
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C; std::string name,desc,format; int32_t numvouts; uint256 hashBlock;
if (GetLatestTimestamp(komodo_get_current_height())<PUBKEY_SPOOFING_FIX_ACTIVATION)
{
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "oraclesfund not active yet, activation scheduled for July 15th");
if (myGetTransaction(oracletxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
if (DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,desc,format)!='C')
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "invalid oracletxid " << oracletxid.GetHex());
cp = CCinit(&C,EVAL_ORACLES);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2))
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2,pk.IsValid()))
{
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,mypk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('F',oracletxid,mypk,CC_MARKER_VALUE)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('F',oracletxid,mypk,CC_MARKER_VALUE)));
}
CCerror = strprintf("error adding normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
UniValue OracleRegister(const CPubKey& pk, int64_t txfee,uint256 oracletxid,int64_t datafee)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,markerpubkey,batonpk,oraclespk; struct CCcontract_info *cp,C; char markeraddr[64],batonaddr[64];
std::string name,desc,format; int32_t numvouts; uint256 hashBlock; CTransaction tx;
cp = CCinit(&C,EVAL_ORACLES);
if ( txfee == 0 )
txfee = 10000;
if (myGetTransaction(oracletxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
if (DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,desc,format)!='C')
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "invalid oracletxid " << oracletxid.GetHex());
if ( datafee < txfee )
{
CCerror = strprintf("datafee must be txfee or more");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
mypk = pubkey2pk(Mypubkey());
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "datafee must be txfee or more");
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
oraclespk = GetUnspendable(cp,0);
batonpk = OracleBatonPk(batonaddr,cp);
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
if (AddNormalinputs(mtx,mypk,3*txfee,4))
if (AddNormalinputs(mtx,mypk,3*txfee,4,pk.IsValid()))
{
if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
{
CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
}
CCerror = strprintf("error adding normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount)
UniValue OracleSubscribe(const CPubKey& pk, int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,markerpubkey; struct CCcontract_info *cp,C; char markeraddr[64];
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); CTransaction tx;
CPubKey mypk,markerpubkey; struct CCcontract_info *cp,C; char markeraddr[64]; std::string name,desc,format; int32_t numvouts; uint256 hashBlock;
cp = CCinit(&C,EVAL_ORACLES);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (myGetTransaction(oracletxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
if (DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,desc,format)!='C')
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "invalid oracletxid " << oracletxid.GetHex());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
if ( AddNormalinputs(mtx,mypk,amount + 2*txfee,64) > 0 )
if ( AddNormalinputs(mtx,mypk,amount + 2*txfee,64,pk.IsValid()) > 0 )
{
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,publisher));
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('S',oracletxid,mypk,amount)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('S',oracletxid,mypk,amount)));
}
CCerror = strprintf("error adding normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data)
UniValue OracleData(const CPubKey& pk, int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CScript pubKey; CPubKey mypk,batonpk; int64_t offset,datafee,inputs,CCchange = 0; struct CCcontract_info *cp,C; uint256 batontxid,hashBlock;
char coinaddr[64],batonaddr[64]; std::vector <uint8_t> prevdata; CTransaction tx; std::string name,description,format; int32_t len,numvouts;
cp = CCinit(&C,EVAL_ORACLES);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
if ( data.size() > 8192 )
{
CCerror = strprintf("datasize %d is too big",(int32_t)data.size());
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "datasize " << (int32_t)data.size() << " is too big");
if ( (datafee= OracleDatafee(pubKey,oracletxid,mypk)) <= 0 )
{
CCerror = strprintf("datafee %.8f is illegal",(double)datafee/COIN);
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "datafee " << (double)datafee/COIN << "is illegal");
if ( myGetTransaction(oracletxid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
{
if ( DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
{
if (oracle_parse_data_format(data,format)==0)
{
CCerror = strprintf("data does not match length or content format specification");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "data does not match length or content format specification");
}
else
{
CCerror = strprintf("invalid oracle txid opret data");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "invalid oracle txid opret data");
}
else
{
CCerror = strprintf("invalid oracle txid");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "invalid oracle txid");
if ( txfee == 0 )
txfee = 10000;
GetCCaddress(cp,coinaddr,mypk);
if ( AddNormalinputs(mtx,mypk,2*txfee,3) > 0 ) // have enough funds even if baton utxo not there
if ( AddNormalinputs(mtx,mypk,2*txfee,3,pk.IsValid()) > 0 ) // have enough funds even if baton utxo not there
{
batonpk = OracleBatonPk(batonaddr,cp);
batontxid = OracleBatonUtxo(txfee,cp,oracletxid,batonaddr,mypk,prevdata);
@@ -1031,18 +1010,13 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
if ( inputs > datafee )
CCchange = (inputs - datafee);
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,mypk));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,batonpk));
mtx.vout.push_back(CTxOut(datafee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesData('D',oracletxid,batontxid,mypk,data)));
} else {
CCerror = strprintf("couldnt find enough oracle inputs %s, limit 1 per utxo\n",coinaddr);
fprintf(stderr,"%s\n", CCerror.c_str() );
}
} else {
CCerror = strprintf("couldnt add normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodeOraclesData('D',oracletxid,batontxid,mypk,data)));
} else
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "couldnt find enough oracle inputs " << coinaddr << ", limit 1 per utxo");
}
return("");
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "couldnt add normal inputs");
}
UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatlen)
@@ -1096,7 +1070,7 @@ UniValue OracleDataSample(uint256 reforacletxid,uint256 txid)
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
{
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid;
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0,vout; std::vector<uint8_t> data; char *formatstr = 0;
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0,vout; std::vector<uint8_t> data; char *formatstr = 0, addr[64];
std::vector<uint256> txids; int64_t nValue;
result.push_back(Pair("result","success"));
@@ -1110,8 +1084,10 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
{
const CTransaction &txmempool = *it;
const uint256 &hash = txmempool.GetHash();
if ((numvouts=txmempool.vout.size())>0 && DecodeOraclesData(txmempool.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
if ((numvouts=txmempool.vout.size())>0 && txmempool.vout[1].nValue==CC_MARKER_VALUE && DecodeOraclesData(txmempool.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
{
Getscriptaddress(addr,txmempool.vout[1].scriptPubKey);
if (strcmp(addr,batonaddr)!=0) continue;
if ( (formatstr= (char *)format.c_str()) == 0 )
formatstr = (char *)"";
UniValue a(UniValue::VOBJ);
@@ -1119,7 +1095,10 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
b.push_back(a);
if ( ++n >= num && num != 0)
break;
{
result.push_back(Pair("samples",b));
return(result);
}
}
}
SetCCtxids(txids,batonaddr,true,EVAL_ORACLES,reforacletxid,'D');
@@ -1130,7 +1109,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
txid=*it;
if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
{
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
if ( tx.vout[1].nValue==CC_MARKER_VALUE && DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
{
if ( (formatstr= (char *)format.c_str()) == 0 )
formatstr = (char *)"";
@@ -1139,13 +1118,20 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
b.push_back(a);
if ( ++n >= num && num != 0)
break;
{
result.push_back(Pair("samples",b));
return(result);
}
}
}
}
}
}
else
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid oracletxid " << oracletxid.GetHex());
}
else
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
result.push_back(Pair("samples",b));
return(result);
}
@@ -1216,7 +1202,11 @@ UniValue OracleInfo(uint256 origtxid)
}
result.push_back(Pair("registered",a));
}
else
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid oracletxid " << oracletxid.GetHex());
}
else
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
return(result);
}

View File

@@ -89,6 +89,13 @@ int64_t mpz_get_si2( mpz_t op )
return ret;
}
uint64_t mpz_get_ui2( mpz_t op )
{
uint64_t ret = 0;
mpz_export(&ret, NULL, 1, sizeof(ret), 0, 0, op);
return ret;
}
CScript EncodePaymentsTxidOpRet(int64_t allocation,std::vector<uint8_t> scriptPubKey,std::vector<uint8_t> destopret)
{
CScript opret; uint8_t evalcode = EVAL_PAYMENTS;

View File

@@ -16,6 +16,8 @@
#include "CCPegs.h"
#include "../importcoin.h"
#include "key_io.h"
#include <gmp.h>
/*
pegs CC is able to create a coin backed (by any supported coin with gateways CC deposits) and pegged to any synthetic price that is able to be calculated based on prices CC
@@ -88,9 +90,10 @@ pegs CC is able to create a coin backed (by any supported coin with gateways CC
// start of consensus code
#ifndef PEGS_THRESHOLDS
#define PEGS_THRESHOLDS
#define PEGS_ACCOUNT_MAX_DEBT 80
#define PEGS_GLOBAL_RED_ZONE 60
#define PEGS_ACCOUNT_YELLOW_ZONE 60
#define PEGS_ACCOUNT_THRESHOLD 90
#define PEGS_GLOBAL_THRESHOLD 60
#define PEGS_ACCOUNT_RED_ZONE 90
#endif // PEGS_THRESHOLDS
#define CC_MARKER_VALUE 10000
@@ -99,6 +102,8 @@ extern uint64_t ASSETCHAINS_PEGSCCPARAMS[3];
extern uint8_t DecodeGatewaysBindOpRet(char *depositaddr,const CScript &scriptPubKey,uint256 &tokenid,std::string &coin,int64_t &totalsupply,uint256 &oracletxid,uint8_t &M,uint8_t &N,std::vector<CPubKey> &gatewaypubkeys,uint8_t &taddr,uint8_t &prefix,uint8_t &prefix2,uint8_t &wiftype);
extern int64_t GetTokenBalance(CPubKey pk, uint256 tokenid);
extern int32_t komodo_currentheight();
extern int32_t prices_syntheticvec(std::vector<uint16_t> &vec, std::vector<std::string> synthetic);
extern int64_t prices_syntheticprice(std::vector<uint16_t> vec, int32_t height, int32_t minmax, int16_t leverage);
CScript EncodePegsCreateOpRet(std::vector<uint256> bindtxids)
{
@@ -512,21 +517,17 @@ char PegsFindAccount(struct CCcontract_info *cp,CPubKey pk,uint256 pegstxid, uin
else return(0);
}
double PegsGetTokenPrice(uint256 tokenid)
int64_t PegsGetTokenPrice(uint256 tokenid)
{
int64_t *tokensyn,*btcusd; double price; CTransaction tokentx; uint256 hashBlock;
int64_t price; CTransaction tokentx; uint256 hashBlock; std::vector<uint16_t> exp;
std::string name,desc; std::vector<uint8_t> vorigpubkey; int32_t numvouts;
if (myGetTransaction(tokenid,tokentx,hashBlock)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c')
{
tokensyn = (int64_t *)calloc(sizeof(*tokensyn) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH);
btcusd = (int64_t *)calloc(sizeof(*btcusd) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH);
if (komodo_priceget(tokensyn, komodo_priceind((name+"_BTC").c_str()), komodo_currentheight(), 1) >= 0 && komodo_priceget(btcusd, komodo_priceind("BTC_USD"), komodo_currentheight(), 1) >= 0)
{
price=tokensyn[2]*btcusd[2];
price=price/COIN/COIN;
std::vector<std::string> vexpr;
SplitStr(desc, vexpr);
if (prices_syntheticvec(exp, vexpr)>=0 && (price = prices_syntheticprice(exp, komodo_currentheight(), 0, 1))>=0)
return (price);
}
}
return (0);
}
@@ -544,6 +545,34 @@ std::string PegsGetTokenName(uint256 tokenid)
return("");
}
int64_t PegsGetTokensAmountPerPrice(int64_t amount,uint256 tokenid)
{
mpz_t res,a,b;
mpz_init(res);
mpz_init(a);
mpz_init(b);
mpz_set_si(a, amount);
mpz_set_si(b, COIN);
mpz_mul(res, a, b);
mpz_set_si(a, PegsGetTokenPrice(tokenid));
mpz_tdiv_q(res, res, a);
return (mpz_get_si(res));
}
double PegsGetRatio(uint256 tokenid,std::pair<int64_t,int64_t> account)
{
mpz_t res,a,b;
mpz_init(res);
mpz_init(a);
mpz_init(b);
mpz_set_si(a, account.first);
mpz_set_si(b, PegsGetTokenPrice(tokenid));
mpz_mul(res, a, b);
mpz_set_si(a, COIN);
mpz_tdiv_q(res, res, a);
return ((double)account.second)*100/mpz_get_si(res);
}
double PegsGetAccountRatio(uint256 pegstxid,uint256 tokenid,uint256 accounttxid)
{
int64_t amount; uint256 hashBlock,tmptokenid,tmppegstxid;
@@ -555,7 +584,7 @@ double PegsGetAccountRatio(uint256 pegstxid,uint256 tokenid,uint256 accounttxid)
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid && tokenid==tmptokenid)
{
PegsDecodeAccountTx(tx,pk,amount,account);
return ((double)account.second*100/(account.first*PegsGetTokenPrice(tokenid)));
return PegsGetRatio(tokenid,account);
}
return (0);
}
@@ -565,7 +594,7 @@ double PegsGetGlobalRatio(uint256 pegstxid)
char coinaddr[64]; int64_t nValue,amount,globaldebt=0; uint256 txid,accounttxid,hashBlock,tmppegstxid,tokenid;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::pair<int64_t,int64_t> account;
std::map<uint256,std::pair<int64_t,int64_t>> globalaccounts; double globaldeposit=0;
std::map<uint256,std::pair<int64_t,int64_t>> globalaccounts;
struct CCcontract_info *cp,C;
cp = CCinit(&C,EVAL_PEGS);
@@ -598,12 +627,29 @@ double PegsGetGlobalRatio(uint256 pegstxid)
globalaccounts[tokenid].first+=nValue;
}
}
mpz_t res,globaldeposit,a,b;
mpz_init(res);
mpz_init(globaldeposit);
mpz_init(a);
mpz_init(b);
mpz_set_si(globaldeposit, 0);
for (std::map<uint256,std::pair<int64_t,int64_t>>::iterator it = globalaccounts.begin(); it != globalaccounts.end(); ++it)
{
globaldeposit+=globalaccounts[it->first].first*PegsGetTokenPrice(it->first);
mpz_set_si(res, 0);
mpz_set_si(a, globalaccounts[it->first].first);
mpz_set_si(b, PegsGetTokenPrice(it->first));
mpz_mul(res,a,b);
mpz_add(globaldeposit,globaldeposit,res);
globaldebt+=globalaccounts[it->first].second;
}
if (globaldebt>0) return ((double)globaldebt*100/globaldeposit);
if (globaldebt>0)
{
mpz_set_si(res, 0);
mpz_set_si(a, COIN);
mpz_tdiv_q(res, globaldeposit, a);
printf("%lu %lu\n",globaldebt,mpz_get_si(res));
return ((double)globaldebt)*100/mpz_get_si(res);
}
return (0);
}
@@ -643,7 +689,7 @@ std::string PegsFindBestAccount(struct CCcontract_info *cp,uint256 pegstxid, uin
else return("");
}
std::string PegsCreate(uint64_t txfee,int64_t amount, std::vector<uint256> bindtxids)
UniValue PegsCreate(const CPubKey& pk,uint64_t txfee,int64_t amount, std::vector<uint256> bindtxids)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,pegspk; struct CCcontract_info *cp,C; CTransaction tx; int32_t numvouts; int64_t totalsupply; std::string coin;
@@ -652,34 +698,24 @@ std::string PegsCreate(uint64_t txfee,int64_t amount, std::vector<uint256> bindt
cp = CCinit(&C,EVAL_PEGS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
for(auto txid : bindtxids)
{
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find bindtxid " << txid.GetHex());
if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tmptokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)!='B')
{
CCerror = strprintf("invalid bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid bindtxid " << txid.GetHex());
}
if ( AddNormalinputs(mtx,mypk,amount,64) >= amount )
if ( AddNormalinputs(mtx,mypk,amount,64,pk.IsValid()) >= amount )
{
for (int i=0; i<100; i++) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,(amount-txfee)/100,pegspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsCreateOpRet(bindtxids)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodePegsCreateOpRet(bindtxids)));
}
CCerror = strprintf("error adding normal inputs");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "error adding normal inputs");
}
std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t amount)
UniValue PegsFund(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string coin;
CTransaction pegstx,tx; int32_t numvouts; int64_t totalsupply,balance=0,funds=0,tokenfunds=0; uint256 accounttxid=zeroid,hashBlock,txid,tmptokenid,oracletxid;
@@ -690,35 +726,18 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
{
CCerror = strprintf("invalid pegstxid ",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
for(auto txid : bindtxids)
{
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find bindtxid " << txid.GetHex());
if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tmptokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)!='B')
{
CCerror = strprintf("invalid bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid bindtxid " << txid.GetHex());
if (tmptokenid==tokenid)
{
found=true;
@@ -726,21 +745,13 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am
}
}
if (!found)
{
CCerror = strprintf("invalid tokenid ",tokenid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid tokenid " << tokenid.GetHex());
if ((balance=GetTokenBalance(mypk,tokenid))>=amount)
{
PegsFindAccount(cp,mypk,pegstxid,tokenid,accounttxid,account);
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "current accounttxid=" << accounttxid.GetHex() << " [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
if (accounttxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,accounttxid,1) != 0)
{
CCerror = strprintf("previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous account tx not yet confirmed");
if (accounttxid!=zeroid && (funds=AddPegsInputs(cp,mtx,pegspk,CPubKey(),txfee,1))>=txfee)
{
funds+=2*CC_MARKER_VALUE;
@@ -763,23 +774,16 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am
if (funds>txfee+2*CC_MARKER_VALUE) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,funds-(txfee+2*CC_MARKER_VALUE),pegspk));
account.first+=amount;
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "new account [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsFundOpRet(tokenid,pegstxid,mypk,amount,account)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodePegsFundOpRet(tokenid,pegstxid,mypk,amount,account)));
}
}
else
{
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream <<"not enough balance in pegs global CC address");
}
CCerror = strprintf("not enough balance (%lld) for this amount of tokens %lld",balance,amount);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance (" << balance << ") for this amount of tokens " << amount);
}
std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount)
UniValue PegsGet(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount)
{
CMutableTransaction burntx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()),mtx;
CTransaction pegstx,tx; int32_t numvouts; int64_t funds=0; uint256 accounttxid=zeroid,hashBlock,pricestxid; char coinaddr[64];
@@ -789,32 +793,16 @@ std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t am
cp = CCinit(&C,EVAL_PEGS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
{
CCerror = strprintf("invalid pegstxid ",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
if (PegsFindAccount(cp,mypk,pegstxid,tokenid,accounttxid,account)==0)
{
CCerror = strprintf("cannot find account from which to issue coins, fund account first with pegsfund!");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cannot find account from which to issue coins, fund account first with pegsfund!");
if (accounttxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,accounttxid,1) != 0)
{
CCerror = strprintf("previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "current accounttxid=" << accounttxid.GetHex() << " [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
// spending markers
vouts.push_back(MakeCC1of2vout(EVAL_PEGS,CC_MARKER_VALUE,pegspk,pegspk));
@@ -822,6 +810,12 @@ std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t am
// coin issue
vouts.push_back(CTxOut(amount,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
account.second+=amount;
if (PegsGetRatio(tokenid,account)>PEGS_ACCOUNT_MAX_DEBT)
{
CCerror = strprintf("not possible to take more than %d%% of the deposit",PEGS_ACCOUNT_MAX_DEBT);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "new account [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
// burn tx does not exist in pegs method but it must be created in order for import validation to pass
// fictive burntx input of previous account state tx
@@ -836,12 +830,12 @@ std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t am
Myprivkey(mypriv);
GetCCaddress1of2(cp,coinaddr,mypk,pegspk);
CCaddr1of2set(cp,mypk,pegspk,mypriv,coinaddr);
std::string retstr = FinalizeCCTx(0,cp,mtx,mypk,txfee,opret);
UniValue retstr = FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,opret);
memset(mypriv,0,sizeof(mypriv));
return(retstr);
}
std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
UniValue PegsRedeem(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string coin;
CTransaction pegstx,tx; int32_t numvouts; int64_t totalsupply,pegsfunds=0,funds=0,tokenfunds=0,amount; uint256 accounttxid=zeroid,hashBlock,txid,tmptokenid,oracletxid;
@@ -852,34 +846,18 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
{
CCerror = strprintf("invalid pegstxid ",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
for(auto txid : bindtxids)
{
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find bindtxid " << txid.GetHex());
if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tmptokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)!='B')
{
CCerror = strprintf("invalid bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid bindtxid " << txid.GetHex());
if (tmptokenid==tokenid)
{
found=true;
@@ -887,25 +865,13 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
}
}
if (!found)
{
CCerror = strprintf("invalid tokenid ",tokenid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid tokenid " << tokenid.GetHex());
if (PegsFindAccount(cp,mypk,pegstxid,tokenid,accounttxid,account)==0)
{
CCerror = strprintf("cannot find account from which to redeem tokens!");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cannot find account from which to redeem tokens!");
if (accounttxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,accounttxid,1) != 0)
{
CCerror = strprintf("previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "current accounttxid=" << accounttxid.GetHex() << " [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
if ((funds=AddNormalinputs(mtx,mypk,account.second,64))>=account.second )
if ((funds=AddNormalinputs(mtx,mypk,account.second,64,pk.IsValid()))>=account.second )
{
if (accounttxid!=zeroid && (pegsfunds=AddPegsInputs(cp,mtx,pegspk,CPubKey(),txfee,1))>=txfee)
{
@@ -928,39 +894,31 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
account.first=0;
account.second=0;
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "new account [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
std::string retstr = FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsReedemOpRet(tokenid,pegstxid,mypk,amount,account));
UniValue retstr = FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodePegsReedemOpRet(tokenid,pegstxid,mypk,amount,account));
memset(mypriv,0,32);
return(retstr);
}
else
{
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
memset(mypriv,0,32);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
}
CCerror = strprintf("not enough tokens in pegs account (%lld) to redeem this amount of tokens %lld",tokenfunds,account.first);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
memset(mypriv,0,32);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough tokens in pegs account (" << tokenfunds << ") to redeem this amount of tokens " << account.first);
}
else
{
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
memset(mypriv,0,32);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
}
CCerror = strprintf("to redeem from account and close it you must redeem full debt ammount %lld instead of %lld",account.second,funds);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
memset(mypriv,0,32);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "to redeem from account and close it you must redeem full debt ammount " << account.second << " instead of " << funds);
}
std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount)
UniValue PegsExchange(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string coin;
CTransaction pegstx,tx; int32_t numvouts; int64_t totalsupply,pegsfunds=0,funds=0,tokenfunds=0,tokenamount,tmpamount; uint256 accounttxid=zeroid,hashBlock,txid,tmptokenid,oracletxid;
@@ -971,34 +929,18 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
{
CCerror = strprintf("invalid pegstxid ",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
for(auto txid : bindtxids)
{
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find bindtxid " << txid.GetHex());
if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tmptokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)!='B')
{
CCerror = strprintf("invalid bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid bindtxid " << txid.GetHex());
if (tmptokenid==tokenid)
{
found=true;
@@ -1006,43 +948,23 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
}
}
if (!found)
{
CCerror = strprintf("invalid tokenid ",tokenid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid tokenid " << tokenid.GetHex());
if (PegsFindAccount(cp,mypk,pegstxid,tokenid,accounttxid,account)!=0)
{
CCerror = strprintf("you have active account, please close account first before exchanging other coins!");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if ((funds=AddNormalinputs(mtx,mypk,amount,64))>=amount )
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "you have active account, please close account first before exchanging other coins!");
if ((funds=AddNormalinputs(mtx,mypk,amount,64,pk.IsValid()))>=amount )
{
if ((pegsfunds=AddPegsInputs(cp,mtx,pegspk,CPubKey(),txfee,1))>=txfee)
{
tokenamount=amount/PegsGetTokenPrice(tokenid);
tokenamount=PegsGetTokensAmountPerPrice(amount,tokenid);
tokenfunds=AddPegsTokenInputs(cp,mtx,pegstxid,tokenid,pegspk,CPubKey(),tokenamount,64);
if (tokenfunds<tokenamount)
{
if (PegsFindBestAccount(cp,pegstxid,tokenid,tokenamount-tokenfunds,accounttxid,account).empty())
{
CCerror = strprintf("cannot find account from which to get tokens for exchange!");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cannot find account from which to get tokens for exchange!");
if (accounttxid!=zeroid && myGetTransaction(accounttxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,tmpamount,account).empty())
{
CCerror = strprintf("invalid account tx from which to exchange coins to tokens %s!",accounttxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid account tx from which to exchange coins to tokens " << accounttxid.GetHex());
if (accounttxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,accounttxid,1) != 0)
{
CCerror = strprintf("previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous account tx not yet confirmed");
tokenfunds+=AddPegsTokenInputs(cp,mtx,pegstxid,tokenid,tmppk,pegspk,tokenamount,64);
mtx.vin.push_back(CTxIn(accounttxid,0,CScript()));
mtx.vin.push_back(CTxIn(accounttxid,1,CScript()));
@@ -1070,35 +992,23 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
}
else if (pegsfunds>txfee) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,pegsfunds-txfee,pegspk));
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "modified account [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsExchangeOpRet(tokenid,pegstxid,mypk,tmppk,amount,account)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodePegsExchangeOpRet(tokenid,pegstxid,mypk,tmppk,amount,account)));
}
else
{
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
CCerror = strprintf("not enough tokens in pegs account (%lld) to exchange to this amount of tokens %lld",tokenfunds,tokenamount);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough tokens in pegs account (" << tokenfunds << ") to exchange to this amount of tokens " << tokenamount);
}
else
{
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
CCerror = strprintf("not enough funds to exchange %lld coins to tokens - balance %lld",amount,funds);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough funds to exchange " << amount << " coins to tokens - balance " << funds);
}
std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint256 liquidatetxid)
UniValue PegsLiquidate(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint256 liquidatetxid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string coin;
CTransaction pegstx,tx; int32_t numvouts; int64_t totalsupply,pegsfunds=0,funds=0,tokenfunds=0,amount,burnamount;
CTransaction pegstx,tx; int32_t numvouts; int64_t totalsupply,pegsfunds=0,funds=0,tokenfunds=0,amount,tmpamount,tokenamount,burnamount;
CPubKey mypk,pegspk,tmppk; struct CCcontract_info *cp,*cpTokens,CTokens,C; char depositaddr[64],coinaddr[64]; std::pair <int64_t,int64_t> account(0,0),myaccount(0,0);
uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; bool found=false; std::vector<uint256> bindtxids;
uint256 hashBlock,txid,tmptokenid,oracletxid,accounttxid;
@@ -1107,34 +1017,18 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
cpTokens = CCinit(&CTokens,EVAL_TOKENS);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
{
CCerror = strprintf("invalid pegstxid ",pegstxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
for(auto txid : bindtxids)
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
for(auto txid : bindtxids)
{
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
{
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find bindtxid " << txid.GetHex());
if (DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tmptokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype)!='B')
{
CCerror = strprintf("invalid bindtxid %s",txid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid bindtxid " << txid.GetHex());
if (tmptokenid==tokenid)
{
found=true;
@@ -1142,45 +1036,23 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
}
}
if (!found)
{
CCerror = strprintf("invalid tokenid ",tokenid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid tokenid " << tokenid.GetHex());
if (PegsFindAccount(cp,mypk,pegstxid,tokenid,accounttxid,myaccount)==0)
{
CCerror = strprintf("cannot find account, you must have an account to liquidate another account!");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cannot find account, you must have an account to liquidate another account!");
if (accounttxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,accounttxid,1) != 0)
{
CCerror = strprintf("previous account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
if (PegsGetAccountRatio(pegstxid,tokenid,liquidatetxid)<(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_THRESHOLD) || PegsGetGlobalRatio(pegstxid)<(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_THRESHOLD))
{
CCerror = strprintf("not able to liquidate account until account ratio > %lu%% and global ratio > %lu%%",(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_THRESHOLD),(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_GLOBAL_THRESHOLD));
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous account tx not yet confirmed");
if (PegsGetAccountRatio(pegstxid,tokenid,liquidatetxid)<(ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_RED_ZONE) || PegsGetGlobalRatio(pegstxid)<(ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_ACCOUNT_RED_ZONE))
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not able to liquidate account until account ratio > " << (ASSETCHAINS_PEGSCCPARAMS[0]?ASSETCHAINS_PEGSCCPARAMS[0]:PEGS_ACCOUNT_RED_ZONE) << "% and global ratio > " << (ASSETCHAINS_PEGSCCPARAMS[1]?ASSETCHAINS_PEGSCCPARAMS[1]:PEGS_ACCOUNT_RED_ZONE) << "%");
if (liquidatetxid!=zeroid && myGetTransaction(liquidatetxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,amount,account).empty())
{
CCerror = strprintf("cannot find account to liquidate or invalid tx %s!",liquidatetxid.GetHex());
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cannot find account to liquidate or invalid tx " << liquidatetxid.GetHex());
if (liquidatetxid!=zeroid && myIsutxo_spentinmempool(ignoretxid,ignorevin,liquidatetxid,1) != 0)
{
CCerror = strprintf("previous liquidate account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "previous liquidate account tx not yet confirmed");
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "current accounttxid=" << accounttxid.GetHex() << " [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
amount=account.first;
burnamount=account.second*0.9;
if ((funds=AddNormalinputs(mtx,mypk,txfee+account.second,64))>=txfee+burnamount)
tokenamount=account.first;
burnamount=account.second;
tmpamount=PegsGetTokensAmountPerPrice(burnamount,tokenid)*105/100;
amount=tmpamount+((tokenamount-tmpamount)*10/100);
if ((funds=AddNormalinputs(mtx,mypk,account.second,64))>=burnamount)
{
if (liquidatetxid!=zeroid && (pegsfunds=AddPegsInputs(cp,mtx,pegspk,CPubKey(),txfee,1))>=txfee)
{
@@ -1189,49 +1061,45 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
mtx.vin.push_back(CTxIn(liquidatetxid,1,CScript()));
GetCCaddress1of2(cp,coinaddr,tmppk,pegspk);
CCaddr1of2set(cp,tmppk,pegspk,cp->CCpriv,coinaddr);
if ((tokenfunds=AddPegsTokenInputs(cp,mtx,pegstxid,tokenid,tmppk,pegspk,amount,64))==amount)
if ((tokenfunds=AddPegsTokenInputs(cp,mtx,pegstxid,tokenid,tmppk,pegspk,tokenamount,64))==tokenamount)
{
if (pegsfunds>=txfee+2*CC_MARKER_VALUE)
{
mtx.vout.push_back(MakeCC1of2vout(EVAL_PEGS,CC_MARKER_VALUE,pegspk,pegspk));
mtx.vout.push_back(MakeCC1of2vout(EVAL_PEGS,CC_MARKER_VALUE,tmppk,pegspk));
mtx.vout.push_back(MakeTokensCC1vout(EVAL_TOKENS,(int64_t)(amount*0.95),mypk));
mtx.vout.push_back(MakeTokensCC1vout(EVAL_PEGS,amount-(int64_t)(amount*0.95),pegspk));
mtx.vout.push_back(MakeTokensCC1vout(EVAL_TOKENS,amount,mypk));
mtx.vout.push_back(MakeTokensCC1vout(EVAL_PEGS,tokenamount-amount,pegspk));
mtx.vout.push_back(CTxOut(burnamount,CScript() << ParseHex(HexStr(CCtxidaddr(coinaddr,pegstxid))) << OP_CHECKSIG));
if (pegsfunds>txfee+2*CC_MARKER_VALUE) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,pegsfunds-(txfee+2*CC_MARKER_VALUE),pegspk));
account.first=0;
account.second=0;
LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "new account [deposit=" << account.first << ",debt=" << account.second << "]" << std::endl);
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsLiquidateOpRet(tokenid,pegstxid,mypk,amount,account)));
return(FinalizeCCTxExt(pk.IsValid(),0,cp,mtx,mypk,txfee,EncodePegsLiquidateOpRet(tokenid,pegstxid,mypk,amount,account)));
}
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
CCerror = strprintf("tokens amount in pegs account (%lld) not matching amount in account %lld",tokenfunds,account.first); // this shouldn't happen
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "tokens amount in pegs account " << tokenfunds << " not matching amount in account " << account.first); // this shouldn't happen
}
CCerror = strprintf("not enough balance in pegs global CC address");
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough balance in pegs global CC address");
}
CCerror = strprintf("not enough funds to liquidate account, you must liquidate full debt ammount %lld instead of %lld",txfee+account.second,funds);
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "not enough funds to liquidate account, you must liquidate full debt ammount " << txfee+account.second << " instead of " << funds);
}
UniValue PegsAccountHistory(uint256 pegstxid)
UniValue PegsAccountHistory(const CPubKey& pk,uint256 pegstxid)
{
char coinaddr[64]; int64_t nValue,amount; uint256 txid,accounttxid,hashBlock,tmptokenid,tmppegstxid;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk; std::map<uint256,std::pair<int64_t,int64_t>> accounts;
std::vector<uint256> txids; std::pair<int64_t,int64_t> account;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,tmppk; std::map<uint256,std::pair<int64_t,int64_t>> accounts;
std::vector<uint256> txids; std::pair<int64_t,int64_t> account; std::vector<uint256> bindtxids;
UniValue result(UniValue::VOBJ),acc(UniValue::VARR); struct CCcontract_info *cp,C;
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
result.push_back(Pair("result","success"));
result.push_back(Pair("name","pegsaccounthistory"));
cp = CCinit(&C,EVAL_PEGS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
GetCCaddress1of2(cp,coinaddr,mypk,pegspk);
SetCCtxids(txids,coinaddr,true,EVAL_PEGS,pegstxid,0);
@@ -1242,7 +1110,7 @@ UniValue PegsAccountHistory(uint256 pegstxid)
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid)
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("action",PegsDecodeAccountTx(tx,pk,amount,account)));
obj.push_back(Pair("action",PegsDecodeAccountTx(tx,tmppk,amount,account)));
obj.push_back(Pair("amount",amount));
obj.push_back(Pair("accounttxid",txid.GetHex()));
obj.push_back(Pair("token",PegsGetTokenName(tmptokenid)));
@@ -1255,17 +1123,21 @@ UniValue PegsAccountHistory(uint256 pegstxid)
return(result);
}
UniValue PegsAccountInfo(uint256 pegstxid)
UniValue PegsAccountInfo(const CPubKey& pk,uint256 pegstxid)
{
char coinaddr[64]; int64_t nValue,amount; uint256 txid,accounttxid,hashBlock,tmptokenid,tmppegstxid; std::map<uint256,std::pair<int64_t,int64_t>> accounts;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,tmppk; std::vector<uint256> bindtxids;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::pair<int64_t,int64_t> account;
UniValue result(UniValue::VOBJ),acc(UniValue::VARR); struct CCcontract_info *cp,C;
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
result.push_back(Pair("result","success"));
result.push_back(Pair("name","pegsaccountinfo"));
cp = CCinit(&C,EVAL_PEGS);
mypk = pubkey2pk(Mypubkey());
mypk = pk.IsValid()?pk:pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
GetCCaddress1of2(cp,coinaddr,mypk,pegspk);
SetCCunspents(unspentOutputs,coinaddr,true);
@@ -1279,7 +1151,7 @@ UniValue PegsAccountInfo(uint256 pegstxid)
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid)
{
//LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "txid=" << txid.GetHex() << ", vout=" << vout << ", nValue=" << nValue << ", tokenid=" << tmptokenid.GetHex() << std::endl);
PegsDecodeAccountTx(tx,pk,amount,account);
PegsDecodeAccountTx(tx,tmppk,amount,account);
accounts[tmptokenid].first=account.first;
accounts[tmptokenid].second=account.second;
}
@@ -1288,10 +1160,10 @@ UniValue PegsAccountInfo(uint256 pegstxid)
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("token",PegsGetTokenName(it->first)));
obj.push_back(Pair("deposit",(double)accounts[it->first].first/COIN));
obj.push_back(Pair("debt",(double)accounts[it->first].second/COIN));
if (accounts[it->first].first==0 || accounts[it->first].second==0 || PegsGetTokenPrice(it->first)==0) obj.push_back(Pair("ratio",0));
else obj.push_back(Pair("ratio",strprintf("%.2f%%",(double)accounts[it->first].second*100/(accounts[it->first].first*PegsGetTokenPrice(it->first)))));
obj.push_back(Pair("deposit",accounts[it->first].first));
obj.push_back(Pair("debt",accounts[it->first].second));
if (accounts[it->first].first==0 || accounts[it->first].second==0 || PegsGetTokenPrice(it->first)<=0) obj.push_back(Pair("ratio",0));
else obj.push_back(Pair("ratio",strprintf("%.2f%%",PegsGetRatio(it->first,accounts[it->first]))));
acc.push_back(obj);
}
result.push_back(Pair("account info",acc));
@@ -1301,14 +1173,17 @@ UniValue PegsAccountInfo(uint256 pegstxid)
UniValue PegsWorstAccounts(uint256 pegstxid)
{
char coinaddr[64]; int64_t nValue,amount; uint256 txid,accounttxid,hashBlock,tmppegstxid,tokenid,prev;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk; double ratio;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey pegspk,pk; double ratio; std::vector<uint256> bindtxids;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::pair<int64_t,int64_t> account;
UniValue result(UniValue::VOBJ),acc(UniValue::VARR); struct CCcontract_info *cp,C; std::multimap<uint256,UniValue> map;
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
result.push_back(Pair("result","success"));
result.push_back(Pair("name","pegsworstaccounts"));
cp = CCinit(&C,EVAL_PEGS);
mypk = pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
GetCCaddress1of2(cp,coinaddr,pegspk,pegspk);
SetCCunspents(unspentOutputs,coinaddr,true);
@@ -1321,9 +1196,9 @@ UniValue PegsWorstAccounts(uint256 pegstxid)
(funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid)
{
PegsDecodeAccountTx(tx,pk,amount,account);
if (account.first==0 || account.second==0 || PegsGetTokenPrice(tokenid)==0) ratio=0;
else ratio=(double)account.second*100/(account.first*PegsGetTokenPrice(tokenid));
if (ratio>80)
if (account.first==0 || account.second==0 || PegsGetTokenPrice(tokenid)<=0) ratio=0;
else ratio=PegsGetRatio(tokenid,account);
if (ratio>PEGS_ACCOUNT_RED_ZONE)
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("accounttxid",txid.GetHex()));
@@ -1352,15 +1227,18 @@ UniValue PegsWorstAccounts(uint256 pegstxid)
UniValue PegsInfo(uint256 pegstxid)
{
char coinaddr[64]; int64_t nValue,amount; uint256 txid,accounttxid,hashBlock,tmppegstxid,tokenid;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey pegspk,pk; std::vector<uint256> bindtxids;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::pair<int64_t,int64_t> account;
std::map<uint256,std::pair<int64_t,int64_t>> globalaccounts; double globaldeposit=0;
UniValue result(UniValue::VOBJ),acc(UniValue::VARR); struct CCcontract_info *cp,C;
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "cant find pegstxid " << pegstxid.GetHex());
if (DecodePegsCreateOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxids)!='C')
CCERR_RESULT("pegscc",CCLOG_INFO, stream << "invalid pegstxid " << pegstxid.GetHex());
result.push_back(Pair("result","success"));
result.push_back(Pair("name","pegsinfo"));
cp = CCinit(&C,EVAL_PEGS);
mypk = pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
GetCCaddress1of2(cp,coinaddr,pegspk,pegspk);
SetCCunspents(unspentOutputs,coinaddr,true);
@@ -1396,8 +1274,8 @@ UniValue PegsInfo(uint256 pegstxid)
obj.push_back(Pair("token",PegsGetTokenName(it->first)));
obj.push_back(Pair("total deposit",globalaccounts[it->first].first));
obj.push_back(Pair("total debt",globalaccounts[it->first].second));
if (globalaccounts[it->first].first==0 || globalaccounts[it->first].second==0 || PegsGetTokenPrice(it->first)==0) obj.push_back(Pair("total ratio",0));
else obj.push_back(Pair("total ratio",strprintf("%.2f%%",(double)globalaccounts[it->first].second*100/(globalaccounts[it->first].first*PegsGetTokenPrice(it->first)))));
if (globalaccounts[it->first].first==0 || globalaccounts[it->first].second==0 || PegsGetTokenPrice(it->first)<=0) obj.push_back(Pair("total ratio",0));
else obj.push_back(Pair("total ratio",strprintf("%.2f%%",PegsGetRatio(it->first,globalaccounts[it->first]))));
acc.push_back(obj);
}
result.push_back(Pair("info",acc));

View File

@@ -65,24 +65,62 @@
vout.n-1: opreturn 'U' sbits fundingtxid
*/
int64_t RewardsCalc(int64_t amount,uint256 txid,uint64_t APR,uint64_t minseconds,uint64_t maxseconds,uint64_t mindeposit)
/// the following are compatible with windows
/// mpz_set_lli sets a long long singed int to a big num mpz_t for very large integer math
extern void mpz_set_lli( mpz_t rop, long long op );
// mpz_get_si2 gets a mpz_t and returns a signed long long int
extern int64_t mpz_get_si2( mpz_t op );
// mpz_get_ui2 gets a mpz_t and returns a unsigned long long int
extern uint64_t mpz_get_ui2( mpz_t op );
uint64_t RewardsCalc(int64_t amount, uint256 txid, int64_t APR, int64_t minseconds, int64_t maxseconds, uint32_t timestamp)
{
int32_t numblocks; uint64_t duration,reward = 0;
int32_t numblocks; int64_t duration; uint64_t reward = 0;
//fprintf(stderr,"minseconds %llu maxseconds %llu\n",(long long)minseconds,(long long)maxseconds);
if ( (duration= CCduration(numblocks,txid)) < minseconds )
{
fprintf(stderr,"duration %llu < minseconds %llu\n",(long long)duration,(long long)minseconds);
fprintf(stderr,"duration %lli < minseconds %lli\n",(long long)duration,(long long)minseconds);
return(0);
//duration = (uint32_t)time(NULL) - (1532713903 - 3600 * 24);
} else if ( duration > maxseconds )
duration = maxseconds;
if ( 0 ) // amount * APR * duration / COIN * 100 * 365*24*3600
/* if ( 0 ) // amount * APR * duration / COIN * 100 * 365*24*3600
reward = (((amount * APR) / COIN) * duration) / (365*24*3600LL * 100);
else reward = (((amount * duration) / (365 * 24 * 3600LL)) * (APR / 1000000)) / 10000;
*/
if ( !hush_hardfork_active(timestamp) )
reward = (((amount * duration) / (365 * 24 * 3600LL)) * (APR / 1000000)) / 10000;
else
{
// declare and init the mpz_t big num variables
mpz_t mpzAmount, mpzDuration, mpzReward, mpzAPR, mpzModifier;
mpz_init(mpzAmount);
mpz_init(mpzDuration);
mpz_init(mpzAPR);
mpz_init(mpzReward);
mpz_init(mpzModifier);
// set the inputs to big num variables
mpz_set_lli(mpzAmount, amount);
mpz_set_lli(mpzDuration, duration);
mpz_set_lli(mpzAPR, APR);
mpz_set_lli(mpzModifier, COIN*100*365*24*3600LL);
// (amount * APR * duration)
mpz_mul(mpzReward, mpzAmount, mpzDuration);
mpz_mul(mpzReward, mpzReward, mpzAPR);
// total_of_above / (COIN * 100 * 365*24*3600LL)
mpz_tdiv_q(mpzReward, mpzReward, mpzModifier);
// set result to variable we can use and return it.
reward = mpz_get_ui2(mpzReward);
}
if ( reward > amount )
reward = amount;
fprintf(stderr,"amount %.8f %.8f %llu -> duration.%llu reward %.8f vals %.8f %.8f\n",(double)amount/COIN,((double)amount * APR)/COIN,(long long)((amount * APR) / (COIN * 365*24*3600)),(long long)duration,(double)reward/COIN,(double)((amount * duration) / (365 * 24 * 3600LL))/COIN,(double)(((amount * duration) / (365 * 24 * 3600LL)) * (APR / 1000000))/COIN);
fprintf(stderr, "amount.%lli duration.%lli APR.%lli reward.%llu\n", (long long)amount, (long long)duration, (long long)APR, (long long)reward);
//fprintf(stderr,"amount %.8f %.8f %llu -> duration.%llu reward %.8f vals %.8f %.8f\n",(double)amount/COIN,((double)amount * APR)/COIN,(long long)((amount * APR) / (COIN * 365*24*3600)),(long long)duration,(double)reward/COIN,(double)((amount * duration) / (365 * 24 * 3600LL))/COIN,(double)(((amount * duration) / (365 * 24 * 3600LL)) * (APR / 1000000))/COIN);
return(reward);
}
@@ -259,7 +297,7 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
if ( !CheckTxFee(tx, txfee, chainActive.LastTip()->GetHeight(), chainActive.LastTip()->nTime, dummy) )
return eval->Invalid("txfee is too high");
amount = vinTx.vout[0].nValue;
reward = RewardsCalc(amount,tx.vin[0].prevout.hash,APR,minseconds,maxseconds,mindeposit);
reward = RewardsCalc((int64_t)amount,tx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,GetLatestTimestamp(eval->GetCurrentHeight()));
if ( reward == 0 )
return eval->Invalid("no eligible rewards");
if ( numvins == 1 && tx.vout[0].scriptPubKey.IsPayToCryptoCondition() == 0 )
@@ -671,7 +709,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
}
if ( amount > txfee )
{
reward = RewardsCalc(amount,mtx.vin[0].prevout.hash,APR,minseconds,maxseconds,mindeposit);
reward = RewardsCalc((int64_t)amount,mtx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,komodo_chainactive_timestamp());
if ( scriptPubKey.size() > 0 )
{
if ( reward > txfee )

View File

@@ -583,18 +583,6 @@ void *chainparams_commandline()
pCurrentParams->pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
if (ASSETCHAINS_LWMAPOS != 0)
{
pCurrentParams->consensus.posLimit = uint256S("000000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
pCurrentParams->consensus.nPOSAveragingWindow = 45;
// spacing is 1000 units per block to get better resolution, POS is 50% hard coded for now, we can vary it later
// when we get reliable integer math on nLwmaPOSAjustedWeight
pCurrentParams->consensus.nPOSTargetSpacing = KOMODO_BLOCK_POSUNITS * 2;
// nLwmaPOSAjustedWeight = (N+1)/2 * (0.9989^(500/nPOSAveragingWindow)) * nPOSTargetSpacing
// this needs to be recalculated if KOMODO_BLOCK_POSUNITS is changed
pCurrentParams->consensus.nLwmaPOSAjustedWeight = 46531;
}
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = ASSETCHAINS_SAPLING;
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = ASSETCHAINS_OVERWINTER;
// Generated at 1575831755 via hush3 contrib/checkpoints.pl by Duke Leto

View File

@@ -33,8 +33,8 @@
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
// Must be kept in sync with configure.ac !
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_MINOR 3
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 50
//! Set to true for release, false for prerelease or test build

View File

@@ -618,13 +618,13 @@ bool CCoinsViewCache::HaveJoinSplitRequirements(const CTransaction& tx) const
{
for (const SpendDescription &spendDescription : tx.vShieldedSpend) {
if (GetNullifier(spendDescription.nullifier, SAPLING)) { // Prevent double spends
fprintf(stderr,"%s: sapling nullifier %s exists, preventing double spend\n", __FUNCTION__, spendDescription.nullifier);
LogPrintf("%s: sapling nullifier %s exists, preventing double spend\n", __FUNCTION__, spendDescription.nullifier.GetHex().c_str());
return false;
}
SaplingMerkleTree tree;
if (!GetSaplingAnchorAt(spendDescription.anchor, tree)) {
fprintf(stderr,"%s: missing sapling anchor: %s \n", __FUNCTION__, spendDescription.anchor);
LogPrintf("%s: missing sapling anchor: %s \n", __FUNCTION__, spendDescription.anchor.GetHex().c_str());
return false;
}
}

View File

@@ -1,7 +1,7 @@
#include "cc/eval.h"
#include "crosschain.h"
#include "notarisationdb.h"
#include "notaries_staked.h"
int GetSymbolAuthority(const char* symbol)
{

View File

@@ -3,12 +3,22 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "crypto/sha256.h"
#include "crypto/common.h"
#include <assert.h>
#include <string.h>
#include <stdexcept>
#if defined(__x86_64__) || defined(__amd64__)
#if defined(EXPERIMENTAL_ASM)
#include <cpuid.h>
namespace sha256_sse4
{
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks);
}
#endif
#endif
// Internal implementation code.
namespace
{
@@ -44,9 +54,10 @@ void inline Initialize(uint32_t* s)
s[7] = 0x5be0cd19ul;
}
/** Perform one SHA-256 transformation, processing a 64-byte chunk. */
void Transform(uint32_t* s, const unsigned char* chunk)
/** Perform a number of SHA-256 transformations, processing 64-byte chunks. */
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
{
while (blocks--) {
uint32_t a = s[0], b = s[1], c = s[2], d = s[3], e = s[4], f = s[5], g = s[6], h = s[7];
uint32_t w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15;
@@ -126,11 +137,59 @@ void Transform(uint32_t* s, const unsigned char* chunk)
s[5] += f;
s[6] += g;
s[7] += h;
chunk += 64;
}
}
} // namespace sha256
typedef void (*TransformType)(uint32_t*, const unsigned char*, size_t);
bool SelfTest(TransformType tr) {
static const unsigned char in1[65] = {0, 0x80};
static const unsigned char in2[129] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0
};
static const uint32_t init[8] = {0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul};
static const uint32_t out1[8] = {0xe3b0c442ul, 0x98fc1c14ul, 0x9afbf4c8ul, 0x996fb924ul, 0x27ae41e4ul, 0x649b934cul, 0xa495991bul, 0x7852b855ul};
static const uint32_t out2[8] = {0xce4153b0ul, 0x147c2a86ul, 0x3ed4298eul, 0xe0676bc8ul, 0x79fc77a1ul, 0x2abe1f49ul, 0xb2b055dful, 0x1069523eul};
uint32_t buf[8];
memcpy(buf, init, sizeof(buf));
// Process nothing, and check we remain in the initial state.
tr(buf, nullptr, 0);
if (memcmp(buf, init, sizeof(buf))) return false;
// Process the padded empty string (unaligned)
tr(buf, in1 + 1, 1);
if (memcmp(buf, out1, sizeof(buf))) return false;
// Process 64 spaces (unaligned)
memcpy(buf, init, sizeof(buf));
tr(buf, in2 + 1, 2);
if (memcmp(buf, out2, sizeof(buf))) return false;
return true;
}
TransformType Transform = sha256::Transform;
} // namespace
std::string SHA256AutoDetect()
{
#if defined(EXPERIMENTAL_ASM) && (defined(__x86_64__) || defined(__amd64__))
uint32_t eax, ebx, ecx, edx;
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx >> 19) & 1) {
Transform = sha256_sse4::Transform;
assert(SelfTest(Transform));
return "sse4";
}
#endif
assert(SelfTest(Transform));
return "standard";
}
////// SHA-256
@@ -148,14 +207,14 @@ CSHA256& CSHA256::Write(const unsigned char* data, size_t len)
memcpy(buf + bufsize, data, 64 - bufsize);
bytes += 64 - bufsize;
data += 64 - bufsize;
sha256::Transform(s, buf);
Transform(s, buf, 1);
bufsize = 0;
}
while (end >= data + 64) {
// Process full chunks directly from the source.
sha256::Transform(s, data);
bytes += 64;
data += 64;
if (end - data >= 64) {
size_t blocks = (end - data) / 64;
Transform(s, data, blocks);
data += 64 * blocks;
bytes += 64 * blocks;
}
if (end > data) {
// Fill the buffer with what remains.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014 The Bitcoin Core developers
// Copyright (c) 2014-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -7,13 +7,19 @@
#include <stdint.h>
#include <stdlib.h>
#include <string>
/** A hasher class for SHA-256. */
class CSHA256
{
public:
static const size_t OUTPUT_SIZE = 32;
private:
uint32_t s[8];
unsigned char buf[64];
size_t bytes;
void FinalizeNoPadding(unsigned char hash[OUTPUT_SIZE], bool enforce_compression);
public:
CSHA256();
CSHA256& Write(const unsigned char* data, size_t len);
void Finalize(unsigned char hash[OUTPUT_SIZE]);
@@ -21,12 +27,11 @@ public:
FinalizeNoPadding(hash, true);
};
CSHA256& Reset();
private:
uint32_t s[8];
unsigned char buf[64];
size_t bytes;
void FinalizeNoPadding(unsigned char hash[OUTPUT_SIZE], bool enforce_compression);
};
/** Autodetect the best available SHA256 implementation.
* Returns the name of the implementation.
*/
std::string SHA256AutoDetect();
#endif // BITCOIN_CRYPTO_SHA256_H

1506
src/crypto/sha256_sse4.cpp Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More