1

I need to build transaction on machine with internet via go sdk and then sign it on offline machine

3

3 Answers 3

2

This is how i convert the XDR before the initial signature.

    trustTx, err := build.Transaction(
    build.SourceAccount{recipient.Address()},
    build.AutoSequence{SequenceProvider: horizon.DefaultTestNetClient},
    build.TestNetwork,
    build.Trust(Asset.Code, Asset.Issuer, build.Limit(cd.Limit)),
)


var result build.TransactionEnvelopeBuilder
err := result.Mutate(trustTx)
if err != nil {
    log.Fatal(err)
}

trustTxeB64, err := result.Base64()

To sign in client side offline

var txe xdr.TransactionEnvelope
err = xdr.SafeUnmarshalBase64(trustTxeB64, &txe)
if err != nil {
    log.Fatal(err)
}

b := &build.TransactionEnvelopeBuilder{E: &txe}
b.Init()
err = b.MutateTX(build.TestNetwork)
if err != nil {
    log.Fatal(err)
}
err = b.Mutate(build.Sign{cd.Signerkey})
if err != nil {
    log.Fatal(err)
}

newEnv, err := xdr.MarshalBase64(b.E)
if err != nil {
    log.Fatal(err)
}

to submit that to an online node

    resp, err := horizon.DefaultTestNetClient.SubmitTransaction(newEnv)
3
  • Thx for answer but how do you sign it on offline stellar node and then send to block chain with online node?? Commented Sep 6, 2018 at 7:26
  • You can create a client side application where user can import their privatekey and sign the XDR in client side and convert it as a signed XDR. then they can submit that through horizon.
    – Sharmilan
    Commented Sep 6, 2018 at 7:33
  • I update my answer hope now you can sing this in offline and submit online
    – Sharmilan
    Commented Sep 6, 2018 at 8:29
0

There is no need for the internet to build the transaction. Only you need to network to submit the transaction to horizon. To build the transaction you can use go SDK and need to export as base64. at the moment as i know we can get the base64 XDR after signed only. So if you want to use multisign then you can sign and build the transaction in go SDK and send the XDR to others and get their signs as well. They can sign through laboratory or even you can provide any client interface where you use one of the stellar SDK and sign and return the XDR. To make the transaction succeed you need to have the internet connection and you need to submit that to stellar horizon.

2
  • I suspect the use-case is that the transaction is formed from a request coming over the network, saved to disk and signed from cold storage. It's not necessarily multi-sig.
    – Synesso
    Commented Aug 2, 2018 at 10:16
  • in that case the request can build but to retrieve as base64 we need to sign in go SDK. other wise i dont think there is any way in GO. But its possible in laboratory
    – Sharmilan
    Commented Aug 2, 2018 at 10:22
0

While not quite the intention of this question, this functionality is currently fully featured and available in the JavaScript SDK.

Your Answer

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

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