2

I have already started a stellar private network. I need to generate an account on a stellar private network. I have a secret key and private key also. But I have a question about what should I enter as Sourcekey in Stellar.Keypair.fromSecret("******************");?

is it NODE_SEED which I entered in stellar-core.cfg ?

    try{
      const pk = req.body.name;
      if(pk){
          // faucet is our root account. Make sure you replace this value with your key
          let sourceKeys = Stellar.Keypair.fromSecret("******************");
          // loading root account

          server.loadAccount(sourceKeys.publicKey())

          .then(function(sourceAccount) {
              let txn = new Stellar.TransactionBuilder(sourceAccount)
                          .addOperation(
                              Stellar.Operation.createAccount({
                              destination: pk,
                              startingBalance: "1000"}))
                          .addMemo(Stellar.Memo.text('Test Transaction'))
                          .build();
              txn.sign(sourceKeys);

              return server.submitTransaction(txn);
              })
          .then(function(result) {
              res.send("")
          })
          .catch(function(error) {

          });
      }else{
     }
   }
   catch(err){
   }

Any help is appreciated. :)

1

let sourceKeys = Stellar.Keypair.master();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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