Hot answers tagged

18

This was not an easy choice indeed. It sounded weird at first to use something like XDR but it ended up winning compared to others for a few reasons: there is an RFC and it's extremely simple. The implementations have very little attack surface and the risk of having strange inconsistencies between implementations is very low. the serialized form (on the ...


6

XDR is a binary encoding of structured data. It is represented as a base 64 encoded String in transaction responses. Some options: You can decode base 64 encoded XDR using the laboratory. The JavaScript SDK provides instructions to deserialise the Base 64 XDR into JSON. If you can use the Scala SDK you can call SignedTransaction.decodeXDR(base64)(...


5

I believe that is the extra padding bytes set so that the length is a multiple of 4. From the RFC 4506 (a.k.a. the XDR Spec): The standard defines a string of n (numbered 0 through n-1) ASCII bytes to be the number n encoded as an unsigned integer (as described above), and followed by the n bytes of the string. Byte m of the string always ...


5

Given transaction is a Transaction object then this will give you base64 encoded XDR: transaction.toEnvelope().toXDR().toString("base64")


4

Start with 32 bytes Add a byte of 0x30 as prefix 'G' (now you have 33 bytes) Calculate the checksum (two bytes) Add the checksum as suffix (now you have 35 bytes) Convert them to base32 That's your public key Apply the same but using 'S' (byte 0x90) as prefix for secret keys


3

You pass it directly in the constructor. This is described in the doc you linked to: Parameters: envelope string | xdr.TransactionEnvelope So do this: // `transactionXDR` is a string from the person generating the transaction const transaction = new Transaction(transactionXDR, networkPassphrase); See also the docs for adding a signature to a ...


3

I already found out, just needed to add 'base64' as a parameter: transaction.toEnvelope().toXDR('base64')


3

The first serialization can be done via: const base64str = transaction.toEnvelope().toXDR().toString('base64') Then you have a base64 encoded string that can be safely transmitted over the network. To restore it back to the original object you can do: const tx = new Transaction(base64str)


3

I'm just going to guess here, since I don't do golang, but if you look at what Sign does, can't you just copy that implementation yourself, and skip the signing part? I.e., func (b *TransactionBuilder) Sign(signers ...string) (TransactionEnvelopeBuilder, error) { var result TransactionEnvelopeBuilder err := result.Mutate(b) if err != nil { ...


3

I'd let the SDK decode the XDR for you, and take it from there. const tx = new StellarSdk.Transaction(tx_xdr); From here on you have the source accounts in tx.source and tx.operations[i].source, for 0 < i < tx.operations.length. Easy peasy!


3

I know that you got the answer on github, but for anyone else looking I'll link it here: https://github.com/stellar/js-stellar-sdk/issues/191 This is fixed in: js-xdr@1.0.4 stellar-base@0.8.2 stellar-sdk@0.10.2


2

Total number of all XLM is not a constant. Every week the built-in inflation mechanism distributes new lumens. You can find detailed information here.


2

All the transactions are encoded into XDR format (External Data Representation). Horizon decodes it and displays all the transactions in a readable format (JSON). In order to inspect the Stellar blockchain in a better visual experience, you must interact with Horizon, or use any Stellar block explorer that interacts with a Horizon server on the public ...


2

You are looking at the SetOptionsOp, that's an operation contract. A transaction can include up to 100 operations (this constant may be changed in the future). Therefore you can atomically add up to 100 signers.


1

def get_balance_id(create_claimable_balance_resp): effects_link = create_claimable_balance_resp["_links"]["effects"]["href"].split("{")[0] resp = requests.get(effects_link) content = json.loads(resp.content) balance_id = content["_embedded"]["records"][0]["balance_id"] ...


1

At first, I recommend you read this article, which describes the composition of a transaction. Hope this example helps. from stellar_sdk import TransactionEnvelope, Network, TextMemo, IdMemo, HashMemo, ReturnHashMemo, Payment envelope_xdr = 'AAAAAD11sXdkWzZ8LQrxr5zWXdrI6CK5Pz/+...


1

A stellar transaction consists of one or more operations such as payment, createAccount, setOptions. I'm not familiar with python-sdk but I think like in other sdk's the transaction object should also have a operations method or property which should deliver all related operations. You have to iterate through the operations of a given transaction (for op in ...


1

get it! xdrstr='AAAAAVNMVAAAAAAAlA8rrxQ89pexgEv3wGm0Tu9RxisitWx4ONyNc5Xn7qg=' tx_result = Xdr.StellarXDRUnpacker(base64.b64decode(xdrstr)).unpack_Asset()


1

The transaction can optionally contain timebounds, placing a lower and upper bound on when it may be executed. However, if you want to know whether and exactly when the transaction was executed, you need to query the blockchain history, e.g., by querying horizon for the txID. Here's the appropriate documentation for the transaction endpoint: https://www....


1

If it's a transaction you have, and not a transaction envelope, then the transaction hash is formed using the XDR directly. const envelopeType = StellarSdk.xdr.EnvelopeType.envelopeTypeTx().toXDR(); const signatureBase = Buffer.concat([networkId, envelopeType, txXDR]) const transactionHash = StellarSdk.hash(signatureBase);


1

You should debug the XDR serialisation stage. Something that should be a 64-bit integer is null. The one hint you get is that the field type is Hyper. This refers to 64-bit signed or unsigned integers in the XDR scheme. You can see the Hyper fields in the XDR serialisation code.


1

var txe xdr.Transaction err = xdr.SafeUnmarshalBase64(TDP.XDR, &txe) if err != nil { fmt.Println(err) } You can use above code to Unmarshal Base64 XDR. And using &txe you can retrieve what ever value you need.


1

I have some examples for that in my kotlin library that wraps the java sdk. data class PreparedTransaction(val transactionHash: String, val transactionEnvelopeXdr: String) fun preparePaymentTransaction( sender: KeyPair, receiver: KeyPair, amount: TokenAmount, asset: Asset = amount.asset ?: nativeXlmAsset, memo: String? = null ): ...


1

I have just written a patch for the Java SDK to deserialize TransactionEnvelope XDR. https://github.com/stellar/java-stellar-sdk/pull/117 If you can wait, hopefully it will be approved and merged. After which you can simply call Transaction.fromEnvelopeXdrBase64(base64String). If you can't wait, you can copy the code in that PR directly to your project. ...


1

To get the last transactions you can make a request to an Horizon server, if you don't have one you can use public horizon server (horizon.stellar.org) but its limited. For query transactions you have to call transactions endpoint HERE AN EXAMPLE as you can see there are also human readble informations isn't necessary translating from XDR. Here the infos ...


1

Answer from official doc: Checkpoints are made once every 64 ledgers, at ledger sequence numbers that are one-less-than a multiple of 64. Checkpoints are where a new ledger-headers file is born, at ledger seq # 63, 127, 191, ... As the chain started from ledger #1, the first checkpoint wraps up only ledger #1 - #63. Personal comment: The ...


1

Option 1 is correct. There is a serialisation layer used to pack the data into a strict format before base 64 encoding. The XDR serde libraries used by the core SDKs are generated by running this code generator against the Stellar XDR specification. I am not very familiar with R, but I can see on wikipedia that XDR is in some way native to R. Details are ...


1

Encoding: You can serialize the transaction by first converting to XDR (which is a binary format) and then converting to a base64 string so it can be sent over the wire. // sign with empty signature to convert to a transaction envelope signed, e := txn.Sign() if e != nil { log.Fatal("failed to sign: ", e) } // convert to base64 (b64 is a string) b64, e ...


1

We don't have any other official history archived besides history.stellar.org, although we do plan to add more at some point in the future. We're also hoping others will step up and host history mirrors to better decentralize. In my non-company opinion, I'd prefer the network to be in a state such that the "official" history archives are not necessary. ...


Only top voted, non community-wiki answers of a minimum length are eligible