elective-stereophonic
elective-stereophonic
Multigateway status reports singapore
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client: Nxt 1.11.15

Pages: 1 ... 3 4 [5] 6 7 ... 11  All

Author Topic: Multigateway status reports  (Read 31346 times)

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #80 on: April 07, 2014, 12:33:35 pm »

I can do that as well as long as you let me know where I can find it. (I am on the phone, sorry if it is in plain sight)
It is not public yet, want a closed review first, at least until it is deployed on mainnet.
I will be able to send you source directly

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #81 on: April 07, 2014, 12:35:24 pm »

Almost got all the compiler errors fixed. All the high level code got touched by the wave of changes. It is much cleaner and its good this happened. I can post the data structures

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #82 on: April 07, 2014, 12:38:15 pm »

Current data structures:

Code: [Select]
struct hashtable
{
    char *name;
    void **hashtable;
    uint64_t hashsize,numsearches,numiterations,numitems;
    unsigned long keyoffset,keysize,modifiedoffset,structsize;
};

struct hashpacket
{
    int32_t *createdflagp,doneflag,funcid;
    char *key;
    struct hashtable **hp_ptr;
    union { void *result; uint64_t hashval; };
};


struct NXT_guid
{
    struct NXT_str H;
    char guid[128 - sizeof(struct NXT_str)];
};

struct NXT_assettxid
{
    struct NXT_str H;
    uint64_t txidbits,assetbits,senderbits,receiverbits,quantity,price; // price 0 -> not buy/sell
    struct NXT_guid *duplicatehash;
    void *cointx;
    char *guid,*comment;
    int32_t hackattempts;
};

struct NXT_assettxid_list
{
    struct NXT_assettxid **txids;
    int32_t num,max;
};

struct NXT_asset
{
    struct NXT_str H;
    uint64_t assetbits;
    struct NXT_assettxid **txids;   // all transactions for this asset
    int32_t max,num;
};

struct NXT_acct
{
    struct NXT_str H;
    struct coin_acct *coinaccts;
    struct NXT_asset **assets;
    uint64_t *quantities;
    int32_t maxassets,numassets,numcoinaccts;
    struct NXT_assettxid_list **txlists;    // one list for each asset in acct
};


struct req_deposit
{
    uint64_t nxt64bits,modified,AMtxidbits;
    char NXTaddr[MAX_NXTADDR_LEN],NXTtxid[MAX_NXTADDR_LEN],cointxid[MAX_COINTXID_LEN];;
};

struct pubkey_info { char pubkey[128],coinaddr[64],server[64]; };

struct multisig_addr
{
    char NXTaddr[MAX_NXTADDR_LEN],addr[MAX_COINADDR_LEN],redeemScript[256];
    struct pubkey_info pubkeys[NUM_GATEWAYS];
    int32_t m,n,coinid,rippletag;
    int64_t maxunspent,unspent;
};

struct crosschain_NXTinfo
{
    uint64_t AMtxidbits,asset_txid;
    int32_t confirmed,pending;
};

struct crosschain_info
{
    uint64_t nxt64bits;
    int64_t value,assetoshis;
    struct multisig_addr *msig;
    struct coin_value *parent;
    int32_t NXTRTflag,NXTxfermask,coin_confirmed,isinternal;
    struct crosschain_NXTinfo NXT;
};

struct coin_value
{
    int64_t modified,value;
    struct crosschain_info *xp;
    struct coin_txid *parent,*spent,*pendingspend;
    union { char *script; char *coinbase; };
    int32_t parent_vout,spent_vin,pending_spendvin,isconfirmed,iscoinbase,isinternal;
    char coinaddr[MAX_COINADDR_LEN];
};

struct coin_txid
{
    int64_t modified,height;
    char txid[MAX_COINTXID_LEN];
    int32_t numvins,numvouts,hasinternal;
    struct coin_value **vins,**vouts;
};

struct rawtransaction
{
    char *destaddrs[4];
    struct coin_value *inputs[16];
    int64_t amount,change,inputsum,destamounts[4];
    int32_t numoutputs,numinputs;
    char rawtransaction[4096],signedtransaction[4096],txid[64];
};

struct withdraw_info
{
    struct server_request_header H;
    uint64_t AMtxidbits;
    int64_t amount,moneysent;
    int32_t coinid,srcgateway,destgateway,twofactor,authenticated;
    char cointxid[MAX_COINTXID_LEN],withdrawaddr[64],NXTaddr[MAX_NXTADDR_LEN],redeemtxid[MAX_NXTADDR_LEN],comment[1024];
    struct rawtransaction rawtx;
};

struct unspent_info
{
    int64_t maxunspent,unspent,maxavail,minavail,smallest_msigunspent;
    struct coin_value **vps,*maxvp,*minvp;
    int32_t maxvps,num;
    char smallest_msig[128];
};

struct balance_info { int64_t deposits,transfers,withdraws,moneysends,remaining_transfers,remaining_moneysends,balance; };

struct coin_acct
{
    struct balance_info funds;
    struct multisig_addr **msigs;
    int32_t enable_2FA,nummsigs,coinid;
    char withdrawaddr[MAX_COINADDR_LEN];
};

struct replicated_coininfo // runs on all nodes and only needs NXT blockchain
{
    char name[64],assetid[64];
    int32_t coinid,timestamp,nummsigs,numxps,numwithdraws,pollseconds;
    int64_t txfee,markeramount,NXTheight;
    struct balance_info funds;
    struct unspent_info unspent;
   
    pthread_mutex_t msigs_mutex,xp_mutex;
   
    struct crosschain_info **xps;
   
    struct hashtable *coin_txids,*redeemtxids;
    struct pingpong_queue retryassetxfer,withdrawreqs,withdraws;
    queue_t errorqueue;
    struct multisig_addr **msigs;
    struct withdraw_info **wps;
};

struct daemon_info  // only valid on nodes with access to actual bitcoind (fork) daemons, near realtime validators
{
    char *name[64],*assetid[64],*internalmarker[64],*serverport[64],*userpass[64];          // prepare for one daemon for multiple coinids
    int32_t min_confirms[64],blockheight[64],numinitlist[64];
    int32_t numretries,mismatch,initdone[64],*initlist[64];
    int32_t (*validate_coinaddr)(struct daemon_info *cp,int32_t coinid,char *coinaddr);
    int32_t (*add_unique_txids)(struct daemon_info *cp,int32_t coinid,int64_t blockheight,int32_t RTmode);
    int64_t (*get_blockheight)(struct daemon_info *cp,int32_t coinid);
    queue_t errorqueue;
    char *(*calc_rawtransaction)(struct daemon_info *cp,int32_t coinid,struct rawtransaction *rp,char *destaddr,int64_t amout);
};

struct multigateway_info // only valid if one of NUM_GATEWAYS, does actual money handling
{
    struct hashtable *genaddr_txids;
    struct pingpong_queue genreqs,genaddr,authenticate,sendcoin;
    queue_t errorqueue;

    int32_t gensocks[NUM_GATEWAYS],wdsocks[NUM_GATEWAYS],backupcount,coinid;
    char gateways[NUM_GATEWAYS][64],walletbackup[256];
    struct multisig_addr *(*gen_depositaddr)(struct daemon_info *cp,int32_t coinid,char *NXTaddr);
    char *(*submit_withdraw)(struct daemon_info *cp,int32_t coinid,struct withdraw_info *wp,struct withdraw_info *otherwp);
   
    pthread_mutex_t consensus_mutex;
    struct withdraw_info withdrawinfos[NUM_GATEWAYS];
};

struct gateway_info
{
    struct replicated_coininfo *replicants[64];
    struct daemon_info *daemons[64];
    struct multigateway_info *multigateways[64];
    int32_t gatewayid,timestamp;
};

Feel free to ask any questions. I dont claim these are perfect,just what evolved out of the last month of coding and recoding

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #83 on: April 07, 2014, 01:44:53 pm »

spooky
After all those changes, after a few silly errors, its running!
I thought it would take a long time to get it working again
OK, going to take a break and then run it through the main use cases.

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

kodtycoon

  • Hero Member
  • *****
  • Karma: +43/-18
  • Offline Offline
  • Posts: 916
    • View Profile
Re: Multigateway status reports
« Reply #84 on: April 07, 2014, 01:50:01 pm »

nice work james!
Logged

chanc3r

  • Hero Member
  • *****
  • Karma: +124/-50
  • Offline Offline
  • Posts: 1019
  • NXTInspect
    • View Profile
Re: Multigateway status reports
« Reply #85 on: April 07, 2014, 03:45:59 pm »


If you can read C, then maybe you can do a source review? Its grown to ~5000 lines and its hard to see the obvious bugs with code you've been looking at for a long time.

James

I can do 5k lines, will take some time and need you to be stable in design i guess..
Let me know when you want me to have a read...
I can abstract into a doc at the same time to check my understanding.
Logged
NXT: 29996814460165 (NXT-JTA7-B2QR-8BFC-2V222)
@imrimr @NXTinspect

IveBeenBit

  • Full Member
  • ***
  • Karma: +7/-2
  • Offline Offline
  • Posts: 131
    • View Profile
Re: Multigateway status reports
« Reply #86 on: April 07, 2014, 04:00:05 pm »

I can do 5k lines, will take some time and need you to be stable in design i guess..
Let me know when you want me to have a read...
I can abstract into a doc at the same time to check my understanding.

This would be great! Please make sure to post prominently if you follow through on this!
Logged
I need your suggestions for Nxt Podcast ideas. Click here and speak your mind!

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #87 on: April 07, 2014, 04:01:37 pm »


If you can read C, then maybe you can do a source review? Its grown to ~5000 lines and its hard to see the obvious bugs with code you've been looking at for a long time.

James

I can do 5k lines, will take some time and need you to be stable in design i guess..
Let me know when you want me to have a read...
I can abstract into a doc at the same time to check my understanding.
PM me your email and i will send the NXTprotocol layer. That part has been pretty stable for a while and is the foundation for everything else I am working on.

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

chanc3r

  • Hero Member
  • *****
  • Karma: +124/-50
  • Offline Offline
  • Posts: 1019
  • NXTInspect
    • View Profile
Re: Multigateway status reports
« Reply #88 on: April 07, 2014, 04:25:12 pm »

PM me your email and i will send the NXTprotocol layer. That part has been pretty stable for a while and is the foundation for everything else I am working on.

James

done.
Logged
NXT: 29996814460165 (NXT-JTA7-B2QR-8BFC-2V222)
@imrimr @NXTinspect

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #89 on: April 07, 2014, 06:13:02 pm »

I just pushed a source release that integrates the NXTprotocol into libwebsockets to https://github.com/jl777/NXTprotocol

NXTprotocol is mostly self-contained, but it does use the following: libcurl, zlib, nacl http://nacl.cr.yp.to/install.html and of course libwebsockets: http://libwebsockets.org/trac/libwebsockets

On ubuntu -lz -lcurl nacl/randombytes.o nacl/libnacl.a will get it to link

On a mac, you need to modify the link.txt file in libwebsockets/lib/Cmakefiles/test-server.dir and add libcurl.dylib nacl/randombytes.o nacl/libnacl.a

You might have to install nacl and generate all the nacl files, only a few are actually used (as of now)

Change the following line in libwebsocketsglue.h to a path on your computer NXTPROTOCOL_HTMLFILE "/Users/jl777/NXTprotocol.html" The NXTprotocol.html file is what is displayed when http://127.0.0.1:7777/ is accessed. It is currently very primitive but shows how to interface to the websockets.

You also need to copy the test-server.c file into the actual libwebsockets/test-server directory

If all goes well, it should just build. There is a stub handler that shows how to hookup a simple NXT service. You can register a specific 4 byte AM signature and then just see those AM's. You can also specify specific transaction type (and subtypes) to filter. You get notified whenever a new block is forged and also polled during idletime. I havent totally verified that it is tracking all the assets properly, especially with all the recent changes, but it does put everything into hashtables or linear lists in RAM.

Anyway, building on this framework, I am able to make a brand new NXT service pretty quickly. I hope it helps you too.

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

Daedelus

  • Hero Member
  • *****
  • Karma: +230/-12
  • Offline Offline
  • Posts: 3280
    • View Profile
Re: Multigateway status reports
« Reply #90 on: April 07, 2014, 06:42:17 pm »

What does it actually do?  ???    ;D ;D ;D ;D

I am not having a dig, I just don't understand a lot of your lingo :D  ;D ;D

I want to put it in the Glossary, this is all I can fathom and remember  ;)


****
NXTProtocol
NXTProtocol was written by forum member jl777 and is the foundation that  jl777 built all his NXT Services on top of. These include NxtCash, NxtMixer and others. NxtProtocol simplifies the basic work required to create Services for Nxt and allows jl777, and indeed any other developer, to produce other services on top on the Nxt Platform much easily.

****

I think that is right, is that accurate?

Do you prefer jl777 or James? Could you fill in 'the others' above? I know there are more  ;)

Thanks, I know you are busy  ;D



(Also, imagine you are speaking to a 12 year old in your reply)
Logged
NXT: NXT-4CS7-S4N5-PTH5-A8R2Q

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #91 on: April 07, 2014, 06:50:45 pm »

jl777 is better
This release is primarily so people can get a start on the source code review and wesley can integrate it into  Windows libwebsockets

I included a sample stub handler that shows how you can connect into the NXTprotocol

So, this release is really for developers and not for general use. As soon as we can get it working with windows libwebsockets, then I can think about making a release of something that actually does something.

James

Edit: Chancr said he would document things, I am still pretty busy coding
« Last Edit: April 07, 2014, 06:57:36 pm by farl4bit, Reason: Deleted unnecessary direct full-quote »
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

allwelder

  • Hero Member
  • *****
  • Karma: +196/-13
  • Offline Offline
  • Posts: 1867
  • NxtChina.org
    • View Profile
    • NxtChina.org
Re: Multigateway status reports
« Reply #92 on: April 08, 2014, 12:18:00 am »

JL777 IS MUCH BETTER :D
Logged
NxtChina |Weibo |Twitter Donation welcomed:NXT-APL9-66GU-K8LY-B3JJJ

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #93 on: April 09, 2014, 07:53:07 am »

Some real world stuff coming up, so probably will be offline for a couple days.
Hopefully, the testnet wont be wonky when I get back online

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jabo38

  • Sr. Member
  • ****
  • Karma: +40/-38
  • Offline Offline
  • Posts: 381
    • View Profile
Re: Multigateway status reports
« Reply #94 on: April 09, 2014, 01:58:36 pm »

I just read this thread and I feel sooooo  ;D ;D ;D ;D ;D ;D that I can't control it!
Logged
Never Enough Money

lbjnext

  • Jr. Member
  • **
  • Karma: +0/-0
  • Offline Offline
  • Posts: 21
  • NXT-2HL8-HDMU-7DMZ-8ANYR
    • View Profile
Re: Multigateway status reports
« Reply #95 on: April 11, 2014, 01:10:50 am »

jl777 绝顶高手! ;)
Logged
NXT-2HL8-HDMU-7DMZ-8ANYR

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #96 on: April 11, 2014, 04:31:00 pm »

I have the mood for debugging multigateway, but I have no testNXT
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

Fatih87SK

  • Hero Member
  • *****
  • Karma: +127/-36
  • Offline Offline
  • Posts: 2206
    • View Profile
Re: Multigateway status reports
« Reply #97 on: April 11, 2014, 04:33:34 pm »

I have the mood for debugging multigateway, but I have no testNXT

You should be the one who get's the first testNXT IMO. How can we manage this?
Logged

abctc

  • Hero Member
  • *****
  • Karma: +148/-13
  • Offline Offline
  • Posts: 1396
    • View Profile
Re: Multigateway status reports
« Reply #98 on: April 11, 2014, 04:58:38 pm »

I have the mood for debugging multigateway, but I have no testNXT
- 50k testNXTs sent. Please let me know if you need more.
Logged
Welcome to the Nxt generation of crypto!   Magis quam Moneta (More than a Coin)
"Do not worry, it is an attack" (c) Jean-Luc

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Multigateway status reports
« Reply #99 on: April 11, 2014, 10:04:38 pm »

Finally made some progress. With all the testnet resets, each cycle I need to reissue all the assets, redo asset numbers, setup all the accounts, get them funds, etc. Then have to wait until it starts generating blocks in a stable basis and of course testNXT.

I generated the following purely via websockets commands

{
   "NXTaddr":   "8989816935121514892",
   "coinaccts":   [{
         "coin":   "DOGE",
         "funds":   {
            "deposits":   "0",
            "transfers":   "0",
            "withdraws":   "0",
            "moneysends":   "0",
            "remaining_transfers":   "0",
            "remaining_moneysends":   "0",
            "balance":   "0"
         },
         "withdrawaddr":   "",
         "enable_2FA":   0,
         "nummsigs":   1,
         "multisigs":   [{
               "addr":   "9zz4q4QBmc23tpVpRtZLv7oGbdEo9ukGLq",
               "gatewayA":   "209.126.71.170",
               "gatewayB":   "209.126.73.156",
               "gatewayC":   "209.126.73.158"
            }],
         "withdraws":   {
      }
      }, {
         "coin":   "LTC",
         "funds":   {
            "deposits":   "0",
            "transfers":   "0",
            "withdraws":   "0",
            "moneysends":   "0",
            "remaining_transfers":   "0",
            "remaining_moneysends":   "0",
            "balance":   "0"
         },
         "withdrawaddr":   "",
         "enable_2FA":   0,
         "nummsigs":   1,
         "multisigs":   [{
               "addr":   "3Jq2z26hYBharE468BZcvMbzv8UbpeBb6w",
               "gatewayA":   "209.126.71.170",
               "gatewayB":   "209.126.73.156",
               "gatewayC":   "209.126.73.158"
            }],
         "withdraws":   {
      }
      }],
   "numassets":   0,
   "numcoinaccts":   2
}

It is just the address generation, but that involves all three servers, AM parsing, JSON parsing, etc, so now I can proceed to debug the rest of the code after the major restructuring I did last week.

If you have a Mac, you will be able to run the first websockets release. It will automatically generate a new account and print out the password and account number. You will have to send this acct some NXT so it can publish AM's

As long as this incarnation of testnet keeps going, I should be able to get a DOGE/LTC/DRK release this weekend. I dont want to enable BTC until we verify proper functioning on the lesser currencies.

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer
Pages: 1 ... 3 4 [5] 6 7 ... 11  All
 

elective-stereophonic
elective-stereophonic
assembly
assembly