When i send an transaction to peer/transactions
i can send it with and without signatures. Both transaction are accepted. What is the difference.
Example; Create a new chain / dapp by using asch-js
Situation 1: using signatures (and a transactionid
):
function createDApp(options, secret, secondSecret) {
var keys = crypto.getKeys(secret);
var transaction = {
secret: secret,
type: 200,
amount: 0,
fee: constants.fees.dapp,
recipientId: null,
senderId: crypto.getAddress(keys.publicKey),
timestamp: slots.getTime() - globalOptions.get('clientDriftSeconds'),
args: [options.name, options.description, options.link, options.icon, options.delegates, options.unlockDelegates],
signatures: []
};
transaction.signatures.push(crypto.sign(transaction, keys));
if (secondSecret) {
var secondKeys = crypto.getKeys(secondSecret);
transaction.signatures.push(crypto.secondSign(transaction, secondKeys));
}
transaction.id = crypto.getId(transaction);
return transaction;
}
Situation 2: no signatures
function createDApp(options, secret, secondSecret) {
var keys = crypto.getKeys(secret);
var transaction = {
secret: secret,
type: 200,
amount: 0,
fee: constants.fees.dapp,
recipientId: null,
senderId: crypto.getAddress(keys.publicKey),
timestamp: slots.getTime() - globalOptions.get('clientDriftSeconds'),
args: [options.name, options.description, options.link, options.icon, options.delegates, options.unlockDelegates],
signatures: []
};
return transaction;
}
Both transaction are accepted (and create a new chain). So what is the difference and what is best practice?