$ git clone https://github.com/hyperledger/sawtooth-seth
$ cd sawtooth-seth
- Build with
$ docker build . -f docs/Dockerfile -t seth-build-docs
- Run with
$ docker run -v $(pwd)/docs:/project/sawtooth-seth/docs seth-build-docs
It takes painfully long time and might file at times, However process gets a lot fast after it completes.
$ docker-compose up --build
$ docker-compose up
not$ docker-compose -f xxx up --force
or something similar.
$ curl http://0.0.0.0:8080/blocks
$ curl -d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "id": 1}' -H "Content-Type: application/json" localhost:3030
Follow :
- Easy Method: Open docker-compose.yaml and docker-compose-installed.yaml and make changes to match the ones at here
- What changed?
- In docker-compose.yaml
- A common volumn created for both seth-rpc and seth-cli by added
sawtooth:/root/.sawtooth
to volumn service of both seth-rpc and seth-cli, adding a volumnsawtooth
in along with service. - expose port 3030 explictly for seth-rpc and enclosing '3030:3030' in ports
- Adding proxy args
- http_proxy
- https_proxy
- no_proxy
- Remove
seth init http://rest-api:8080 &&
from seth-rpc around 131 line.
- A common volumn created for both seth-rpc and seth-cli by added
- In docker-compose-installed.yaml
- Add proxy args similar to above
- In docker-compose.yaml
- Rebuild the docker
$ docker-compose up --build
-
Open a new terminal
-
$ docker exec -it seth-cli bash
-
# openssl ecparam -genkey -name secp256k1 | openssl ec -out <filename>.pem -aes128
-
# seth account import <filename>.pem <alias>
- Note: The alias will be used for refering the account in future. Located at
~/.sawtooth/keys
- Note: The alias will be used for refering the account in future. Located at
-
# seth account create --nonce=0 --wait <alias>
-
verify the existance of account
# seth show account {address}
-
Connect with rest-api
seth init http://rest-api:8008
- Open up a new terminal
$ docker exec -it seth-rpc bash
ls ~/.sawtooth/keys -al
.
If you don't find the file ensure you made the changes as shown in above Note and rebuild the docker images
- Close the terminal
- Open a new terminal
$ docker exec -it seth-rpc bash
$ seth-rpc --connect tcp://validator:4004 --bind 0.0.0.0:3030 --unlock <alias>
.
It goes into listening mode, let it be
Follow:
- It means the key file of alias was not found
- Easy Soln: Make changes to rpc/src/accounts.rs and rpc/comp_seth_rpc.yaml as in here
- Rebuild the docker images by
$ docker compose up --build
-
Open a new terminal
-
Test if your account is recognized by ethAccounts
$ curl -d '{"jsonrpc": "2.0", "method": "eth_accounts", "id": 2, "params": []}' -H "Content-Type: application/json" localhost:3030
.
If the result is [], recheck the connections and make sure all the Note is followed where required.
-
Create and deploy a contract
- Make a .sol in
/sawtooth-seth/contracts/
.
It goes unsaid write logic of transactions in the sol file
- Get bytecode by executing
$ solc --bin contract.sol
.
If solc is unintalled install it using official ethereum docs
- Copy the hexadecimal bytecode to someplace.
- Deploy the contract as followed
- In a free terminal (Not in listning mode) execute
curl -d '{"jsonrpc": "2.0", "method": "eth_sendTransaction", "id": 2, "params": [{ "from": "0x{address}", "data": "0x{contract}" }]}' -H "Content-Type: application/json" localhost:3030
- The address is the address of account that was unlocked before, contract is the bytecode you just copied.
- In a free terminal (Not in listning mode) execute
- Make a .sol in
- Re-read the above notes and find which step you missed
- Ensure the address is read by ethAccounts like tested above.
- Make sure you imported and created the account like said above.
- honestly, it's re-testing every step that helped me.
- Verify the contract
- If the contract had passed, a JSON object would be returned with Transactionsid
- Run
$ curl -d '{"jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "id": 3, "params": ["0x{Transactionsid}"] }' -H "Content-Type: application/json" localhost:3030
- If you get response then you've deployed it successfully.
- Refer this
- All the information above is collected from
https://chat.hyperledger.org/channel/sawtooth-seth
and github issues, pull requests. - I have not created any of the above solutions provided.
- Purpose of this page was to smooth the process of a new dev into the seth environment.