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.