load account is working fine and giving details of accounts means horizon is giving response but on transaction submitting getting error.

local node setup done using docker image of stellar

code

app.get('/transferCoins', async function (req, res) {
        var sourceSecretKey = issuer.secret;// seed of acc from which tx process
        var sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);
        var sourcePublicKey = sourceKeypair.publicKey();//pub key of source acc
        var receiverPublicKey = account2.publicKey;// public key of reciever acc
        StellarSdk.Network.useTestNetwork();
        console.log('1');
        //var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');//live netwrk

        var server = new StellarSdk.Server('http://localhost:8000', {allowHttp: true});
        console.log('2');

        const account = await server.loadAccount(sourcePublicKey)
        console.log('3');

        var transaction = new StellarSdk.TransactionBuilder(account)
            .addOperation(StellarSdk.Operation.payment({
                destination: receiverPublicKey,
                asset: StellarSdk.Asset.native(),//native asset lumen
                amount: '0.1',
            }))
            .addMemo(StellarSdk.Memo.text('coins sent xlm'))//optional 
            .build();

            console.log('4');

        transaction.sign(sourceKeypair);
        const temp = await server.submitTransaction(transaction)
        console.log('submitted', temp._links);
    });

output

1
2
3
4
(node:23113) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): **Error: Request failed with status code 504**
(node:23113) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  • sometimes gives : stellar-core -c info "Catching up: applying checkpoint 1/1 (100%)", "Local time is not synchronized with NTP time." – Prashant Gangwar Nov 27 at 7:44
  • when I restart the docker and did stellar-core -c info state changes and new ledger is synced and also 2-3 transaction get confirmed , so that means everything is working fine except ledger sync, syncing is happening after very long time not immediately – Prashant Gangwar Nov 27 at 9:37

changed the cathchup_recent = 1024 instead of 8096

and now ledeger is syncying correctely, wait for the ledeger to be come in synced state, even after this ledger is synced new recent ledeger will download and at this time horizon API interaction(only submission to network) is not possible. retrieval will work fine. in my case, the weak network connection may be the issue

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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