Could someone write client side code to test the multisig gateway? It can be command line, nothing fancy, just as long as its not Windows
Initially, all gateway requests are done via AM, so you just need to fill out the gateway_AM structure and send the AM to the issuer NXT account 18232225178877143084
For deposits gatewayid needs to be 0 for now, withdrawals can be sent to 0, 1 or 2
coinid is 1 for DOGE
#define GATEWAY_SIG 0xdadafeed
// API funcids
#define GET_COINDEPOSIT_ADDRESS 'g' // set NXTaddr, only gateway 0 for now
#define BIND_DEPOSIT_ADDRESS 'b' // result of GET_COINDEPOSIT_ADDRESS
#define NOTIFY_PENDING_DEPOSIT 'n' // set NXTaddr, coinaddr and amount, only gateway 0 for now
#define MONEY_DEPOSITED 'd' // gateway response after it is confirmed, swept to multisig
#define WITHDRAWAL_REQUEST 'w' // set NXTaddr, coinaddr, txid and amount AFTER transferring coin asset back
#define MONEY_SENT 'm' // gateway response after it verifies you transferred asset back and will match the amount you redeemed.
First you need to get a deposit address by sending a GET_COINDEPOSIT_ADDRESS gateway_AM to gateway.0, the next block you should find a BIND_DEPOSIT_ADDRESS AM sent to 18232225178877143084 with your deposit address. You can reuse, or get new ones. Not much anonymity by getting new ones, since it is all public info. NXTcash for anonymity.
Now just send DOGE to your deposit address and send a NOTIFY_PENDING_DEPOSIT with the amount. When the gateway gets it, your NXT acct will get the coin asset.
....
<lots of trading within AE, coin asset can end up with anyone>
....
To withdraw, just transfer the coin asset back to 18232225178877143084 and send a WITHDRAWAL_REQUEST AM. The gateways will do a multisig payment and post MONEY_SENT AM after its on its way.
struct gateway_info // this struct is very incomplete, still a work in progress
{
double balance,deposits,withdrawals,tbd __attribute__ ((packed));
int bind_requests,addresses_bound,deposit_txids,pending_sweeps,verified_deposits __attribute__ ((packed));
int withdrawal_requests,moneysent,pending_withdrawals,failed_withdrawals __attribute__ ((packed));
int rawbroadcasts,pending_redemptions __attribute__ ((packed));
};
struct gateway_AM
{
unsigned int sig __attribute__ ((packed));
int funcid __attribute__ ((packed));
int gatewayid __attribute__ ((packed));
int coinid __attribute__ ((packed));
double amount __attribute__ ((packed));
double unspent __attribute__ ((packed));
double change __attribute__ ((packed));
char NXTaddr[32],coinaddr[32];
union { char txid[128]; char rawtransaction[288]; };
union { char inputs[512]; };
struct gateway_info info;
};
Once there is client side code for this, it can easily be integrated into any GUI so we can have crypto gateways built into NXT GUIs. Any feedback is much appreciated. The .01 NXT resolution in AE is an issue for low value things like DOGE, but since its testnet, I will ignore this for now.
It would really help if somebody other than me worked on this. A lot of money could flow through this code. Want to be sure its super solid.
James