Skip to content
This repository has been archived by the owner on Oct 24, 2020. It is now read-only.

Error! Please fix! #24

Closed
AugustoResende opened this issue Nov 23, 2016 · 8 comments
Closed

Error! Please fix! #24

AugustoResende opened this issue Nov 23, 2016 · 8 comments

Comments

@AugustoResende
Copy link

exception 'InvalidArgumentException' with message 'Argument with name hexDataToSign is not an array' in /var/www/html/api/php-client/blockcypher/php-client/lib/BlockCypher/Validation/ArgumentArrayValidator.php:23 Stack trace: #0 /var/www/html/api/php-client/blockcypher/php-client/lib/BlockCypher/Crypto/Signer.php(27): BlockCypher\Validation\ArgumentArrayValidator::validate(NULL, 'hexDataToSign') #1 /var/www/html/api/php-client/blockcypher/php-client/lib/BlockCypher/Api/MicroTX.php(76): BlockCypher\Crypto\Signer::signMultiple(NULL, 'b43dca12714fdfd...') #2 /var/www/html/api/php-client/blockcypher/php-client/lib/BlockCypher/Client/MicroTXClient.php(41): BlockCypher\Api\MicroTX->sign('b43dca12714fdfd...') #3 /var/www/html/api/v2/withdraw.php(104): BlockCypher\Client\MicroTXClient->sendSigned('b43dca12714fdfd...', '1HZGbUohWUc28oa...', 10000) #4 /var/www/html/api/v2/withdraw.php(39): transferirBTC('18eBFNeG4rQxJJJ...', '1HZGbUohWUc28oa...', 10000, 'b43dca12714fdfd...') #5 {main}

@AugustoResende
Copy link
Author

Now only says:

[23-11-2016 06:12:15] BlockCypher\Core\BlockCypherHttpConnection: INFO : POST https://api.blockcypher.com/v1/btc/main/txs/micro?token=29252d675d8d429181aee1546246a65a
[23-11-2016 06:12:17] BlockCypher\Core\BlockCypherHttpConnection: INFO : Response Status : 500
[23-11-2016 06:12:17] BlockCypher\Core\BlockCypherHttpConnection: ERROR : Got Http response code 500 when accessing https://api.blockcypher.com/v1/btc/main/txs/micro?token=29252d675d8d429181aee1546246a65a. {"error": "Error building micro transaction: Not enough funds in 0 inputs to pay for 1 outputs, missing -10000."}

In log, but address is https://blockchain.info/pt/address/18eBFNeG4rQxJJJj5ZtiDSYjC7djLJCpU
Have funds!

@josecelano
Copy link
Contributor

Could you try to reproduce the problem with one of the php-clientsamples?. For example:

You can create a new BCY address, fund it with BlockCypher test chain coins, and try to reproduce the problem running this sample:

php -f /var/www/html/api/php-client/sample/microtransaction-api/CreateMicroTXFromPubkeyDocsSample.php

You can run it from console.

Maybe you are using a wrong private key. You can also try to execute this sample:

php -f /var/www/html/api/php-client/sample/microtransaction-api/CreateSignAndSendMicroTransaction.php

With this sample you will get feedback after each step in the process so we can now what part of the proccess fails.

I think you could be using a wrong private key.

@AugustoResende
Copy link
Author

No, i am using a correct private key...
Normal TX works!
I will try reproduce!

@AugustoResende
Copy link
Author

Even yesterday was working!

@josecelano
Copy link
Contributor

OK @GabrielAugustoTI I also will try to execute both types with the same private key. Anyway it could be useful if you tell me what's different from yesterday, do you use the same private key? did you update some dependencies? PHP version? ...

@AugustoResende
Copy link
Author

Same private key, same dependencies, same PHP version, same Blockcypher client...
And sendwithprivatekey works fine, but sendwithprivatekey is insecure and not include fee, is very bad

@josecelano
Copy link
Contributor

Hi @GabrielAugustoTI . I have just executed this test and it works:

I have created this new BlockCypher testnet address:

/php-client/sample/introduction/GenerateBcyAddress.php
{
    "private": "dfb77f6f3df5aea30faca64b89c02ced32b3946e32e3f0efd30cbe4a678be48d",
    "public": "0364ba4cc04fb7426f5805bcb2146d0946172be9afa9b275861cbb9d4a63e861de",
    "address": "BzDhN53gVsn175V439Dbt2DY1R69TzFNMF",
    "wif": "BvpuZKtgvgKpfdLYH2QmiRMgnHUqd9ANU2neCfB1CePxkDK5rfQ6"
}

Then I have funded the address with the faucet (100000 satoshis) using this sample script:

/php-client/sample/introduction/FundAddressWithFaucet.php

And finally I have created a transaction from address BzDhN53gVsn175V439Dbt2DY1R69TzFNMF to the address C4MYFr4EAdqEeUKxTnPUF3d3whWcPMz1Fi (10000 satoshis) using the sample script:

/php-client/sample/microtransaction-api/CreateSignAndSendMicroTransaction.php

You can see both transactions here:
https://live.blockcypher.com/bcy/address/BzDhN53gVsn175V439Dbt2DY1R69TzFNMF/

Please, try to do the same and send me the log file content.

More detailed log:

Created and Send MicroTX Request

{
    "from_pubkey": "0364ba4cc04fb7426f5805bcb2146d0946172be9afa9b275861cbb9d4a63e861de",
    "to_address": "C4MYFr4EAdqEeUKxTnPUF3d3whWcPMz1Fi",
    "value_satoshis": 10000,
    "tosign": [
        "a11bf9c1d39952598b8d1188938e13b1c205b6c71c78bd9fa4be0992b9147ccd"
    ],
    "token": "16c51494e5d0423391d7c4a14a45ec09",
    "inputs": [
        {
            "prev_hash": "abc2307bc004bf5c794adcb5fdd979486a07bfb06fe80849068ceececa78d503",
            "output_index": 0
        },
        {
            "prev_hash": "2edc134d6cb77cf287a663e439d0e2bd901f939ffbaee83c83b1866e33f4edd0",
            "output_index": 1
        }
    ],
    "outputs": [
        {
            "address": "C4MYFr4EAdqEeUKxTnPUF3d3whWcPMz1Fi",
            "value": 10000
        },
        {
            "address": "BxeGtkPZM6qUsfkZ4pzaq4TF1RHNoqdZHT",
            "value": 9857300
        },
        {
            "address": "BzDhN53gVsn175V439Dbt2DY1R69TzFNMF",
            "value": 90000
        }
    ],
    "fees": 1700
}

@quentinlesceller
Copy link
Contributor

Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants