Bitcoin Forum
April 28, 2024, 10:16:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 ... 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 [1743] 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 ... 2557 »
  Print  
Author Topic: NXT :: descendant of Bitcoin - Updated Information  (Read 2761529 times)
2Kool4Skewl (OP)
Sr. Member
****
Offline Offline

Activity: 644
Merit: 250



View Profile WWW
February 18, 2014, 04:34:29 AM
 #34841

Dear supporters,

 I want to talk with you about the future of Nxt.org. I'm working with Passion_ltc together to make this website the center for the whole Nxt ecosystem.

We have many great ideas for the website, but before we start we need to talk about something inconvenient: the money.

I paid 157,000 NXT and 6 BTC for the domain. A few guys maybe are thinking that this is far too much, but I don't think so. With Nxt.org we finally have a quality domain for a quality product, and if we consider that Nxt will be the future of money then the money was well spent!

2Kool4Skewl asked on nextcoin.org about acquiring the domain. And I'm pretty sure that someone said there was a bounty for this domain.

So I want to ask you if someone knows more about the bounty. Maybe I could get a nice sum of the money back though this?

Thank you very much!

Greetings,
BitVenturer

Quote
According to my calculations if each one of this account (http://87.230.14.1/nxt/nxt.cgi?action=34)
will pay at least 30K nxt from his balance, it will be 1.8M NXT, I think its a fair price

Just give the community the domain for 157,000 NXT and 6 BTC. Maybe a little premium on top. But that's it.

The community didn't appreciate the fact that I got the name, my effort and resources...
You think that the name doesn't cost 1.8M ?
"Community" != "Customer"

I'll give you 250k and donate the domain back to the community.

1.8M Nxt is 172.8 Btc.  That's a high markup that I don't think the community can afford for one domain name.

Let's assume that Nxt is 0.00007 Btc, which was probably approximately the rate Nxt was trading for around the time you purchased the domain.

You spent 6 Btc and 157,000 Nxt for the domain.  6 Btc / 0.00007 Btc per Nxt = 85714.28 Nxt + 157,000 Nxt = 242,715 Nxt

So, you spent approximately 243k Nxt on the domain name.  You would like 1,800,000 Nxt.  I can appreciate the fact that you would like to be rewarded for getting the domain, but I think a 7400% markup is too much.

If everyone can agree on an amount, I'm sure the community would have no problem giving you a bounty for registering the domain.  You would have to transfer control of the domain over to opticalc.


                      ▄████████▄
                  ▄████████████████▄
             ▄██████████████████████████▄
      ▄███████████████████████████████████████▄
 ███████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
  █████████████████████████████████████████████████
   ███████████████████████████████████████████████
   ███████████████████████████████████████████████
    █████████████████████████████████████████████
     ███████████████████████████████████████████
      █████████████████████████████████████████
       ███████████████████████████████████████
        █████████████████████████████████████
         ███████████████████████████████████
          █████████████████████████████████
           ▀█████████████████████████████▀
             ▀█████████████████████████▀
               ▀█████████████████████▀
                 ▀█████████████████▀
                   ▀█████████████▀
                      ▀███████▀
TRUSTEE 
1714299401
Hero Member
*
Offline Offline

Posts: 1714299401

View Profile Personal Message (Offline)

Ignore
1714299401
Reply with quote  #2

1714299401
Report to moderator
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714299401
Hero Member
*
Offline Offline

Posts: 1714299401

View Profile Personal Message (Offline)

Ignore
1714299401
Reply with quote  #2

1714299401
Report to moderator
2Kool4Skewl (OP)
Sr. Member
****
Offline Offline

Activity: 644
Merit: 250



View Profile WWW
February 18, 2014, 04:38:04 AM
 #34842

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

That sounds about right.  Account control is being implemented which will allow you to lease your Nxt's forging power to a pool.  This will allow smaller forgers to get consistent fees in relation to their Nxt holdings.


                      ▄████████▄
                  ▄████████████████▄
             ▄██████████████████████████▄
      ▄███████████████████████████████████████▄
 ███████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
  █████████████████████████████████████████████████
   ███████████████████████████████████████████████
   ███████████████████████████████████████████████
    █████████████████████████████████████████████
     ███████████████████████████████████████████
      █████████████████████████████████████████
       ███████████████████████████████████████
        █████████████████████████████████████
         ███████████████████████████████████
          █████████████████████████████████
           ▀█████████████████████████████▀
             ▀█████████████████████████▀
               ▀█████████████████████▀
                 ▀█████████████████▀
                   ▀█████████████▀
                      ▀███████▀
TRUSTEE 
newcn
Full Member
***
Offline Offline

Activity: 143
Merit: 100


View Profile
February 18, 2014, 04:41:05 AM
 #34843

I just made a statistic of this hot thread
the number of total ids appeared in this thread is 488,
the number of new ids appeared in recent 3 days is 93,
CFB is the top1 id who posted 2005 posts!
the following are top100 ids:
Code:
  rank npost   ID
 

there're 953 ids in this tread now, top100 ids are:
Code:
  rank  npost   id
 

number of IDs vs time:


statistic of number of post within a day:

BTC:1NzzfeHCgN8fF6mSG1UeBFCVd2cxKbGyHk
NXT:13187911577562526278
gitinahang
Jr. Member
*
Offline Offline

Activity: 43
Merit: 30


View Profile
February 18, 2014, 04:42:57 AM
 #34844

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

No begging please. This is not Dogecoin. Buy some nxt at an exchange. If you don't have money wash cars, walk dogs, shovel snow, do anything to buy as much as possible it will be worth it. Even with 100k nxt you will not make any money forging so get that mentality out of your head from the start and welcome to the beginning of the rest of your life. Or you can mine any alt coin and miss out on being rich and being a part of the new economy.   Cheesy
MarvellousMutant
Newbie
*
Offline Offline

Activity: 39
Merit: 0


View Profile
February 18, 2014, 04:45:20 AM
 #34845

[...]

The big rule of wiki editing is be bold, because mistakes can always be fixed, changes can always be reverted, but nothing happens if no one starts doing it. I'm a hypocrite for saying this (but I'm working on it!). There's social conditioning holding us back, like in the company of so many smart people here, I keep feeling like I'm not the guy who should be doing this. But in order to achieve a truly free market of both price and ideas (which I believe we're all working towards), we need to grow past this, be willing to put our ideas and works up on the frontline, even if they're premature,  flawed or even awful. Let other people improve it as time goes by. And in return, we should not regard those who stepped up first and fell short harshly.

+1
People, write on the wiki! Lets make it less of a ghost town!
brooklynbtc
Sr. Member
****
Offline Offline

Activity: 336
Merit: 250

AKA jefdiesel


View Profile
February 18, 2014, 04:49:10 AM
 #34846

Is anyone noticing less forging with 0.7.5?

I have enough to forge every 30 hours or so, but lately the targets are SO LOW, that it's been days since I hit a block. Tonight it got down to 30 minutes, but nothing seems to have happened, nothing in the blockchain explorer, and no alert from mynxt.info and now its back to 4.5 days.

seems weird, dunno.

SN
S   U   P   E   R    N   E   T
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀   
Uniting cryptocurrencies, Rewarding talent, Sharing benefits..

Blockchain Technology.

2Kool4Skewl (OP)
Sr. Member
****
Offline Offline

Activity: 644
Merit: 250



View Profile WWW
February 18, 2014, 04:51:45 AM
 #34847

Part 2 of ZipZap and GoCoin

When I spoke to the guys at the conference, both were asking basically the same thing:

"How is the market we attract different than Bitcoin/Litecoin"

This is an extremely valuable point.  If we don't bring in a different market segment, why add redundancy. I know some people don't like the green/eco area, that's cool, but it's a legit difference.  As Bitcoin continues to get larger, some people aren't going to be fond of the amount of resources it utilizes. Nxt should be able to appeal to that market on a mass scale.

What else? Why add us if you already have Bitcoin/Litecoin?


This is important, not just mental masturbation. I'd like to make contact again by the end of the week.


Green is nice, but not the important thing.

NXT is PoS
NXT is a whole ecosystem
NXT is new code. ( when they find a flaw in BTC, its not in NXT)


Which is great for us, but does not answer the demographic questions we were presented.  Nikel and I talked in detail about everything you said above, while that's fantastic for the crypto nerds among us... (PoS gives me a binary chubby) it doesn't give a reason for a payment processor to add us when Bitcoin and Litecoin will already satisfy most of the assumed market. Does that make sense? Try talking ecosystem with your local mom and pop shop down the road. Smiley


This is exactly why face to face meetings are so important, you can cut right through the bull and figure out why we're not already accepted in specific services.  I needed to wait to follow-up due to client development.. now we're in a place to demo a few different types, follow-up is ready.


One argument can be we'll attract a much more technical base. The flaws in Bitcoin code also makes some sense, but that's more of a retention than attraction tool. Are there specific market segments that we could bring to the party that the others might not initially attract without serious effort. Maybe you can help me expand on those ideas and help frame it as a benefit to those organizations?

It's not about us, it's about how our involvement can benefit the company which also benefits us. That's why part 1 is about the liquidity charts that both parties really appreciated. Another is the amount of money we have stashed away for marketing and projects.. we're serious about developing and promoting Nxt (along with it's partners) for the long term. I believe that is a benefit the others can't claim.



We believe in the decentralization of the security of our network.  PoW currencies get centralized.  BTC is getting more and more centralized.  Now with ASICs for scrypt appearing, Litecoin will follow the same fate.

Decentralization appeals to a wide mass of people who are not comfortable with their security being controlled by a select few.


                      ▄████████▄
                  ▄████████████████▄
             ▄██████████████████████████▄
      ▄███████████████████████████████████████▄
 ███████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
  █████████████████████████████████████████████████
   ███████████████████████████████████████████████
   ███████████████████████████████████████████████
    █████████████████████████████████████████████
     ███████████████████████████████████████████
      █████████████████████████████████████████
       ███████████████████████████████████████
        █████████████████████████████████████
         ███████████████████████████████████
          █████████████████████████████████
           ▀█████████████████████████████▀
             ▀█████████████████████████▀
               ▀█████████████████████▀
                 ▀█████████████████▀
                   ▀█████████████▀
                      ▀███████▀
TRUSTEE 
grandpa_seth
Sr. Member
****
Offline Offline

Activity: 316
Merit: 250

Simcoin Puny Humans Communicator


View Profile
February 18, 2014, 04:54:41 AM
 #34848

Is anyone noticing less forging with 0.7.5?

I have enough to forge every 30 hours or so, but lately the targets are SO LOW, that it's been days since I hit a block. Tonight it got down to 30 minutes, but nothing seems to have happened, nothing in the blockchain explorer, and no alert from mynxt.info and now its back to 4.5 days.

seems weird, dunno.

I have a similar amount and was thinking the same thing.
nxtsky
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
February 18, 2014, 04:59:09 AM
 #34849

Dear supporters,

 I want to talk with you about the future of Nxt.org. I'm working with Passion_ltc together to make this website the center for the whole Nxt ecosystem.

We have many great ideas for the website, but before we start we need to talk about something inconvenient: the money.

I paid 157,000 NXT and 6 BTC for the domain. A few guys maybe are thinking that this is far too much, but I don't think so. With Nxt.org we finally have a quality domain for a quality product, and if we consider that Nxt will be the future of money then the money was well spent!

2Kool4Skewl asked on nextcoin.org about acquiring the domain. And I'm pretty sure that someone said there was a bounty for this domain.

So I want to ask you if someone knows more about the bounty. Maybe I could get a nice sum of the money back though this?

Thank you very much!

Greetings,
BitVenturer

Quote
According to my calculations if each one of this account (http://87.230.14.1/nxt/nxt.cgi?action=34)
will pay at least 30K nxt from his balance, it will be 1.8M NXT, I think its a fair price

Just give the community the domain for 157,000 NXT and 6 BTC. Maybe a little premium on top. But that's it.

The community didn't appreciate the fact that I got the name, my effort and resources...
You think that the name doesn't cost 1.8M ?
"Community" != "Customer"

I'll give you 250k and donate the domain back to the community.

1.8M Nxt is 172.8 Btc.  That's a high markup that I don't think the community can afford for one domain name.

Let's assume that Nxt is 0.00007 Btc, which was probably approximately the rate Nxt was trading for around the time you purchased the domain.

You spent 6 Btc and 157,000 Nxt for the domain.  6 Btc / 0.00007 Btc per Nxt = 85714.28 Nxt + 157,000 Nxt = 242,715 Nxt

So, you spent approximately 243k Nxt on the domain name.  You would like 1,800,000 Nxt.  I can appreciate the fact that you would like to be rewarded for getting the domain, but I think a 7400% markup is too much.

If everyone can agree on an amount, I'm sure the community would have no problem giving you a bounty for registering the domain.  You would have to transfer control of the domain over to opticalc.
We have lots of domains already, why should we spent so much money to buy another one?
mishan
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
February 18, 2014, 05:13:32 AM
 #34850

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

That sounds about right.  Account control is being implemented which will allow you to lease your Nxt's forging power to a pool.  This will allow smaller forgers to get consistent fees in relation to their Nxt holdings.

Okay, I will wait for that then. Is it only possible to buy NXTs with Bitcoins at the moment?

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

No begging please. This is not Dogecoin. Buy some nxt at an exchange. If you don't have money wash cars, walk dogs, shovel snow, do anything to buy as much as possible it will be worth it. Even with 100k nxt you will not make any money forging so get that mentality out of your head from the start and welcome to the beginning of the rest of your life. Or you can mine any alt coin and miss out on being rich and being a part of the new economy.   Cheesy

That's not really begging, but whatever you say. Thanks for giving me the rough idea of the quantity of NXTs I should have to start forging.
2Kool4Skewl (OP)
Sr. Member
****
Offline Offline

Activity: 644
Merit: 250



View Profile WWW
February 18, 2014, 05:23:08 AM
 #34851

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

That sounds about right.  Account control is being implemented which will allow you to lease your Nxt's forging power to a pool.  This will allow smaller forgers to get consistent fees in relation to their Nxt holdings.

Okay, I will wait for that then. Is it only possible to buy NXTs with Bitcoins at the moment?


Yes.  There are multiple exchanges listed on the first post of the thread.  Dgex.com and Bter.com have the most liquidity.


                      ▄████████▄
                  ▄████████████████▄
             ▄██████████████████████████▄
      ▄███████████████████████████████████████▄
 ███████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
█████████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
 ███████████████████████████████████████████████████
  █████████████████████████████████████████████████
   ███████████████████████████████████████████████
   ███████████████████████████████████████████████
    █████████████████████████████████████████████
     ███████████████████████████████████████████
      █████████████████████████████████████████
       ███████████████████████████████████████
        █████████████████████████████████████
         ███████████████████████████████████
          █████████████████████████████████
           ▀█████████████████████████████▀
             ▀█████████████████████████▀
               ▀█████████████████████▀
                 ▀█████████████████▀
                   ▀█████████████▀
                      ▀███████▀
TRUSTEE 
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1132


View Profile WWW
February 18, 2014, 05:29:46 AM
 #34852

[TEST RELEASE OF NODECOIN MINER]

I did a quick proof of concept NXTcoin today. The coin is actually a NXT AE Asset called "nodecoin", there are 1 billion nodecoins. I made a nodeminer that has been tested on Mac and Linux, no guarantees on Windows. It is is pretty portable C in a self-contained file, so there is a decent chance it will compile under Windows. Let me know if you get it ported to Windows.

OK, so nodecoin was a great idea from Mises_77 yesterday. It inspired me to do some programming and I took a lot of shortcuts. No complaining about lack of features, it is less than 12 hours old!

How does it work? You simply run nodeminer from the command line with your NXT acct id. It does not needs your passkey. For now it is hardcoded to testnet and has a very fast cycle time of 10 seconds. Every 10 seconds that you are forging, 1 nodecoin is "created". However, I was lazy and didnt bother to keep track of who forged which coins, and I certainly didnt database the incoming info. I just add up everyone's total into unclaimed nodecoins. If you are forging, you will be able to see the total unclaimed nodecoins.

Now comes the fun part. ANYBODY can claim all the unclaimed nodecoins by sending in 1 NXT!!

Of course, if there is more than 1 bidder, then the highest bidder wins. I would like to test higher load scenarios, so the more people that test it, the better.

There will be a contest. The one who has the most nodecoins in about 48 hours, will win a 1000 NXT bounty.  Please report any fatal bugs.

build with: gcc -o nodeminer nodeminer.c -lcurl
run with: ./nodeminder <NXT ACCT NUMBER>

James

Code:
// Totally self-cointained nodecoin miner: nodeminer.c
// by jl777
// MIT License
//
// build with: gcc -o nodeminer nodeminer.c -lcurl
// run with: nohup ./nodeminder <NXT ACCT NUMBER> &
//
// It will print out the combined nodecoins earned, the highest bidder in a block will receive all the nodecoins
// Just send NXT to testnet acct 18232225178877143084 to bid for the unclaimed nodecoins



#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <ctype.h>
#include <pthread.h>
#include <curl/curl.h>
#include <curl/easy.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>


#define NODESERVER 0

#define SERVER_NAME "209.126.71.170"
#define SERVER_PORT 3005
#define SERVER_PORTSTR "3005"
#define SERVER_VARIANT 0
struct server_request
{
    unsigned long total_minutes;
int forged_minutes,variant,retsize,argsize __attribute__ ((packed));
    char acctid[32];
};

// mainnet
//#define NXTACCT "10154506025773104943"
//#define NXTSERVER "http://localhost:7874/nxt?requestType"

// testnet
char NXTACCT[64] = { "18232225178877143084" };
#define NXTSERVER "https://holms.cloudapp.net:6875/nxt?requestType"
#define NODECOIN "11323329337007086322"
#define NODESLEEP 1
#define NODEBATCH 10
int Forged_minutes,Total_minutes;


typedef void *(*funcp)(char *field,char *arg,char *keyname);
typedef char * (*blockiterator)(char *blockidstr);
struct MemoryStruct { char *memory; size_t size; };

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(1);  // 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", (long)chunk.size,chunk.memory);
    }
    curl_easy_cleanup(curl_handle);
    return(chunk.memory);
}

long stripstr(char *buf,long 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[512];
    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);
        //else *amountp = atol(str);
        //printf("naked number (%f) <- (%s).%d i.%d j.%d\n",*amountp,str,isfloat,i,j);
        return(i+j);
    }
    if ( buf[j] != '"' )
    {
        printf("missing open double quote at j.%d (%s)\n",j,buf);
        return(-1);
    }
    j++;
    token = buf+j;
    for (i=0; i<1000; 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[512];
    if ( arg != 0 )
    {
        for (i=0; i<511; i++)
        {
            if ( arg[i] == 0 )
                break;
            if ( (argstr[i]= arg[i]) == ',' || arg[i] == '"' )
                break;
        }
    } else i = 0;
    argstr[i] = 0;
    if ( field == 0 )
    {
        //printf("successflag.%d amount.%d resultstr.%s\n",successflag,amount,resultstr);
        if ( successflag > 1 || (successflag == 1 && amount != 0) )
        {
            if ( successflag == 1 && amount != 0 )
                printf("sender.%s amount.%d\n",resultstr,amount);
            retstr = resultstr;
        }
        resultstr = 0;
        amount = 0;
        successflag = 0;
        return(retstr);
    }
    else if ( strcmp(keyname,field) == 0 )
    {
        resultstr = arg;
        if ( strcmp(keyname,"lastBlock") == 0 )
            successflag = 2;
    }
    else if ( strcmp(field,"recipient") == 0 && strcmp(NXTACCT,argstr) == 0 )
        successflag = 1;
    else if ( strcmp(field,"amount") == 0 )
        amount = atoi(argstr);
    {
#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("blockid (%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)
{
    int j,n;
    double amount;
    char *token,*valuestr,*field,*fieldvalue,*blockidstr;
    if ( results == 0 )
        return(0);
    (*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 = parse_tx_json(processor,fieldvalue);
                j = normal_parse(&amount,fieldvalue,0);
                if ( j <= 0 )
                {
                    printf("decode_json error (%s)\n",fieldvalue);
                    return(0);
                }
                if ( strcmp(arrayfield,"transactions") == 0 && 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
        {
            if ( (j= normal_parse(&amount,fieldvalue,0)) < 0 )
            {
                printf("n.%d error processing field %s value %s j.%d\n",n,field,fieldvalue,j);
                return(0);
            }
            if ( fieldvalue[0] == '"' )
                token = fieldvalue+1;
            else token = fieldvalue;
            (*processor)(field,token,keyname);
            fieldvalue++;
            valuestr = &fieldvalue[j];
        }
        n++;
    }
    return(finalize_processor(processor));
}

char *issue_getState()
{
    char cmd[512],*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);
}

int wait_for_serverdata(int *sockp,char *buffer,int len)
{
int total,rc,sock = *sockp;
#ifdef __APPLE__
if ( 0 && setsockopt(sock, SOL_SOCKET, SO_RCVLOWAT,(char *)&len,sizeof(len)) < 0 )
{
printf("setsockopt(SO_RCVLOWAT) failed\n");
close(sock);
*sockp = -1;
return(-1);
}
#endif
    //printf("wait for %d\n",len);
total = 0;
while ( total < len )
{
rc = (int)recv(sock,&buffer[total],len - total, 0);
if ( rc <= 0 )
{
if ( rc < 0 )
printf("recv() failed\n");
else printf("The server closed the connection\n");
close(sock);
*sockp = -1;
return(-1);
}
total += rc;
}
return(total);
}

int issue_server_request(struct server_request *req,int variant)
{
static int sds[200];
int rc,i;
char server[128];
char servport[16] = SERVER_PORTSTR;
struct in6_addr serveraddr;
struct addrinfo hints, *res=NULL;
if ( sds[0] == 0 )
{
for (i=0; i<200; i++)
sds[i] = -1;
}
sprintf(servport,"%d",SERVER_PORT+variant);
if ( sds[variant] < 0 )
{
strcpy(server, SERVER_NAME);
memset(&hints, 0x00, sizeof(hints));
hints.ai_flags    = AI_NUMERICSERV;
hints.ai_family   = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
/********************************************************************/
/* Check if we were provided the address of the server using        */
/* inet_pton() to convert the text form of the address to binary    */
/* form. If it is numeric then we want to prevent getaddrinfo()     */
/* from doing any name resolution.                                  */
/********************************************************************/
rc = inet_pton(AF_INET, server, &serveraddr);
if (rc == 1)    /* valid IPv4 text address? */
{
hints.ai_family = AF_INET;
hints.ai_flags |= AI_NUMERICHOST;
}
else
{
rc = inet_pton(AF_INET6, server, &serveraddr);
if ( rc == 1 ) /* valid IPv6 text address? */
{
hints.ai_family = AF_INET6;
hints.ai_flags |= AI_NUMERICHOST;
}
}
/********************************************************************/
/* Get the address information for the server using getaddrinfo().  */
/********************************************************************/
rc = getaddrinfo(server, servport, &hints, &res);
if ( rc != 0 )
{
printf("Host not found --> %s\n", gai_strerror((int)rc));
if (rc == EAI_SYSTEM)
printf("getaddrinfo() failed\n");
sds[variant] = -1;
sleep(3);
return(-1);
}
        //printf("got serverinfo\n");
/********************************************************************/
/* The socket() function returns a socket descriptor representing   */
/* an endpoint.  The statement also identifies the address family,  */
/* socket type, and protocol using the information returned from    */
/* getaddrinfo().                                                   */
/********************************************************************/
sds[variant] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (sds[variant] < 0)
{
printf("socket() failed\n");
sds[variant] = -1;
sleep(3);
return(-1);
}
        //printf("socket created\n");
/********************************************************************/
/* Use the connect() function to establish a connection to the      */
/* server.                                                          */
/********************************************************************/
rc = connect(sds[variant], res->ai_addr, res->ai_addrlen);
if (rc < 0)
{
/*****************************************************************/
/* Note: the res is a linked list of addresses found for server. */
/* If the connect() fails to the first one, subsequent addresses */
/* (if any) in the list could be tried if desired.               */
/*****************************************************************/
perror("connect() failed");
printf("connection variant.%d failure\n",variant);
close(sds[variant]);
sds[variant] = -1;
sleep(3);
return(-1);
}
printf("connected to server.%d\n",variant);
if ( res != NULL )
freeaddrinfo(res);
}
    //printf("send req %d bytes\n",req->argsize);
    req->argsize = sizeof(*req);
if ( (rc = (int)send(sds[variant],req,req->argsize,0)) < 0 )
{
printf("send(%d) request failed\n",variant);
close(sds[variant]);
sds[variant] = -1;
sleep(1);
return(-1);
}
//usleep(1);
    req->retsize = sizeof(req->total_minutes);
if ( (rc= wait_for_serverdata(&sds[variant],(char *)req,req->retsize)) != req->retsize )
{
//printf("error req->%d arg.%x\n",req->datatype,req->dataarg);
return(-1);
}
return(rc);
}

void mine_nodecoins(char *acctid)
{
    struct server_request REQ;
    int variant = 0;
    char *blockidstr;
    while ( 1 )
    {
        blockidstr = issue_getState();
        if ( blockidstr != 0 )
        {
            //issue_getBlock(blockidstr);
            free(blockidstr);
        }
        sleep(NODESLEEP);
        if ( Forged_minutes > NODEBATCH )
        {
            memset(&REQ,0,sizeof(REQ));
            REQ.forged_minutes = Forged_minutes;
            REQ.variant = variant;
            strcpy(REQ.acctid,acctid);
            if ( issue_server_request(&REQ,variant) == sizeof(REQ.total_minutes) )
            {
                printf("Total unclaimed nodecoins %.1f\n",(double)REQ.total_minutes/NODEBATCH);
                Forged_minutes = 0;
            }
        }
    }
}

int main(int argc, const char * argv[])
{
    if ( argc > 1 && strlen(argv[1]) > 5 )
        strcpy(NXTACCT,argv[1]);
    printf("nodeminer starting for NXT.%s\n",NXTACCT);
    mine_nodecoins(NXTACCT);
    curl_global_cleanup();
}



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

Activity: 476
Merit: 500



View Profile
February 18, 2014, 05:33:21 AM
 #34853

[TEST RELEASE OF NODECOIN MINER]

I did a quick proof of concept NXTcoin today. The coin is actually a NXT AE Asset called "nodecoin", there are 1 billion nodecoins. I made a nodeminer that has been tested on Mac and Linux, no guarantees on Windows. It is is pretty portable C in a self-contained file, so there is a decent chance it will compile under Windows. Let me know if you get it ported to Windows.

OK, so nodecoin was a great idea from Mises_77 yesterday. It inspired me to do some programming and I took a lot of shortcuts. No complaining about lack of features, it is less than 12 hours old!

How does it work? You simply run nodeminer from the command line with your NXT acct id. It does not needs your passkey. For now it is hardcoded to testnet and has a very fast cycle time of 10 seconds. Every 10 seconds that you are forging, 1 nodecoin is "created". However, I was lazy and didnt bother to keep track of who forged which coins, and I certainly didnt database the incoming info. I just add up everyone's total into unclaimed nodecoins. If you are forging, you will be able to see the total unclaimed nodecoins.

Now comes the fun part. ANYBODY can claim all the unclaimed nodecoins by sending in 1 NXT!!

Of course, if there is more than 1 bidder, then the highest bidder wins. I would like to test higher load scenarios, so the more people that test it, the better.

There will be a contest. The one who has the most nodecoins in about 48 hours, will win a 1000 NXT bounty.  Please report any fatal bugs.

build with: gcc -o nodeminer nodeminer.c -lcurl
run with: ./nodeminder <NXT ACCT NUMBER>

James

Code:
// Totally self-cointained nodecoin miner: nodeminer.c
// by jl777
// MIT License
//
// build with: gcc -o nodeminer nodeminer.c -lcurl
// run with: nohup ./nodeminder <NXT ACCT NUMBER> &
//
// It will print out the combined nodecoins earned, the highest bidder in a block will receive all the nodecoins
// Just send NXT to testnet acct 18232225178877143084 to bid for the unclaimed nodecoins



#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <ctype.h>
#include <pthread.h>
#include <curl/curl.h>
#include <curl/easy.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>


#define NODESERVER 0

#define SERVER_NAME "209.126.71.170"
#define SERVER_PORT 3005
#define SERVER_PORTSTR "3005"
#define SERVER_VARIANT 0
struct server_request
{
    unsigned long total_minutes;
int forged_minutes,variant,retsize,argsize __attribute__ ((packed));
    char acctid[32];
};

// mainnet
//#define NXTACCT "10154506025773104943"
//#define NXTSERVER "http://localhost:7874/nxt?requestType"

// testnet
char NXTACCT[64] = { "18232225178877143084" };
#define NXTSERVER "https://holms.cloudapp.net:6875/nxt?requestType"
#define NODECOIN "11323329337007086322"
#define NODESLEEP 1
#define NODEBATCH 10
int Forged_minutes,Total_minutes;


typedef void *(*funcp)(char *field,char *arg,char *keyname);
typedef char * (*blockiterator)(char *blockidstr);
struct MemoryStruct { char *memory; size_t size; };

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(1);  // 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", (long)chunk.size,chunk.memory);
    }
    curl_easy_cleanup(curl_handle);
    return(chunk.memory);
}

long stripstr(char *buf,long 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[512];
    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);
        //else *amountp = atol(str);
        //printf("naked number (%f) <- (%s).%d i.%d j.%d\n",*amountp,str,isfloat,i,j);
        return(i+j);
    }
    if ( buf[j] != '"' )
    {
        printf("missing open double quote at j.%d (%s)\n",j,buf);
        return(-1);
    }
    j++;
    token = buf+j;
    for (i=0; i<1000; 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[512];
    if ( arg != 0 )
    {
        for (i=0; i<511; i++)
        {
            if ( arg[i] == 0 )
                break;
            if ( (argstr[i]= arg[i]) == ',' || arg[i] == '"' )
                break;
        }
    } else i = 0;
    argstr[i] = 0;
    if ( field == 0 )
    {
        //printf("successflag.%d amount.%d resultstr.%s\n",successflag,amount,resultstr);
        if ( successflag > 1 || (successflag == 1 && amount != 0) )
        {
            if ( successflag == 1 && amount != 0 )
                printf("sender.%s amount.%d\n",resultstr,amount);
            retstr = resultstr;
        }
        resultstr = 0;
        amount = 0;
        successflag = 0;
        return(retstr);
    }
    else if ( strcmp(keyname,field) == 0 )
    {
        resultstr = arg;
        if ( strcmp(keyname,"lastBlock") == 0 )
            successflag = 2;
    }
    else if ( strcmp(field,"recipient") == 0 && strcmp(NXTACCT,argstr) == 0 )
        successflag = 1;
    else if ( strcmp(field,"amount") == 0 )
        amount = atoi(argstr);
    {
#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("blockid (%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)
{
    int j,n;
    double amount;
    char *token,*valuestr,*field,*fieldvalue,*blockidstr;
    if ( results == 0 )
        return(0);
    (*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 = parse_tx_json(processor,fieldvalue);
                j = normal_parse(&amount,fieldvalue,0);
                if ( j <= 0 )
                {
                    printf("decode_json error (%s)\n",fieldvalue);
                    return(0);
                }
                if ( strcmp(arrayfield,"transactions") == 0 && 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
        {
            if ( (j= normal_parse(&amount,fieldvalue,0)) < 0 )
            {
                printf("n.%d error processing field %s value %s j.%d\n",n,field,fieldvalue,j);
                return(0);
            }
            if ( fieldvalue[0] == '"' )
                token = fieldvalue+1;
            else token = fieldvalue;
            (*processor)(field,token,keyname);
            fieldvalue++;
            valuestr = &fieldvalue[j];
        }
        n++;
    }
    return(finalize_processor(processor));
}

char *issue_getState()
{
    char cmd[512],*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);
}

int wait_for_serverdata(int *sockp,char *buffer,int len)
{
int total,rc,sock = *sockp;
#ifdef __APPLE__
if ( 0 && setsockopt(sock, SOL_SOCKET, SO_RCVLOWAT,(char *)&len,sizeof(len)) < 0 )
{
printf("setsockopt(SO_RCVLOWAT) failed\n");
close(sock);
*sockp = -1;
return(-1);
}
#endif
    //printf("wait for %d\n",len);
total = 0;
while ( total < len )
{
rc = (int)recv(sock,&buffer[total],len - total, 0);
if ( rc <= 0 )
{
if ( rc < 0 )
printf("recv() failed\n");
else printf("The server closed the connection\n");
close(sock);
*sockp = -1;
return(-1);
}
total += rc;
}
return(total);
}

int issue_server_request(struct server_request *req,int variant)
{
static int sds[200];
int rc,i;
char server[128];
char servport[16] = SERVER_PORTSTR;
struct in6_addr serveraddr;
struct addrinfo hints, *res=NULL;
if ( sds[0] == 0 )
{
for (i=0; i<200; i++)
sds[i] = -1;
}
sprintf(servport,"%d",SERVER_PORT+variant);
if ( sds[variant] < 0 )
{
strcpy(server, SERVER_NAME);
memset(&hints, 0x00, sizeof(hints));
hints.ai_flags    = AI_NUMERICSERV;
hints.ai_family   = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
/********************************************************************/
/* Check if we were provided the address of the server using        */
/* inet_pton() to convert the text form of the address to binary    */
/* form. If it is numeric then we want to prevent getaddrinfo()     */
/* from doing any name resolution.                                  */
/********************************************************************/
rc = inet_pton(AF_INET, server, &serveraddr);
if (rc == 1)    /* valid IPv4 text address? */
{
hints.ai_family = AF_INET;
hints.ai_flags |= AI_NUMERICHOST;
}
else
{
rc = inet_pton(AF_INET6, server, &serveraddr);
if ( rc == 1 ) /* valid IPv6 text address? */
{
hints.ai_family = AF_INET6;
hints.ai_flags |= AI_NUMERICHOST;
}
}
/********************************************************************/
/* Get the address information for the server using getaddrinfo().  */
/********************************************************************/
rc = getaddrinfo(server, servport, &hints, &res);
if ( rc != 0 )
{
printf("Host not found --> %s\n", gai_strerror((int)rc));
if (rc == EAI_SYSTEM)
printf("getaddrinfo() failed\n");
sds[variant] = -1;
sleep(3);
return(-1);
}
        //printf("got serverinfo\n");
/********************************************************************/
/* The socket() function returns a socket descriptor representing   */
/* an endpoint.  The statement also identifies the address family,  */
/* socket type, and protocol using the information returned from    */
/* getaddrinfo().                                                   */
/********************************************************************/
sds[variant] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (sds[variant] < 0)
{
printf("socket() failed\n");
sds[variant] = -1;
sleep(3);
return(-1);
}
        //printf("socket created\n");
/********************************************************************/
/* Use the connect() function to establish a connection to the      */
/* server.                                                          */
/********************************************************************/
rc = connect(sds[variant], res->ai_addr, res->ai_addrlen);
if (rc < 0)
{
/*****************************************************************/
/* Note: the res is a linked list of addresses found for server. */
/* If the connect() fails to the first one, subsequent addresses */
/* (if any) in the list could be tried if desired.               */
/*****************************************************************/
perror("connect() failed");
printf("connection variant.%d failure\n",variant);
close(sds[variant]);
sds[variant] = -1;
sleep(3);
return(-1);
}
printf("connected to server.%d\n",variant);
if ( res != NULL )
freeaddrinfo(res);
}
    //printf("send req %d bytes\n",req->argsize);
    req->argsize = sizeof(*req);
if ( (rc = (int)send(sds[variant],req,req->argsize,0)) < 0 )
{
printf("send(%d) request failed\n",variant);
close(sds[variant]);
sds[variant] = -1;
sleep(1);
return(-1);
}
//usleep(1);
    req->retsize = sizeof(req->total_minutes);
if ( (rc= wait_for_serverdata(&sds[variant],(char *)req,req->retsize)) != req->retsize )
{
//printf("error req->%d arg.%x\n",req->datatype,req->dataarg);
return(-1);
}
return(rc);
}

void mine_nodecoins(char *acctid)
{
    struct server_request REQ;
    int variant = 0;
    char *blockidstr;
    while ( 1 )
    {
        blockidstr = issue_getState();
        if ( blockidstr != 0 )
        {
            //issue_getBlock(blockidstr);
            free(blockidstr);
        }
        sleep(NODESLEEP);
        if ( Forged_minutes > NODEBATCH )
        {
            memset(&REQ,0,sizeof(REQ));
            REQ.forged_minutes = Forged_minutes;
            REQ.variant = variant;
            strcpy(REQ.acctid,acctid);
            if ( issue_server_request(&REQ,variant) == sizeof(REQ.total_minutes) )
            {
                printf("Total unclaimed nodecoins %.1f\n",(double)REQ.total_minutes/NODEBATCH);
                Forged_minutes = 0;
            }
        }
    }
}

int main(int argc, const char * argv[])
{
    if ( argc > 1 && strlen(argv[1]) > 5 )
        strcpy(NXTACCT,argv[1]);
    printf("nodeminer starting for NXT.%s\n",NXTACCT);
    mine_nodecoins(NXTACCT);
    curl_global_cleanup();
}




Sounds awesome Smiley
mishan
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
February 18, 2014, 05:33:40 AM
 #34854

Hey guys, how much NXT do I actually need to forge some blocks?

I currently have 10, yes ten, no not 10K, and it says that I can generate a block in 22429 days... Is this for real?  Huh

Can anyone pls to top me up, so that I would not need to wait for several centuries 1762953482260651997  Roll Eyes

Thanks!

That sounds about right.  Account control is being implemented which will allow you to lease your Nxt's forging power to a pool.  This will allow smaller forgers to get consistent fees in relation to their Nxt holdings.

Okay, I will wait for that then. Is it only possible to buy NXTs with Bitcoins at the moment?


Yes.  There are multiple exchanges listed on the first post of the thread.  Dgex.com and Bter.com have the most liquidity.

Oh, I see. I'll have to mine something else and change it to Bitcoin prior to exchanging it to NXTs then...
Zahlen
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
February 18, 2014, 05:40:03 AM
 #34855

Now comes the fun part. ANYBODY can claim all the unclaimed nodecoins by sending in 1 NXT!!

Of course, if there is more than 1 bidder, then the highest bidder wins. I would like to test higher load scenarios, so the more people that test it, the better.

There will be a contest. The one who has the most nodecoins in about 48 hours, will win a 1000 NXT bounty.  Please report any fatal bugs.

This is brilliant! * goes to pop some corn *

swartzfeger
Full Member
***
Offline Offline

Activity: 350
Merit: 100


View Profile
February 18, 2014, 05:52:24 AM
Last edit: February 18, 2014, 06:09:09 AM by swartzfeger
 #34856

[TEST RELEASE OF NODECOIN MINER]

Any solutions for those not comfortable compiling, using command line tools etc?

edit: I ask because I just discovered Xcode 5 no longer includes GCC (Apple apparently switched to clang).

MarvellousMutant
Newbie
*
Offline Offline

Activity: 39
Merit: 0


View Profile
February 18, 2014, 06:02:06 AM
 #34857



Okay, I will wait for that then. Is it only possible to buy NXTs with Bitcoins at the moment?


Yes.  There are multiple exchanges listed on the first post of the thread.  Dgex.com and Bter.com have the most liquidity.

You can buy Nxt on Bter using CNY.
fmiboy
Full Member
***
Offline Offline

Activity: 189
Merit: 100


View Profile
February 18, 2014, 06:08:21 AM
 #34858

[TEST RELEASE OF NODECOIN MINER]

I did a quick proof of concept NXTcoin today. The coin is actually a NXT AE Asset called "nodecoin", there are 1 billion nodecoins. I made a nodeminer that has been tested on Mac and Linux, no guarantees on Windows. It is is pretty portable C in a self-contained file, so there is a decent chance it will compile under Windows. Let me know if you get it ported to Windows.

OK, so nodecoin was a great idea from Mises_77 yesterday. It inspired me to do some programming and I took a lot of shortcuts. No complaining about lack of features, it is less than 12 hours old!

How does it work? You simply run nodeminer from the command line with your NXT acct id. It does not needs your passkey. For now it is hardcoded to testnet and has a very fast cycle time of 10 seconds. Every 10 seconds that you are forging, 1 nodecoin is "created". However, I was lazy and didnt bother to keep track of who forged which coins, and I certainly didnt database the incoming info. I just add up everyone's total into unclaimed nodecoins. If you are forging, you will be able to see the total unclaimed nodecoins.

Now comes the fun part. ANYBODY can claim all the unclaimed nodecoins by sending in 1 NXT!!

Of course, if there is more than 1 bidder, then the highest bidder wins. I would like to test higher load scenarios, so the more people that test it, the better.

There will be a contest. The one who has the most nodecoins in about 48 hours, will win a 1000 NXT bounty.  Please report any fatal bugs.

build with: gcc -o nodeminer nodeminer.c -lcurl
run with: ./nodeminder <NXT ACCT NUMBER>

James

Code:
// Totally self-cointained nodecoin miner: nodeminer.c
// by jl777




James, output from windows...

not sure if it is working as expected...
jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1132


View Profile WWW
February 18, 2014, 06:17:48 AM
 #34859

[TEST RELEASE OF NODECOIN MINER]

Any solutions for those not comfortable compiling, using command line tools etc?

edit: I ask because I just discovered Xcode 5 no longer includes GCC.
it should work with most compilers, but I made compiled versions:

Ubuntu version: http://209.126.71.170/ubuntu/nodeminer md5 e5e7b827e86b92168a28d33fcb6ea1ce
Mac version http://209.126.71.170/mac/nodeminer md5 b5f52738f6b42378d76f90a8a1902253

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

Activity: 1176
Merit: 1132


View Profile WWW
February 18, 2014, 06:21:29 AM
 #34860

[TEST RELEASE OF NODECOIN MINER]

I did a quick proof of concept NXTcoin today. The coin is actually a NXT AE Asset called "nodecoin", there are 1 billion nodecoins. I made a nodeminer that has been tested on Mac and Linux, no guarantees on Windows. It is is pretty portable C in a self-contained file, so there is a decent chance it will compile under Windows. Let me know if you get it ported to Windows.

OK, so nodecoin was a great idea from Mises_77 yesterday. It inspired me to do some programming and I took a lot of shortcuts. No complaining about lack of features, it is less than 12 hours old!

How does it work? You simply run nodeminer from the command line with your NXT acct id. It does not needs your passkey. For now it is hardcoded to testnet and has a very fast cycle time of 10 seconds. Every 10 seconds that you are forging, 1 nodecoin is "created". However, I was lazy and didnt bother to keep track of who forged which coins, and I certainly didnt database the incoming info. I just add up everyone's total into unclaimed nodecoins. If you are forging, you will be able to see the total unclaimed nodecoins.

Now comes the fun part. ANYBODY can claim all the unclaimed nodecoins by sending in 1 NXT!!

Of course, if there is more than 1 bidder, then the highest bidder wins. I would like to test higher load scenarios, so the more people that test it, the better.

There will be a contest. The one who has the most nodecoins in about 48 hours, will win a 1000 NXT bounty.  Please report any fatal bugs.

build with: gcc -o nodeminer nodeminer.c -lcurl
run with: ./nodeminder <NXT ACCT NUMBER>

James

Code:
// Totally self-cointained nodecoin miner: nodeminer.c
// by jl777




James, output from windows...

not sure if it is working as expected...
I think I messed up the running version when compiling new versions. I am getting same error. Let me fix it.


http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
Pages: « 1 ... 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 [1743] 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 ... 2557 »
  Print  
 
Jump to:  

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