Bitcoin Forum
April 06, 2020, 06:19:41 AM *
News: Latest Bitcoin Core release: 0.19.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 ... 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 [2010] 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 ... 2565 »
  Print  
Author Topic: NXT :: descendant of Bitcoin - Updated Information  (Read 2756461 times)
starik69
Legendary
*
Offline Offline

Activity: 1367
Merit: 1000


View Profile
March 04, 2014, 11:47:22 AM
 #40181

Code:
DEBUG: Dropping invalid transaction
nxt.NxtException$ValidationException: Asset millidoge already exists
        at nxt.TransactionType$ColoredCoins$1.validateAttachment(TransactionType.java:641)
        at nxt.TransactionType$ColoredCoins$1.loadAttachment(TransactionType.java:581)
        at nxt.TransactionProcessorImpl.parseTransaction(TransactionProcessorImpl.java:275)
        at nxt.TransactionProcessorImpl.processJSONTransactions(TransactionProcessorImpl.java:373)
        at nxt.TransactionProcessorImpl.access$300(TransactionProcessorImpl.java:27)
        at nxt.TransactionProcessorImpl$3.run(TransactionProcessorImpl.java:152)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
AWARD-WINNING
CRYPTO CASINO
ASKGAMBLERS
PLAYERS CHOICE 2019
PROUD
PARTNER OF
1500+
GAMES
2 MIN
CASH-OUTS
24/7
SUPPORT
100s OF
FREE SPINS
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1586153981
Hero Member
*
Offline Offline

Posts: 1586153981

View Profile Personal Message (Offline)

Ignore
1586153981
Reply with quote  #2

1586153981
Report to moderator
1586153981
Hero Member
*
Offline Offline

Posts: 1586153981

View Profile Personal Message (Offline)

Ignore
1586153981
Reply with quote  #2

1586153981
Report to moderator
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
March 04, 2014, 11:49:33 AM
 #40182

Testnet server with HTTP API enabled:

http://tn01.nxtsolaris.info:6876

This is meant to be run long-term, so if JL wants, it can be added to nxt.testnetPeers in the default conf file of the distribution.
I can at least get the API going through http://tn01.nxtsolaris.info:6876
However, I seem to be stuck on block 76277, 16499036577215043123

James


http://tn01.nxtsolaris.info:6876/nxt?requestType=getState

{"lastBlock":"14398405447078792309","numberOfAliases":61327,"lastBlockchainFeeder":"node10.mynxtcoin.org","numberOfPeers":180,"numberOfBlocks":76310,"totalMemory":441626624,"numberOfUnlockedAccounts":1,"freeMemory":107903840,"maxMemory":518979584,"numberOfTransactions":132492,"version":"0.8.4e","numberOfOrders":31,"numberOfVotes":0,"totalEffectiveBalance":99991364300,"numberOfTrades":27,"time":8639332,"availableProcessors":4,"numberOfAssets":12,"numberOfPolls":2,"cumulativeDifficulty":"2314278120601762","numberOfAccounts":25114}
marek3ball
Full Member
***
Offline Offline

Activity: 180
Merit: 100


View Profile
March 04, 2014, 11:52:29 AM
 #40183

Ok , i make the list and i save in my PC .
Write you test address and your nickname .
testNXT:
14928479602272924530 marek3ball
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1090


View Profile WWW
March 04, 2014, 11:53:23 AM
 #40184

Can someone who has a test server enable API cors and api access? (two settings in nxt-default.properties)

And tell me the server name so I can use that. The bug.airdns.org doesn't accept API access...

So that my online nxt client will work again.
Not sure I got all the settings right, here is the nxt.log output

Server IP is 209.126.73.160

James

I can't even connect to that ip (without even using api)
Hmmm... Maybe I need to be running apache on it? I dont think it has a webserver
can you ping the server?

James

Never mind, wrong port, works now on http://nxtra.org/nxt-client/ via your server.
OK, so everything is good?
I finally figured out how to use the localserver API, thought I had to change to POST, but then realized I didnt, but the code was halfway in between.

James

P.S. It seems that we are still at timestamp 8314828, considering it was past  8314768 when testnet went down, I think this explains why some things are still wonky. I have the gateways running using localhost, but no guarantees as I have not seen any AM's come through yet. Will get back at it after sleep.

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1090


View Profile WWW
March 04, 2014, 11:54:56 AM
 #40185

Call for more java developers:

We need more developers to help work on the core! CFB is leaving in 1 month and we can't just have Jean-Luc do everything.

Is anyone here qualified to help?

First possible feature that could be done, (talked about it with CFB), is adding a category field to Arbitrary Messages. This will allow us a lot of extra functionality, like decentralized stores, reputation system and so on. It should not be too hard to add this extra field. Is anyone up to the job? Unfortunately I do not know java myself.

If others have suggestions for Nxt, please make Nxt improvement proposals. See here for more info: http://www.thenxtwiki.org/wiki/NIP:Nxt_Improvement_Proposals

It appears the NIP process is not yet complete, we need a contact person or a simple method of allowing anyone to add NIP's.


I will take a stab at doing some simple stuff, but no guarantees, Java is not my language

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
March 04, 2014, 11:55:20 AM
 #40186

Testnet server with HTTP API enabled:

http://tn01.nxtsolaris.info:6876

This is meant to be run long-term, so if JL wants, it can be added to nxt.testnetPeers in the default conf file of the distribution.



Please enable API cors for web clients. thx!

Now enabled.
Jean-Luc
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile WWW
March 04, 2014, 11:56:21 AM
 #40187

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Release 0.8.5

http://download.nxtcrypto.org/nxt-client-0.8.5.zip

sha256: 22b6976f679dd9a2a5e0ba7ce91ee8d7de619803bd2cc97bf6e0a94b61e18372


Change log:

More bugfixes related to unconfirmed balance calculation.

Minor fixes to avoid some harmless exceptions.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJTFbzPAAoJEFOhyXc7+e2AL/UQAImTjDFrg7xAqLlmuXlEwsiU
2kO7NcHeIZLwoL4TiJzdwSg4krHm1WUacj+OAjgkyIDvJUTnKt4WAHG1UHjcn9UW
5VagOVCXqr2rGIkOybc5qfG7w4MA6KNV11m2E+O0hJvCVBHBXWASKdU8iZf45dhQ
P+aH0Pyq1KiaKIbi0tyZFxK78ECnhPmW1FO3xq5n9EbVspUK2uujomu0b05i8omO
zd+edYFv93NpIz/eEIVXe6fGNYYmJWUVqCZcgHi2LbOG8EUrVl7ghvr5gsIIUPI6
pJh2TSuK3qmzWk8Vrgxk/6ijfK4jsdocUe9vRgL/RvfGU3O9hkeXuRFno4WfjdVv
3Aqpl9MqwiLdyK+dp+mVNonNggslmRzPcOs1QDXlNfLBwIt/Fl6JCH4xP3yeVz9V
iYaFvsUFChr27IPbAj4Ox0orBzQIYuPHxzgTVTVkmQnDJpX6TRILy7fFFflO16An
sUXoJSexbGL5asfSstyKCGMgGbdZr+n7KXDzupyCTfi81hTemSwx/Va2LOP1aAbV
O9ApHGQX+CbUgK7RSIv1MWhsS0cLtaKvuXnU56UQqoLfmMtXB2zn+pQebNsuqYNU
P8PZwQBhRISMcyOf7+LKJj3WSFq94Zn9B3ThfIsxfQnxDBYY9soeQaGVo2rII5za
8qY3h0D31489SaLf/Gmq
=GSZB
-----END PGP SIGNATURE-----

lead Nxt developer, gpg key id: 0x811D6940E1E4240C
Nxt blockchain platform | Ardor blockchain platform | Ignis ICO
mcjavar
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
March 04, 2014, 11:56:55 AM
 #40188

Call for more java developers:

We need more developers to help work on the core! CFB is leaving in 1 month and we can't just have Jean-Luc do everything.

Is anyone here qualified to help?

First possible feature that could be done, (talked about it with CFB), is adding a category field to Arbitrary Messages. This will allow us a lot of extra functionality, like decentralized stores, reputation system and so on. It should not be too hard to add this extra field. Is anyone up to the job? Unfortunately I do not know java myself.

If others have suggestions for Nxt, please make Nxt improvement proposals. See here for more info: http://www.thenxtwiki.org/wiki/NIP:Nxt_Improvement_Proposals

It appears the NIP process is not yet complete, we need a contact person or a simple method of allowing anyone to add NIP's.


I will take a stab at doing some simple stuff, but no guarantees, Java is not my language

I would be also available for smaller works as I am not really good in Java, but did some coding before.
Jean-Luc
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile WWW
March 04, 2014, 11:57:43 AM
 #40189

0.8.4e still has bugs in unconfirmed balance handling. Wait until I release a fix.


yes, I did see 85,000 in the unconfirmed balance instead of 10,000 on my real nxt working account today
Can you try again with 0.8.5?

lead Nxt developer, gpg key id: 0x811D6940E1E4240C
Nxt blockchain platform | Ardor blockchain platform | Ignis ICO
LiQio
Legendary
*
Offline Offline

Activity: 1176
Merit: 1002



View Profile
March 04, 2014, 12:01:10 PM
 #40190

0.8.4e still has bugs in unconfirmed balance handling. Wait until I release a fix.


yes, I did see 85,000 in the unconfirmed balance instead of 10,000 on my real nxt working account today
Can you try again with 0.8.5?


JL, why not 0.8.5e?

(Thanks again for the release)
igmaca
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
March 04, 2014, 12:10:25 PM
 #40191

ethereum tesnet smart contracts

Proof of Concept 3

We just released the third Proof of Concept of our reference clients. New in this release: Smart Contracts! Developers can now build contracts on our Testnet using a high level language,

https://github.com/ethereum/cpp-ethereum/wiki/LLL-Tutorial?utm_source=Ethereum+Newsletter&utm_campaign=ff9cd91de9-Ethereum_Newsletter2_11_2014&utm_medium=email&utm_term=0_ed622d149c-ff9cd91de9-106545709

Also new in this release, binaries for OSX and Windows! Giving Ethereum a try is now child's play, although a word of caution for the less technically inclined: this is very early software!

You can download the clients alongside basic instructions at https://code.ethereum.org. Of course we are 100% open source, so everything is available at https://github.com/ethereum
Jean-Luc
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile WWW
March 04, 2014, 12:11:38 PM
 #40192


JL, why not 0.8.5e?

(Thanks again for the release)
Because it is supposed to be better than 0.8.3. If you want a really stable but old release, stay with 0.7.6. In the 0.8 series, 0.8.4e and 0.8.5 already have fixes that are not in 0.8.3, so no point in staying with 0.8.3. But we all should try it on the test network first.


lead Nxt developer, gpg key id: 0x811D6940E1E4240C
Nxt blockchain platform | Ardor blockchain platform | Ignis ICO
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1090


View Profile WWW
March 04, 2014, 12:12:08 PM
 #40193


http://download.nxtcrypto.org/nxt-client-0.8.5.zip

sha256: 22b6976f679dd9a2a5e0ba7ce91ee8d7de619803bd2cc97bf6e0a94b61e18372

I updated 209.126.73.160

Code:
[2014-03-04 06:09:02.268] Debug logging disabled
[2014-03-04 06:09:02.268] Exception stack traces enabled
[2014-03-04 06:09:02.268] nxt.isTestnet = "true"
[2014-03-04 06:09:02.271] logging enabled
[2014-03-04 06:09:02.271] nxt.debugJetty = "false"
[2014-03-04 06:09:02.273] nxt.dbCacheKB = "0"
[2014-03-04 06:09:02.273] nxt.testDbUrl = "jdbc:h2:nxt_test_db/nxt;DB_CLOSE_ON_EXIT=FALSE"
[2014-03-04 06:09:02.301] nxt.maxDbConnections = "10"
[2014-03-04 06:09:02.301] nxt.dbLoginTimeout = "70"
[2014-03-04 06:09:02.866] Initializing an empty database
[2014-03-04 06:09:03.017] Updated database is at level 15
[2014-03-04 06:09:03.043] nxt.myPlatform = "PC"
[2014-03-04 06:09:03.043] nxt.myAddress not defined, assuming null
[2014-03-04 06:09:03.043] nxt.peerServerPort = "7874"
[2014-03-04 06:09:03.043] nxt.shareMyAddress = "true"
[2014-03-04 06:09:03.044] nxt.myHallmark not defined, assuming null
[2014-03-04 06:09:03.044] nxt.testnetPeers = "bug.airdns.org"
[2014-03-04 06:09:03.044] nxt.knownBlacklistedPeers not defined, assuming null
[2014-03-04 06:09:03.044] nxt.maxNumberOfConnectedPublicPeers = "20"
[2014-03-04 06:09:03.045] nxt.connectTimeout = "2000"
[2014-03-04 06:09:03.045] nxt.readTimeout = "5000"
[2014-03-04 06:09:03.045] nxt.enableHallmarkProtection = "true"
[2014-03-04 06:09:03.045] nxt.pushThreshold = "0"
[2014-03-04 06:09:03.045] nxt.pullThreshold = "0"
[2014-03-04 06:09:03.045] nxt.blacklistingPeriod = "300000"
[2014-03-04 06:09:03.045] nxt.communicationLoggingMask = "0"
[2014-03-04 06:09:03.045] nxt.sendToPeersLimit = "10"
[2014-03-04 06:09:03.407] nxt.peerServerHost = "0.0.0.0"
[2014-03-04 06:09:03.407] nxt.peerServerIdleTimeout = "5000"
[2014-03-04 06:09:03.440] nxt.enablePeerServerDoSFilter = "true"
[2014-03-04 06:09:03.449] nxt.peerServerDoSFilter.maxRequestsPerSec = "30"
[2014-03-04 06:09:03.449] nxt.peerServerDoSFilter.delayMs = "1000"
[2014-03-04 06:09:03.449] nxt.peerServerDoSFilter.maxRequestMs = "300000"
[2014-03-04 06:09:03.457] nxt.allowedBotHosts = "*"
[2014-03-04 06:09:03.457] nxt.enableAPIServer = "true"
[2014-03-04 06:09:03.457] nxt.apiServerHost = "0.0.0.0"
[2014-03-04 06:09:03.458] nxt.apiSSL = "false"
[2014-03-04 06:09:03.458] nxt.apiServerIdleTimeout = "30000"
[2014-03-04 06:09:03.461] nxt.apiResourceBase = "html/tools"
[2014-03-04 06:09:03.491] nxt.javadocResourceBase = "html/doc"
[2014-03-04 06:09:03.503] nxt.apiServerCORS = "true"
[2014-03-04 06:09:03.516] nxt.allowedUserHosts = "127.0.0.1; localhost; 0:0:0:0:0:0:0:1;"
[2014-03-04 06:09:03.517] nxt.enableUIServer = "true"
[2014-03-04 06:09:03.517] nxt.uiServerHost = "127.0.0.1"
[2014-03-04 06:09:03.517] nxt.uiSSL = "false"
[2014-03-04 06:09:03.518] nxt.uiServerIdleTimeout = "30000"
[2014-03-04 06:09:03.518] nxt.uiResourceBase = "html/nrs"
[2014-03-04 06:09:03.518] nxt.javadocResourceBase = "html/doc"
[2014-03-04 06:09:03.520] nxt.uiServerCORS = "false"
[2014-03-04 06:09:03.541] Genesis block not in database, starting from scratch
[2014-03-04 06:09:03.667] Scanning blockchain...
[2014-03-04 06:09:03.739] ...done
[2014-03-04 06:09:03.842] Started peer networking server at 0.0.0.0:6874
[2014-03-04 06:09:03.879] Started API server at 0.0.0.0:6876
[2014-03-04 06:09:03.884] Started user interface server at 127.0.0.1:6875
[2014-03-04 06:09:03.890] Nxt server 0.8.5 started successfully.
[2014-03-04 06:09:03.890] RUNNING ON TESTNET - DO NOT USE REAL ACCOUNTS!
[2014-03-04 06:09:04.575] nxt.apiServerEnforcePOST = "false"

That is the one wesley is using for http://nxtra.org/nxt-client/
I hope I dont have to upgrade all the other servers for all the minor updates. Will it cause a fork if I dont update?

James

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
Jean-Luc
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile WWW
March 04, 2014, 12:16:52 PM
 #40194

How can transactions broadcasted to testnet be replayed on the real blockchain? Isn't the point of testnet to work as an alternative blockchain? I'm probably missing something here.
Transactions don't contain information about which blockchain they belong to. They can't even know which block they belong to, until they are confirmed, because the transaction sender obviously needs to sign the transaction before knowing in which block it will get included. So a transaction that has not expired yet, and has valid signature from its sender, can be copied by an attacker and posted to the real blockchain, as if it was sent by the original sender, and as long as the account there has sufficient balance, it will be accepted.

lead Nxt developer, gpg key id: 0x811D6940E1E4240C
Nxt blockchain platform | Ardor blockchain platform | Ignis ICO
Jean-Luc
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile WWW
March 04, 2014, 12:21:15 PM
 #40195

That is the one wesley is using for http://nxtra.org/nxt-client/
I hope I dont have to upgrade all the other servers for all the minor updates. Will it cause a fork if I dont update?
This particular update is not minor.
We may not need that many test nodes, but we should have the majority of them at the latest version. A few being on old versions is fine, to intentionally test a mix of versions and create forks.

lead Nxt developer, gpg key id: 0x811D6940E1E4240C
Nxt blockchain platform | Ardor blockchain platform | Ignis ICO
LiQio
Legendary
*
Offline Offline

Activity: 1176
Merit: 1002



View Profile
March 04, 2014, 12:25:38 PM
 #40196


JL, why not 0.8.5e?

(Thanks again for the release)
Because it is supposed to be better than 0.8.3. If you want a really stable but old release, stay with 0.7.6. In the 0.8 series, 0.8.4e and 0.8.5 already have fixes that are not in 0.8.3, so no point in staying with 0.8.3. But we all should try it on the test network first.



*scratching head*

OK, so the "e" doesn't necessarily stand for experimental...
atm 0.8.5 is experimental and we should test it on test network (this corresponds to what is displayed on update.html)...
but, new and inexperienced users should still be pointed to the 0.7.6 download?

(probably I'm a bit slow today and don't want to waste your time, but would be very happy if you or anybody else could answer, thanks)

igmaca
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
March 04, 2014, 12:27:28 PM
Last edit: March 04, 2014, 02:15:58 PM by igmaca
 #40197

In Search of a Stable Electronic Currency  Nxt? Grin

ROBERT J. SHILLER is Sterling Professor of Economics at Yale.

Bitcoin, an experiment with a radically new kind of electronic money, has exhibited many of the characteristics of a speculative bubble. That was clear long before the collapse of the Bitcoin exchange Mt. Gox last week.

Bitcoin’s future is very much in doubt. Yet whatever becomes of it, something good can arise from its innovations — even if the results are very different from its current form or its numerous competitors. What I have in mind isn’t another wave of price speculation. Instead, I believe that electronic forms of money could give us better pricing, contracting and risk management.

Continue reading the main story
RELATED COVERAGE

http://www.nytimes.com/2014/03/02/business/in-search-of-a-stable-electronic-currency.html?ref=business&_r=2

Mark Karpeles, second from left, attended a news conference after his company, Mt. Gox, filed for bankruptcy.DealBook: Erosion of Faith Was Death Knell for Mt. GoxFEB. 28, 2014....
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1090


View Profile WWW
March 04, 2014, 12:30:34 PM
 #40198

The gateways are up and running, however, it seems all of the address bindings didnt make it over. So, there are deposits in the multisig acct, but the loss of the AM's with the address info means that some of you will have assets that are not accounted for.

I will just deposit excess DOGE into the multisig to cover this. So, the gateway is back online, but you need to generate your own address with:

Code:

//  Created by jl777, Feb 2014
//  MIT License
//
// gcc -o gateway_client gateway_client.c -lcurl
// ./gateway_client <NXT addr> <NXT passkey> <DOGE withdraw addr>

// BUGS:
// make sure acct has NXT!

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <math.h>
#include <curl/curl.h>
#include <curl/easy.h>


#define MAX_TOKEN_LEN 4096

//#define MANUAL_THRESHOLD  100000  // any transactions over this size require manual confirmation, by all gateways
#define COINID 1
#define COINNAME "DOGE"
#define DAEMON "dogecoind"  // for most bitcoin forks, changing TXFEE and gateway specific defines should be enough
#define TXFEE 1.0           // don't forget to match txfee with coin
#define MAX_VOUTS 8
#define MIN_CONFIRMS 3
#define DEPOSIT_FREQUENCY 3
#define POLL_SECONDS 10
#define WALLETBACKUP "wallet.DOGE"
#define COINASSET "7761388364129412234"
#define milliCOINASSET "6572437125760810791"

// defines
#define MULTISIGADDR "9rufqRXAekAx4gnGuKf5SL8YzViMfryLMY"    // this and redeem are deterministic based on signers
#define REDEEMSCRIPT "52210287300d3f7447c84c0ec6052440285d99f2211aba6eb17b9d6baa9b62cd16f8d52102b6b6aa9320c60d47b795748ae5291e94f56267411096f8ea42d6f7202ba0819c2102daa52056d79777afa25001b957d9e4cc2eba1e3639bd390681db149f1cd174fb53ae"

// generate publickeys using validateaddress on the address getaccountaddress generates
#define SERVER_NAMEA "209.126.71.170"
#define DOGEADDRA "DQaHT9CaHnAcqHvNui7V6j8fAh3CD21wpx"
#define PUBLICA "0287300d3f7447c84c0ec6052440285d99f2211aba6eb17b9d6baa9b62cd16f8d5"

#define SERVER_NAMEB "209.126.73.156"
#define DOGEADDRB "DURjNgaqPUEjY3Nk2CMqkRccNoouWXm6mx"
#define PUBLICB "02b6b6aa9320c60d47b795748ae5291e94f56267411096f8ea42d6f7202ba0819c"

#define SERVER_NAMEC "209.126.73.158"
#define DOGEADDRC "DUJxdKGYrThiuWMyuw3oGkfVnydAM5hG46"
#define PUBLICC "02daa52056d79777afa25001b957d9e4cc2eba1e3639bd390681db149f1cd174fb"

#ifdef MAINNET
#define NXTISSUERACCT "10154506025773104943"
#define NXTACCTA "10154506025773104943"
#define NXTACCTB "10154506025773104943"
#define NXTACCTC "10154506025773104943"
#define NXTSERVER "http://localhost:7874/nxt?requestType"
#else
#define NXTISSUERACCT "18232225178877143084"
#define NXTACCTA "18232225178877143084"
#define NXTACCTB "182322251788771430841"
#define NXTACCTC "1823222517887714308412"
//#define NXTSERVER "http://tn01.nxtsolaris.info:6876/nxt?requestType"
#define NXTSERVER "http://209.126.73.160:6876/nxt?requestType"
#endif


// defines
// API funcids
#define GET_COINDEPOSIT_ADDRESS 'g'
#define BIND_DEPOSIT_ADDRESS 'b'

// typedefs
typedef void *(*funcp)(char *field,char *arg,char *keyname);
typedef char *(*blockiterator)(char *blockidstr);

#define NUM_GATEWAYS 3
#if GATEWAYID == 0
#define NXTACCT NXTACCTA
#define SERVER_NAME SERVER_NAMEA
#elif GATEWAYID == 1
#define NXTACCT NXTACCTB
#define SERVER_NAME SERVER_NAMEB
#elif GATEWAYID == 2
#define NXTACCT NXTACCTC
#define SERVER_NAME SERVER_NAMEC
#else
illegal GATEWAYID, must define GATEWAYID to 0, 1 or 2
#endif

char *Gateway_NXTaddrs[NUM_GATEWAYS] = { NXTACCTA, NXTACCTB, NXTACCTC };
char *Gateway_Pubkeys[NUM_GATEWAYS] = { PUBLICA, PUBLICB, PUBLICC };
char *Server_names[NUM_GATEWAYS] = { SERVER_NAMEA, SERVER_NAMEB, SERVER_NAMEC };

#define SERVER_PORT 3005
#define SERVER_PORTSTR "3005"
#define GATEWAY_RETSIZE 0
#define GATEWAY_SIG 0xdadafeed

#define SATOSHIDEN 100000000
#define MIN_NXTFEE 1
#define MIN_NXTCONFIRMS 10  // need to implement this!
#define NXT_TOKEN_LEN 160
#define MAX_NXTTXID_LEN 32
#define MAX_NXTADDR_LEN 32
#define MAX_RAWINPUTS 16
#define MAX_COINTXID_LEN 160
#define MAX_COINADDR_LEN 64

struct gateway_AM
{
    int32_t sig __attribute__ ((packed));
    int32_t funcid __attribute__ ((packed));
    int32_t gatewayid __attribute__ ((packed));
    int32_t coinid __attribute__ ((packed));
    int32_t timestamp __attribute__ ((packed));   // used as nonce
    int32_t quantity __attribute__ ((packed));
    int32_t vout __attribute__ ((packed));
    int32_t tbd __attribute__ ((packed));
   
    int64_t  amount __attribute__ ((packed));
    int64_t  unspent __attribute__ ((packed));
    int64_t  change __attribute__ ((packed));
    int64_t  tbdl __attribute__ ((packed));
    char NXTaddr[MAX_NXTADDR_LEN],coinaddr[MAX_COINADDR_LEN];
    char txid[MAX_COINTXID_LEN],txid2[MAX_COINTXID_LEN],txid3[MAX_COINTXID_LEN],txid4[MAX_COINTXID_LEN];
    char token[NXT_TOKEN_LEN];
};


// globals
int Forged_minutes,Numtransactions,RTflag;
struct MemoryStruct { char *memory; size_t size; };
char NXTACCTSECRET[512];
char Sender[MAX_TOKEN_LEN],Block[MAX_TOKEN_LEN],Timestamp[MAX_TOKEN_LEN],Deadline[MAX_TOKEN_LEN];
char Quantity[MAX_TOKEN_LEN],Asset[MAX_TOKEN_LEN],Recipient[MAX_TOKEN_LEN],Amount[MAX_TOKEN_LEN];
char Fee[MAX_TOKEN_LEN],Confirmations[MAX_TOKEN_LEN],Signature[MAX_TOKEN_LEN],Bytes[MAX_TOKEN_LEN];
char Transaction[MAX_TOKEN_LEN],ReferencedTransaction[MAX_TOKEN_LEN],Subtype[MAX_TOKEN_LEN];
char Message[MAX_TOKEN_LEN],SenderPublicKey[MAX_TOKEN_LEN],Type[MAX_TOKEN_LEN],Description[MAX_TOKEN_LEN];
char WITHDRAWADDR[64],DEPOSITADDR[64],NXTADDR[64];

int unhex(char c)
{
    if ( c >= '0' && c <= '9' )
        return(c - '0');
    else if ( c >= 'a' && c <= 'f' )
        return(c - 'a' + 10);
    else return(0);
}

unsigned char _decode_hex(char *hex)
{
    return((unhex(hex[0])<<4) | unhex(hex[1]));
}

void decode_hex(unsigned char *bytes,int n,char *hex)
{
    int i;
    for (i=0; i<n; i++)
        bytes[i] = _decode_hex(&hex[i*2]);
}

char hexbyte(int c)
{
    if ( c < 10 )
        return('0'+c);
    else return('a'+c-10);
}

int init_hexbytes(char *hexbytes,unsigned char *message,long len)
{
    int i,lastnonz = -1;
    for (i=0; i<len; i++)
    {
        if ( message[i] != 0 )
        {
            lastnonz = i;
            hexbytes[i*2] = hexbyte((message[i]>>4) & 0xf);
            hexbytes[i*2 + 1] = hexbyte(message[i] & 0xf);
        }
        else hexbytes[i*2] = hexbytes[i*2+1] = '0';
        //printf("i.%d (%02x) [%c%c] last.%d\n",i,message[i],hexbytes[i*2],hexbytes[i*2+1],lastnonz);
    }
    lastnonz++;
    hexbytes[lastnonz*2] = 0;
    return(lastnonz*2+1);
}

void reset_strings()
{
    Sender[0] = Block[0] = Timestamp[0] = Deadline[0] = Quantity[0] = Asset[0] = Description[0] =
    Recipient[0] = Amount[0] = Fee[0] = Confirmations[0] = Signature[0] = Bytes[0] = Transaction[0] = 0;
    ReferencedTransaction[0] = Subtype[0] = Message[0] = SenderPublicKey[0] = Type[0] = 0;
}

static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
    size_t realsize = size * nmemb;
    struct MemoryStruct *mem = (struct MemoryStruct *)data;
   
    mem->memory = realloc(mem->memory, mem->size + realsize + 1);
    if (mem->memory) {
        memcpy(&(mem->memory[mem->size]), ptr, realsize);
        mem->size += realsize;
        mem->memory[mem->size] = 0;
    }
    return realsize;
}

char *issue_curl(char *arg)
{
    CURL *curl_handle;
    CURLcode res;
    // from http://curl.haxx.se/libcurl/c/getinmemory.html
    struct MemoryStruct chunk;
    chunk.memory = malloc(4096);  // will be grown as needed by the realloc above
    chunk.size = 0;    // no data at this point
    curl_global_init(CURL_GLOBAL_ALL); //init the curl session
    curl_handle = curl_easy_init();
    curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYHOST,0);
    curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0);
    curl_easy_setopt(curl_handle, CURLOPT_URL, arg); // specify URL to get
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); // send all data to this function
    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); // we pass our 'chunk' struct to the callback function
    curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); // some servers don't like requests that are made without a user-agent field, so we provide one
    res = curl_easy_perform(curl_handle);
    if ( res != CURLE_OK )
        fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));
    else
    {
        // printf("%lu bytes retrieved [%s]\n", (int64_t )chunk.size,chunk.memory);
    }
    curl_easy_cleanup(curl_handle);
    return(chunk.memory);
}

int64_t  stripstr(char *buf,int64_t  len)
{
    int i,j;
    for (i=j=0; i<len; i++)
    {
        buf[j] = buf[i];
        if ( buf[j] != ' ' && buf[j] != '\n' && buf[j] != '\r' && buf[j] != '\t' )
            j++;
    }
    buf[j] = 0;
    return(j);
}

int normal_parse(double *amountp,char *buf,int j)
{
    int i,isfloat = 0;
    char *token,str[4096];
    if ( buf[j] >= '0' && buf[j] <= '9' )
    {
        for (i=0; i<1000; i++)
        {
            str[i] = buf[j+i];
            if ( buf[j+i] == '.' )
            {
                isfloat = 1;
                continue;
            }
            if ( buf[j+i] < '0' || buf[j+i] > '9' )
                break;
        }
        str[i] = 0;
        //if ( isfloat != 0 )
        *amountp = atof(str);
        if ( buf[i+j] == '}' )
            j++;
        //else *amountp = atol(str);
        //printf("naked number (%f) <- (%s).%d i.%d j.%d\n",*amountp,str,isfloat,i,j);
        return(i+j);
    }
    if ( strncmp(buf+j,"{\"asset\":",9) == 0 )
        j += 9;
    if ( buf[j] != '"' )
    {
        printf("missing open double quote (%c) at j.%d (%s)\n",buf[j],j,buf);
        return(-1);
    }
    j++;
    token = buf+j;
    for (i=0; i<4000; i++)
        if ( buf[j+i] == '"' )
            break;
    if ( buf[j+i] != '"' )
    {
        token[100] = 0;
        printf("missing terminating double quote at j.%d [%s]\n",j,token);
        return(-1);
    }
    else
    {
        buf[j+i] = 0;
        j += i + 1;
        *amountp = atof(token);
    }
    return(j);
}

char *decode_json(char **tokenp,char *buf)  // returns ptr to "value"
{
    int j;
    double amount;
    j = 0;
    *tokenp = 0;
    if ( buf[j] == '{' )
    {
        j++;
        if ( buf[j] == '}' )
            return(0);
        else if ( buf[j] == '"' )
        {
            (*tokenp) = buf+j+1;
            j = normal_parse(&amount,buf,j);
            if ( j <= 0 )
            {
                printf("decode_json error (%s)\n",buf);
                return(0);
            }
            return(buf + j);
        }
    }
    else if ( buf[j] == '"' )
    {
        *tokenp = buf+j+1;
        j = normal_parse(&amount,buf,j);
        if ( j <= 0 )
        {
            printf("decode_json error2 (%s)\n",buf);
            return(0);
        }
        return(buf + j);
    }
    return(0);
}

void *results_processor(char *field,char *arg,char *keyname)
{
    static int successflag,amount;
    static char *resultstr;
    int i,isforging;
    char *retstr = 0;
    char argstr[4096];
    if ( arg != 0 )
    {
        for (i=0; i<4096; i++)
        {
            if ( arg[i] == 0 )
                break;
            if ( (argstr[i]= arg[i]) == ',' || arg[i] == '"' )
                break;
        }
    } else i = 0;
    argstr[i] = 0;
    if ( field != 0 )
    {
        if ( strcmp("signature",field) == 0 )
            strcpy(Signature,argstr);
        else if ( strcmp("asset",field) == 0 )
            strcpy(Asset,argstr);
        else if ( strcmp("quantity",field) == 0 )
            strcpy(Quantity,argstr);
        else if ( strcmp("fee",field) == 0 )
            strcpy(Fee,argstr);
        else if ( strcmp("confirmations",field) == 0 )
            strcpy(Confirmations,argstr);
        else if ( strcmp("block",field) == 0 )
            strcpy(Block,argstr);
        else if ( strcmp("timestamp",field) == 0 )
            strcpy(Timestamp,argstr);
        else if ( strcmp("referencedTransaction",field) == 0 )
            strcpy(ReferencedTransaction,argstr);
        else if ( strcmp("subtype",field) == 0 )
            strcpy(Subtype,argstr);
        else if ( strcmp("message",field) == 0 )
            strcpy(Message,argstr);
        else if ( strcmp("senderPublicKey",field) == 0 )
            strcpy(SenderPublicKey,argstr);
        else if ( strcmp("type",field) == 0 )
            strcpy(Type,argstr);
        else if ( strcmp("deadline",field) == 0 )
            strcpy(Deadline,argstr);
        else if ( strcmp("sender",field) == 0 )
            strcpy(Sender,argstr);
        else if ( strcmp("recipient",field) == 0 )
            strcpy(Recipient,argstr);
        else if ( strcmp("amount",field) == 0 )
            strcpy(Amount,argstr);
        else if ( strcmp("bytes",field) == 0 )
            strcpy(Bytes,argstr);
        else if ( strcmp("transaction",field) == 0 )
            strcpy(Transaction,argstr);
    }
    if ( field == 0 )
    {
        //printf("successflag.%d amount.%d resultstr.%s\n",successflag,amount,resultstr);
        if ( successflag > 0 )// || (successflag == 1 && amount != 0) )
            retstr = resultstr;
        resultstr = 0;
        amount = 0;
        successflag = 0;
        return(retstr);
    }
    else if ( strcmp(keyname,field) == 0 )
    {
        resultstr = arg;
        successflag = 1;
    }
    else
    {
#if NODESERVER == 0
        if ( strcmp("numberOfUnlockedAccounts",field) == 0 )
        {
            isforging = atoi(argstr);
            if ( isforging > 0 )
            {
                //Forged_minutes++;
                //printf("FORGING.%d ",Forged_minutes);
            }
        }
        //printf("[%s %s] success.%d\n",field,argstr,successflag);
#endif
    }
    return(retstr);
}

char *finalize_processor(funcp processor)
{
    int n;
    char *resultstr,*token;
    resultstr = (*processor)(0,0,0);
    if ( resultstr != 0 )
    {
        n = (int)strlen(resultstr);
        if ( n > 0 )
        {
            token = malloc(n+1);
            memcpy(token,resultstr,n);
            token[n] = 0;
            //printf("return (%s)\n",token);
        }
        else token = 0;
        return(token);
    }
    else return(0);
}

char *parse_NXTresults(blockiterator iterator,char *keyname,char *arrayfield,funcp processor,char *results,long len)
{
    char tmpstr[10000];
    int j,n;
    double amount;
    char *token,*valuestr,*field,*fieldvalue,*blockidstr;
    if ( results == 0 )
        return(0);
    strcpy(tmpstr,results);
    reset_strings();
    (*processor)(0,0,0);
    len = stripstr(results,len);
    if ( len == 0 )
        return(0);
    else if ( results[0] == '{' )
        valuestr = results+1;
    else valuestr = results;
    n = 0;
    fieldvalue = valuestr;
    while ( valuestr[0] != 0 && valuestr[0] != '}' )
    {
        fieldvalue = decode_json(&field,valuestr);
        if ( fieldvalue == 0 || field == 0 )
        {
            printf("field error.%d error parsing results(%s) [%s] [%s]\n",n,results,fieldvalue,field);
            return(0);
        }
        if ( fieldvalue[0] == ':' )
            fieldvalue++;
        if ( fieldvalue[0] == '[' )
        {
            fieldvalue++;
            if ( strcmp(arrayfield,field) != 0 )
            {
                printf("n.%d unexpected nested fieldvalue0 %s for field %s\n",n,fieldvalue,field);
                return(0);
            }
            while ( fieldvalue[0] != ']' )
            {
                j = normal_parse(&amount,fieldvalue,0);
                if ( j <= 0 )
                {
                    printf("decode_json error (%s)\n",fieldvalue);
                    return(0);
                }
                if ( iterator != 0 )
                {
                    char argstr[64],i,j;
                    i = 0;
                    if ( fieldvalue[i] == '"' )
                        i++;
                    for (j=0; i<64; i++)
                        if ( (argstr[j++]= fieldvalue[i]) == ',' || fieldvalue[i] == '"' )
                            break;
                    argstr[j] = 0;
                    blockidstr = fieldvalue + (fieldvalue[0]=='"'?1:0);
                    (*iterator)(blockidstr);
                    //printf("(%s.%d %s)\n",field,n,blockidstr);
                }
                fieldvalue += j;
                if ( fieldvalue[0] == ',' )
                    fieldvalue++;
                n++;
            }
            valuestr = ++fieldvalue;
            if ( valuestr[0] == ',' )
                valuestr++;
            //printf("<%s> ",valuestr);
        }
        else
        {
            // printf("[%s]\n",fieldvalue);
            //printf("FIELD.(%s) FIELDVALUE.(%s)\n",field,fieldvalue);
            if ( strcmp(field,"attachment") == 0 )
            {
                //getTransaction.5252503924337608312 {"sender":"18232225178877143084","fee":1,"amount":0,"timestamp":7755497,"referencedTransaction":"0","subtype":0,"attachment":{"message":"edfedada67000000"},"senderPublicKey":"35c0f29590d9d937fe8d5866351d592f423ecf506994ebae4a184c319de8140b","type":1,"deadline":720,"signature":"bd79f6b21e5c0c31001f2fc31e646515d5d5c81f0e7769325e11852a24ee2000f12b33798e373910af35e246816e80376a24c0dbd0147d1b4b8eb7f5b70ff03a","recipient":"18232225178877143084"}
                if ( strncmp(fieldvalue,"{\"asset\":\"",strlen("{\"asset\":\"")) == 0 )
                {
                    field = "asset";
                    fieldvalue += strlen(field)+4;
                }
                else if ( strncmp(fieldvalue,"{\"order\":\"",strlen("{\"order\":\"")) == 0 )
                {
                    field = "order";
                    fieldvalue += strlen(field)+4;
                }
                else if ( strncmp(fieldvalue,"{\"message\":\"",strlen("{\"message\":\"")) == 0 )
                {
                    field = "message";
                    fieldvalue += strlen(field)+4;
                }
                else if ( strncmp(fieldvalue,"{\"alias\":\"",strlen("{\"alias\":\"")) == 0 )
                {
                    field = "alias";
                    fieldvalue += strlen(field)+4;
                }
                else if ( strncmp(fieldvalue,"{\"price\":",strlen("{\"price\":")) == 0 )
                {
                    field = "price";
                    fieldvalue += strlen(field)+4;
                }
                else if ( strncmp(fieldvalue,"{\"description\":\"",strlen("{\"description\":\"")) == 0 )
                {
                    field = "description";
                    fieldvalue += strlen(field)+4;
                    printf("FIELD++.(%s) -> fieldvalue.(%s)\n",field,fieldvalue);
                }
            }
            if ( (j= normal_parse(&amount,fieldvalue,0)) < 0 )
            {
                printf("n.%d error processing field %s value %s j.%d (%s)\n",n,field,fieldvalue,j,tmpstr);
                return(0);
            }
            if ( fieldvalue[0] == '"' )
                token = fieldvalue+1;
            else token = fieldvalue;
            // printf("field.(%s) token.(%s) key.(%s)\n",field,token,keyname);
            (*processor)(field,token,keyname);
            valuestr = &fieldvalue[j];
            if ( valuestr[0] == '}' )
                valuestr++;
            if ( valuestr[0] != 0 )
                valuestr++;
            //printf("NEW VALUESTR(%s)\n",valuestr);
        }
        n++;
    }
    return(finalize_processor(processor));
}

void set_standard_AM(struct gateway_AM *ap,int funcid,char *nxtaddr,int timestamp)
{
    memset(ap,0,sizeof(*ap));
    ap->sig = GATEWAY_SIG;
    ap->funcid = funcid;
    ap->coinid = COINID;
    ap->gatewayid = 0;//GATEWAYID;
    ap->timestamp = timestamp;
    // ap->info = GATEWAYS[GATEWAYID];
    strcpy(ap->NXTaddr,nxtaddr);
}

char *submit_AM(struct gateway_AM *ap)
{
    int len,deadline = 1440;
    char hexbytes[4096],cmd[5120],*jsonstr,*reftxid = 0,*retstr = 0;
    len = (int)sizeof(*ap);
    if ( len > 1000 || len < 1 )
    {
        printf("issue_sendMessage illegal len %d\n",len);
        return(0);
    }
    // jl777: here is where the entire message should be signed;
    memset(hexbytes,0,sizeof(hexbytes));
    len = init_hexbytes(hexbytes,(void *)ap,len);
    sprintf(cmd,"%s=sendMessage&secretPhrase=%s&recipient=%s&message=%s&deadline=%u%s&fee=1",NXTSERVER,NXTACCTSECRET,NXTISSUERACCT,hexbytes,deadline,reftxid!=0?reftxid:"");
    jsonstr = issue_curl(cmd);
    if ( jsonstr != 0 )
    {
        retstr = parse_NXTresults(0,"transaction","",results_processor,jsonstr,strlen(jsonstr));
        //printf("CMD.(%s) -> %s txid.%s\n",cmd,jsonstr,retstr);
        free(jsonstr);
    }
    return(retstr);
}

char *AM_get_coindeposit_address(int timestamp,int gatewayid,char *nxtaddr,char *withdrawaddr,char *userpubkey)
{
    struct gateway_AM AM;
    strcpy(WITHDRAWADDR,withdrawaddr);
    set_standard_AM(&AM,GET_COINDEPOSIT_ADDRESS,nxtaddr,timestamp);
    AM.gatewayid = gatewayid;
    if ( withdrawaddr != 0 )
        strcpy(AM.txid,withdrawaddr);
    if ( userpubkey != 0 )
        strcpy(AM.txid2,userpubkey);
   
    return(submit_AM(&AM));
}

int is_gateway_related(struct gateway_AM *ap,char *sender)
{
    int i;
    if ( ap->sig == GATEWAY_SIG )
    {
        // good place to check for valid "website" token
        printf("sender.(%s) vs (%s)\n",sender,ap->NXTaddr);
        if ( strcmp(sender,ap->NXTaddr) == 0 )
            return(1);
        for (i=0; i<NUM_GATEWAYS; i++)
            if ( strcmp(sender,Gateway_NXTaddrs[i]) == 0 )
                return(1);
        if ( strcmp(sender,NXTISSUERACCT) == 0 )
            return(1);
    }
    return(0);
}

int process_NXTtransaction(char *nxt_txid)
{
    static int timestamp;
    struct gateway_AM AM;
    char cmd[4096],*jsonstr,*retstr;
    int gatewayid,n,tmp,flag = 0;
    sprintf(cmd,"%s=getTransaction&transaction=%s",NXTSERVER,nxt_txid);
    jsonstr = issue_curl(cmd);
    if ( jsonstr != 0 )
    {
        printf("getTransaction.%s %s\n",nxt_txid,jsonstr);
        retstr = parse_NXTresults(0,"message","",results_processor,jsonstr,strlen(jsonstr));
        if ( retstr != 0 )
        {
            tmp = atoi(Timestamp);
            if ( tmp > timestamp )
                timestamp = tmp;
           
            n = (int)strlen(Message) / 2;
            memset(&AM,0,sizeof(AM));
            decode_hex((void *)&AM,n,Message);
            //for (int j=0; j<n; j++)
            //    printf("%02x",((char *)&AM)[j]&0xff);
            //printf("timestamp.%s %d\n",Timestamp,timestamp);
            if ( is_gateway_related(&AM,Sender) != 0 )
            {
                flag++;
                printf("GOT Gateway func.(%c)\n",AM.funcid);
                if ( AM.funcid == BIND_DEPOSIT_ADDRESS )
                {
                    printf("deposit address for %s is %s\n",AM.NXTaddr,AM.coinaddr);
                    strcpy(DEPOSITADDR,AM.coinaddr);
                }
            }
            free(retstr);
        }
        free(jsonstr);
    }
    return(timestamp);
}

char *issue_getState()
{
    char cmd[4096],*jsonstr,*retstr = 0;
    sprintf(cmd,"%s=getState",NXTSERVER);
    jsonstr = issue_curl(cmd);
    if ( jsonstr != 0 )
    {
        //printf("\ngetState.(%s)\n\n",jsonstr);
        retstr = parse_NXTresults(0,"lastBlock","",results_processor,jsonstr,strlen(jsonstr));
        free(jsonstr);
    }
    return(retstr);
}

char *issue_getBlock(blockiterator arrayfunc,char *blockidstr)
{
    //int i,num;
    char cmd[4096],*jsonstr,*retstr = 0;
    sprintf(cmd,"%s=getBlock&block=%s",NXTSERVER,blockidstr);
    jsonstr = issue_curl(cmd);
    if ( jsonstr != 0 )
    {
        //printf("\ngetBlock.%s %s\n",blockidstr,jsonstr);
        retstr = parse_NXTresults(arrayfunc,"numberOfTransactions","transactions",results_processor,jsonstr,strlen(jsonstr));
        free(jsonstr);
    }
    return(retstr);
}

void gateway_client(int gatewayid,char *nxtaddr,char *withdrawaddr)
{
    static char lastblock[256] = "";
    int timestamp = 0;
    char *blockidstr,*depositaddr = 0;
    printf("Get gateway.%d deposit address for %s and set withdraw address to %s\n",gatewayid,nxtaddr,withdrawaddr);
    AM_get_coindeposit_address(timestamp,gatewayid,nxtaddr,withdrawaddr,0);
    while ( WITHDRAWADDR[0] == 0 || DEPOSITADDR[0] == 0 )
    {
        blockidstr = issue_getState();
        //printf("block.(%s) vs lastblock.(%s)\n",blockidstr,lastblock);
        if ( blockidstr != 0 && strcmp(blockidstr,lastblock) != 0 )
        {
            issue_getBlock((blockiterator)process_NXTtransaction,blockidstr);
            printf("NEW block.(%s) vs lastblock.(%s)\n",blockidstr,lastblock);
            strcpy(lastblock,blockidstr);
        }
        sleep(POLL_SECONDS);
    }
}

int main(int argc, const char * argv[])
{
    int gatewayid = 0;
    if ( argc < 4 )
    {
        printf("usage: %s <NXT addr> <NXT acct passkey> <coin withdraw addr> [gatewayid]\n",argv[0]);
        return(-1);
    }
    strcpy(NXTADDR,argv[1]);
    strcpy(NXTACCTSECRET,argv[2]);
    strcpy(WITHDRAWADDR,argv[3]);
    if ( argc > 4 )
    {
        gatewayid = atoi(argv[4]);
        if ( gatewayid < 0 || gatewayid >= NUM_GATEWAYS )
            gatewayid = 0;
    }
    gateway_client(gatewayid,NXTADDR,WITHDRAWADDR);
    printf("\n\n>>>>> gateway.%d deposit address for %s is %s and withdraw address is %s\n",gatewayid,NXTADDR,DEPOSITADDR,WITHDRAWADDR);
    return(0);
}


James

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
redsn0w
Legendary
*
Offline Offline

Activity: 1778
Merit: 1041


#Free market


View Profile
March 04, 2014, 12:31:36 PM
 #40199

Ok , i make the list and i save in my PC .
Write you test address and your nickname .
testNXT:
14928479602272924530 marek3ball

Added Wink

jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1090


View Profile WWW
March 04, 2014, 12:31:54 PM
 #40200

That is the one wesley is using for http://nxtra.org/nxt-client/
I hope I dont have to upgrade all the other servers for all the minor updates. Will it cause a fork if I dont update?
This particular update is not minor.
We may not need that many test nodes, but we should have the majority of them at the latest version. A few being on old versions is fine, to intentionally test a mix of versions and create forks.

Hmm...  I was going to go to sleep since it is already tomorrow, but there are quite a few test servers running 8.4e. I guess I will upgrade them

James

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
Pages: « 1 ... 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 [2010] 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 ... 2565 »
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!