3

I am trying to make my first transaction and I am failing. I tried using private and public nodes. If I use :

var iota = new IOTA({
   'provider': ' https://nodes.thetangle.org:443'
});

var seed = 'AAA....';
var address = 'xyz....';


var messageToSend = {
    'name': 'Dominik',
    'message': 'My first message sent with IOTA.'
}


var messageStringified = JSON.stringify(messageToSend);

var messageTrytes = iota.utils.toTrytes(messageStringified);

var transfer = [{
    'address': address,
    'value': 0,
    'message': messageTrytes
}];

iota.api.sendTransfer(seed, 4, 18, transfer, function(e, bundle) {
    if (e) throw e;
    console.log("Successfully sent your transfer: ", bundle);
});

I get

Error: Request Error: Couldn't get a response from nodes

if I connect to my private node instead

 var iota = new IOTA({
'host': 'http://xx.xxx.xxx.x',
'port': 14700

});

I am waiting forever. Any idea what am I doing wrong?

Helmar
  • 1,293
  • 1
  • 15
  • 28
wonglik
  • 141
  • 3

2 Answers2

1

You are waiting forever using your node because 18 is a too high value for minWeightMagnitude parameter of sendTransfer call. Try with 14. minWeightMagnitude is related to PoW to accomplish.

blockmined
  • 710
  • 1
  • 4
  • 9
  • That is one of the issues. Other is that AWS t2.micro is just too weak for running a node and doing PoW – wonglik Jan 12 '18 at 13:15
1

For the public node problem, it turned out that attachToTangle is not available on it. However there was a bug and wrong error message was returned. After fix error message is :

Request Error: COMMAND attachToTangle is not available on this node

As for private node. It seems that EC2 t2.micro is just to weak to handle running a node and doing PoW. And like drclink pointed out MWM was probably too high.

wonglik
  • 141
  • 3