here is mycode using waves-api
the seed is the same as conf.
const WavesAPI = require('@waves/waves-api');
const Waves = WavesAPI.create(WavesAPI.TESTNET_CONFIG);
const newConfig = {
networkByte: 'D',
nodeAddress: 'http://0.0.0.0:6861',
matcherAddress: 'http://0.0.0.0:6861/matcher',
minimumSeedLength: 50
};
Waves.config.set(newConfig);
const transferData = {
amount: 11000000,
// An arbitrary address; mine, in this example
recipient: '3FUWqvAACRYetSuhbDNA3F7Wdn8p1am1Uus',
// ID of a token, or WAVES
assetId: 'WAVES',
// The real amount is the given number divided by 10^(precision of the token)
// The same rules for these two fields
feeAssetId: 'WAVES',
fee: 100000,
// 140 bytes of data (it's allowed to use Uint8Array here)
attachment: '',
timestamp: Date.now()
};
const seed = Waves.Seed.fromExistingPhrase('foo0 true 1 ago hello');
Waves.API.Node.transactions.broadcast('transfer', transferData, seed.keyPair).then((responseData) => {
console.log(responseData);
});
the result
UnhandledPromiseRejectionWarning: WavesRequestError: Server request to 'http://0.0.0.0:6861/assets/broadcast/transfer' has failed:
{
"error": 112,
"message": "State check failed. Reason: invalid signature",
"tx": {
"type": 4,
"id": "FrHmFMmr552o2Jjg81XEWcMGxxuhbRaWxYdGk5XGXiYH",
"sender": "3FhShrXhT34tZ8bfgTGvAjJgx6xKmtfqZtJ",
"senderPublicKey": "CUQvKcNyKwaXQh68Wao91zZ3r8ru9SbVnMVkG8XsKzwq",
"fee": 100000,
"timestamp": 1546852501250,
"signature": "3kx2LTBnNwxHpfESdJbib2hGxi6TWB4HhnsNpoMhQDBiYWCoFQ8gtz4kbk9b1fX1VnyumeaoYnwoYGbKToH2xvG4",
"proofs": [
"3kx2LTBnNwxHpfESdJbib2hGxi6TWB4HhnsNpoMhQDBiYWCoFQ8gtz4kbk9b1fX1VnyumeaoYnwoYGbKToH2xvG4"
],
"version": 1,
"recipient": "3FUWqvAACRYetSuhbDNA3F7Wdn8p1am1Uus",
"assetId": null,
"feeAssetId": null,
"feeAsset": null,
"amount": 11000000,
"attachment": ""
}
}