Internal error whil transfer mosaic


#1

Hi, I am getting following error
{ code: 0,
data:
{ timeStamp: 112270441,
error: ‘Internal Server Error’,
message: null,
status: 500 } }

my code as follows

let nem = require(‘nem-sdk’).default;

let endpoint = nem.model.objects.create(‘endpoint’)(nem.model.nodes.defaultTestnet,
nem.model.nodes.defaultPort);

let common = nem.model.objects(‘common’)(‘password’,‘privatekey’);

//let transferTraction = nem.model.create(‘transferTransaction’)(‘nanowalletaddress’,amount, messsage)

let transferTransaction = nem.model.objects.create(‘transferTransaction’)
(‘TASY6OOTPAYVGBZ7WMOBPBKAOIEDMJ53WTLHV5GM’,0 , ‘hello from mosaictransfertest program’);

var mosaicDefinitions = nem.model.objects.get(“mosaicDefinitionMetaDataPair”);

var mosaicAttachment = nem.model.objects.create(“mosaicAttachment”)(“appajinamespacesco2coin”, “co2coin” , 300);

transferTransaction.mosaics.push(mosaicAttachment);

nem.com.requests.namespace.mosaicDefinitions(endpoint, mosaicAttachment.mosaicId.namespacesId).then(function(res){
var definitions = nem.utils.helpers.searchMosaicDefinitionArray(res.data, [“co2coin”]);
var fullName = nem.utils.format.mosaicIdToName(mosaicAttachment.mosaicId);

mosaicDefinitions[fullName] = {};
mosaicDefinitions[fullName].mosaicDefinition = definitions[fullname];

let preparedTransaction = nem.model.transactions.prepare(‘mosaicTransferTransaction’)(common, transferTransaction, mosaicDefinitions,
nem.model.network.data.testnet.id);

nem.model.transactions.send(common, preparedTransaction, endpoint).then(function(res){
console.log(res);
}, function(err){
console.log(err);
});

}, function(err){
console.log(err);
})


#2

Did you try use another testnet node? bob.nem.ninja:8765/#/nodes/


#3

Thanks @pawelem,
I am new to NEM field, Could you please help how to do the same.


#4

I tried different node as suggested link, i am getting same type of internal error. Do i am need to some other stuff also.


#5

Are you sure your common object defined properly?

let common = nem.model.objects(‘common’)(‘password’,‘privatekey’);

There should be real 64 Bytes private key not ‘privatekey’