5

Is it possible to call a tezos-client binary from within a programming language? I have been trying to achieve this, but without success. The very same command used through the command line works, but when I call it from a script, it fails.

I've seen some advice to write the command inside a shell script, like test.sh. I did this and the script only works in the command line. If I call it from within a program, it fails too.

Is this a security measure of tezos-client? Or is there a correct way to do it?

This is the command I want to call in my software:

tezos-client transfer 1 from myAlias to tz1.... --fee 0.05 --dry-run
1
  • 2
    Please report the error message you say otherwise it is unclear what is your problem
    – Ezy
    Feb 11 '19 at 2:13
5

Try to be as explicit as possible:

  • specify the full path to tezos-client
  • specify the absolute directory containing the data, especially the aliases (generally --base-dir /home/[..USER..]/.tezos-client)

If it does not work, copy-paste the error messages, so that we can understand the problem.

1
  • 1
    This solved the problem. After I've added --base-dir /home/user/tezos/.tezos-client to the transfer command, it worked flawlessly. A sample functional command would be like this: /home/user/tezos/tezos-client --base-dir /home/user/.tezos-client transfer 1 from myAlias to tz1.... --fee 0.05 --dry-run Feb 11 '19 at 23:41
1

Try the full path. Like that:

home/your_user_name/tezos/tezos-client transfer 1 from myAlias to tz1.... --fee 0.05 --dry-run
3
  • I've already tried full path and there is no difference. It works on cmd line, but fails if called inside a program. Tezos-client returns a message saying it does not recognize the alias. Feb 11 '19 at 0:00
  • Check the user your script is running as. It sounds like it may not be the one you think it is.
    – xtzbaker
    Feb 11 '19 at 6:12
  • 1
    The full path is important, but what was really missing was the --base-dir parameter. Anyways, thank you a lot. Feb 11 '19 at 23:46

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.