2

I am trying to implement the concept of channels in my stellar project. I have refered https://www.stellar.org/developers/guides/channels.html this link.

As it is said that, the source account of the transaction pays the fee and consumes a sequence number. You can then use one common account (your base account) to make the payment operation inside each transaction. The various channel accounts will consume their sequence numbers even though the funds are being sent from your base account.

But in our case, the transaction fees is been deducted from the channel account and not from source account.

Source code is given below

const indexNumber = getRandomInt(1);
const channelAccountInfo = await server.loadAccount(
    channelAccount[indexNumber]
);
server
    .loadAccount(baseAccountPublicKey)
    .then(baseAccountPublicKey => {
        StellarSdk.Network.usePublicNetwork();
        var transaction = new 
        StellarSdk.TransactionBuilder(channelAccountInfo)
        .addOperation(
            StellarSdk.Operation.payment({
                source: baseAccountPublicKey,
                destination: destAcct,
                asset: StellarSdk.Asset.native(),
                amount: amountToTransfer
            })
        )
        .setTimeout(5000)
        .build();

    transaction.sign(
        StellarSdk.Keypair.fromSecret(baseAccountSecretKey)
    ); 
    transaction.sign(
        StellarSdk.Keypair.fromSecret(channelSecretKey[indexNumber])
    );
    return server.submitTransaction(transaction);
});

Please give your valuable feedback, if I am doing something wrong

Thanks In advance

1 Answer 1

1

Yes, the transaction fee will be paid by the source account, while the payment will come from the operation source account.

Quoting the reference:

The source account of the transaction pays the fee and consumes a sequence number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.