So I am trying to do a transaction in the private network, I have named it standalone, I am using SSL. I started the network using docker, then created a keypair, then in another terminal ran node to use javascript, below is my code:

var StellarSdk = require('stellar-sdk');

var server = new StellarSdk.Server('https://localhost:8000/tx?blob=Base64');

var kp = StellarSdk.Keypair.fromRawEd25519Seed(StellarSdk.hash("Standalone Network ; February 2017"))

var sourcePublicKey = kp.publicKey();

var receiverPublicKey = "GAI5VFPPZHJXE2O2MNMKAUBBUOMJOT6LUQYO2Q3NJXNAOGHXOYUVZMVW"

StellarSdk.Network.useTestNetwork();

server.loadAccount(sourcePublicKey)
.then(function(account) {
   var transaction = new StellarSdk.TransactionBuilder(account)
      .addOperation(StellarSdk.Operation.payment({
        destination: receiverPublicKey,
        asset: StellarSdk.Asset.native(),
        amount: '350.1234567',
  }))
  .build();
  transaction.sign(kp);
  console.log(transaction.toEnvelope().toXDR('base64'));
  server.submitTransaction(transaction)
   .then(function(transactionResult) 
     {console.log(JSON.stringify(transactionResult, null, 2));
      console.log('\nSuccess! View the transaction at: ');
      console.log(transactionResult._links.transaction.href);})
   .catch(function(err) {
      console.log('An error has occured:');
      console.log(err);
    });
   })
 .catch(function(e) 
 {console.error(e);
});

After running the above lines of code, I get a result:

Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }

Error: Error: write EPROTO 139644081280832:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:

    at _handleNetworkError (/home/ec2-user/node_modules/stellar-sdk/lib/call_builder.js:273:31)
    at <anonymous>

P.S.: I have modified the Network.js file inside the node_modules folder and added a new passphrase for the standalone network and then modified the useTestNetwork Function to use the standalone network passphrase, not the testnetwork passphrase. Please let me know, what changes do I have to make in order to make this work.

Your var server = new StellarSdk.Server('https://localhost:8000/tx?blob=Base64'); is wrong, and should point at the server, not a specific endpoint.

  • I tried localhost:8000, still got the below response: Promise { <pending>, domain: Domain { domain: null, _events: { error: [Function: debugDomainError] }, _eventsCount: 1, _maxListeners: undefined, members: [] } } > Error: Error: write EPROTO 140423567779648:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827: at _handleNetworkError (/home/ec2-user/node_modules/stellar-sdk/lib/call_builder.js:273:31) at <anonymous> – Deb Sep 10 at 11:04
  • 1
    The error was because of SSL certificate, I used var server = new StellarSdk.Server('127.0.0.1:8000', {allowHttp: true}); and that error got resolved. – Deb Sep 10 at 20:07
  • "{allowHttp: true}" helps, which let u try the functionality with HTTP. Try HTTPS later after things work. – cesarm Sep 12 at 1:44

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.