Search code examples
hyperledger-sawtooth

Starting with sawtooth xo transaction


I have setup Hyperledger Sawtooth on Docker, I am trying to test sawtooth XO transactions with following commands

uname@uname:~/sawtooth$ docker exec -it sawtooth-shell-default bash
root@5279e5a413c1:/# xo create one

but I am getting following error

Error: Failed to connect to http://127.0.0.1:8008/batches: HTTPConnectionPool(host='127.0.0.1', port=8008): Max retries exceeded with url: /batches (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))

FYKI This commands works for me

From shell this gives me blocks

curl http://rest-api:8008/blocks

From my host this works as expected

curl http://localhost:8008/blocks
curl http://127.0.0.1:8008/blocks

What is wrong with this?

My yaml file is the default one, you can find it here


Solution

  • If you are using docker you have to mention url to APIs this way

    xo create one --url http://rest-api:8008
    

    I found this after Ashish gave this hint at

    https://chat.hyperledger.org/channel/sawtooth