当我向其发送交易时,peer/transactions
我可以发送带有或不带有签名的交易。两种交易均被接受。有什么不同。
例子; 使用 asch-js 创建一个新的链 / dapp
情况1:使用签名(和 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;
}
情况2:没有签名
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;
}
两个交易都被接受(并创建一个新链)。那么有什么区别,什么是最佳实践?