1

As I understand "If one operation is wrong then the whole transaction is wrong"

Trying to find the cause 'op_malformed'

I already read it "Transaction Malformed" I never found a mistake

This is operations [2] in transaction:

 [2] => ZuluCrypto\StellarSdk\XdrModel\Operation\ManageOfferOp Object
                    (
                        [sellingAsset:protected] => ZuluCrypto\StellarSdk\XdrModel\Asset Object
                            (
                                [type:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 1
                                [assetCode:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => ****
                                [issuer:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => ZuluCrypto\StellarSdk\XdrModel\AccountId Object
                                    (
                                        [accountIdString:ZuluCrypto\StellarSdk\XdrModel\AccountId:private] => **************************************HQ52
                                        [accountIdBytes:ZuluCrypto\StellarSdk\XdrModel\AccountId:private] => *********
                                        [keyType:ZuluCrypto\StellarSdk\XdrModel\AccountId:private] => 0
                                    )

                            )

                        [buyingAsset:protected] => ZuluCrypto\StellarSdk\XdrModel\Asset Object
                            (
                                [type:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 0
                                [assetCode:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 
                                [issuer:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 
                            )

                        [amount:protected] => ZuluCrypto\StellarSdk\Model\StellarAmount Object
                            (
                                [stroops:protected] => phpseclib\Math\BigInteger Object
                                    (
                                        [value] => 0x038d7ea42de980
                                        [engine] => internal (64-bit, OpenSSL)
                                    )

                                [stroopScaleBignum:protected] => phpseclib\Math\BigInteger Object
                                    (
                                        [value] => 0x00989680
                                        [engine] => internal (64-bit, OpenSSL)
                                    )

                                [maxSignedStroops64:protected] => phpseclib\Math\BigInteger Object
                                    (
                                        [value] => 0x7fffffffffffffff
                                        [engine] => internal (64-bit, OpenSSL)
                                    )

                            )

                        [price:protected] => ZuluCrypto\StellarSdk\XdrModel\Price Object
                            (
                                [numerator:protected] => 0.0004328
                                [denominator:protected] => 1
                            )

                        [offerId:protected] => 71480124
                        [sourceAccount:protected] => 
                        [type:protected] => 3
                    )

this is horizon response:

ZuluCrypto\StellarSdk\Horizon\Api\PostTransactionResponse Object
(
    [result:protected] => 
    [rawData:protected] => Array
        (
            [type] => https://stellar.org/horizon-errors/transaction_failed
            [title] => Transaction Failed
            [status] => 400
            [detail] => The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details.  Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html
            [extras] => Array
                (
                    [envelope_xdr] => *****************==
                    [result_codes] => Array
                        (
                            [transaction] => tx_failed
                            [operations] => Array
                                (
                                    [0] => op_success
                                    [1] => op_success
                                    [2] => op_malformed
                                    [3] => op_success
                                )

                        )

                    [result_xdr] => AAAAAAAAAZD/////*****************=
                )

        )

)

maybe there is an error:

[buyingAsset:protected] => ZuluCrypto\StellarSdk\XdrModel\Asset Object
                            (
                                [type:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 0
                                [assetCode:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 
                                [issuer:ZuluCrypto\StellarSdk\XdrModel\Asset:private] => 
                            )

Many thanks to all for help in finding the error. @sui @Synesso

The price in stellar is displayed as a simple fraction in which you need to transfer your decimal, and publish it in the form: numerator and denominator separately. (int) numerator, (int) denominator.

I tested a lot of functions for finding the minimum fraction for converting from decimal, this is what I found / added (PHP code):

function float2fraction($n, $tolerance = 1.e-9) { 
/* www.mera.one, stellar price float2fraction function - return numerator / denominator */
    $n = (float) $n;
    $h1=1; $h2=0;
    $k1=0; $k2=1;
    $b = 1/$n;
    do {
        $b = 1/$b;
        $a = floor($b);
        $aux = $h1; $h1 = $a*$h1+$h2; $h2 = $aux;
        $aux = $k1; $k1 = $a*$k1+$k2; $k2 = $aux;
        $b = $b-$a;
    } while (abs($n-$h1/$k1) > $n*$tolerance);

    if ( ! empty ( $h1 ) && ! empty ( $k1 ))
        return array ( "nominator" => $h1, "denominator" => $k1, "str_view" => "$h1/$k1" ) ;
    else
        return false;
}

ps: I also received an error from the ZuluCrypto class "error code 3 in CreateAccountResult.php", adding this code to the $errorCodeMap program began to run. In ZuluCrypto itself, it’s just about writing errors when working with floating point ("Floating point issues")

  • Please show us the value for envelope_xdr – Synesso Mar 12 at 20:33
  • added to the question – Minherc Mar 13 at 8:02
1

You can use the stellar laboratory XDR viewer to debug it. You can get the transactions XDR representation with this method using zulucrypto/stellar-api php sdk:

echo base64_encode($txEnvelope->toXdr());
  • can you post the raw xdr output? – sui Mar 12 at 20:39
1

The result XDR, when decoded, shows the error is manage_offer_malformed. The description for this error is

The input is incorrect and would result in an invalid offer.

The transaction has a price of 0/1. This seems wrong.

  • 1
    Your price is wrong. [price:protected] => ZuluCrypto\StellarSdk\XdrModel\Price Object ( [numerator:protected] => 0.0004328 [denominator:protected] => 1 ) numerator should be int, its rounded to 0 and thus is malformed. (this one: ´$mera_current_courses [ $val [ 'asset_code_b' ] ]´ ) – sui Mar 13 at 10:39

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.