From 7083eb0a3d4580a50d37e85d1761857d741396d4 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Mon, 6 Sep 2021 19:34:23 +0300 Subject: [PATCH 1/3] feat: expand sign and send cases Previously, if ETH_RPC_ACCOUNTS was set, seth-send would always use the node's accounts as its signers. Now, even if it's set, it'll first check if the specified ETH_FROM is in the keystore, and use it if so. --- src/seth/libexec/seth/seth-send | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/seth/libexec/seth/seth-send b/src/seth/libexec/seth/seth-send index 1affbd985..ac2236634 100755 --- a/src/seth/libexec/seth/seth-send +++ b/src/seth/libexec/seth/seth-send @@ -51,9 +51,15 @@ jshon+=(-n {}) jshon+=($(seth --send-params)) jshon+=(-i append) -if [[ -z $ETH_RPC_ACCOUNTS ]]; then +function signAndSend() { tx=$(seth mktx "$TO" "$DATA") tx=$(seth publish "$tx") +} + +if [[ -z $ETH_RPC_ACCOUNTS ]]; then + signAndSend +elif ethsign ls | grep -q $ETH_FROM; then + signAndSend else tx=$(seth rpc eth_sendTransaction -- "${jshon[@]}") fi From bdfbc652fc461d52e21278b6186842f9ba38430d Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Tue, 7 Sep 2021 13:14:19 +0300 Subject: [PATCH 2/3] docs: update changelog & key mgmt section --- src/seth/CHANGELOG.md | 2 ++ src/seth/README.md | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/seth/CHANGELOG.md b/src/seth/CHANGELOG.md index 855a0f7ea..933b78fe6 100644 --- a/src/seth/CHANGELOG.md +++ b/src/seth/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `seth resolve-name ` to resolve an ENS name to an address - `seth lookup-address
` to lookup the ENS name an address reverse resolves to - Dynamic transaction fee format transactions (EIP-1559) supported by introducing the flag `--prio-fee` and corresponding environment variable `ETH_PRIO_FEE` to seth and ethsign. If `--prio-fee` is provided (or `ETH_PRIO_FEE`) is set, 1559 transaction will be used and `--gas-price` will reflect the maximum gas price, rather than the absolute gas price. +- If `ETH_RPC_ACCOUNTS` is set and the account corresponding to `ETH_FROM` exists in the keystore, +Seth will sign the transaction locally and then publish it signed (previously it'd always send it to the node) ### Changed diff --git a/src/seth/README.md b/src/seth/README.md index ae183100e..1113942be 100644 --- a/src/seth/README.md +++ b/src/seth/README.md @@ -189,6 +189,10 @@ the `ETH_RPC_ACCOUNTS` variable or use the `--rpc-accounts` flag. This probably means you need to use Geth's or Parity's account management tools to "unlock" your account. +If both `ETH_RPC_ACCOUNTS` and `ETH_FROM` are set, Seth will first check if the +provided account is in the keystore and only use the RPC node's signer if the +account does not exist. + Note: Seth uses the [`ethsign`] tool for signing transactions. This tool uses Geth as a library. From e8a839e72c555f7c7e6532ce053d50392770dd8c Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Tue, 7 Sep 2021 13:24:15 +0300 Subject: [PATCH 3/3] Update src/seth/README.md Co-authored-by: David Terry <6689924+d-xo@users.noreply.github.com> --- src/seth/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/seth/README.md b/src/seth/README.md index 1113942be..f42fa56bc 100644 --- a/src/seth/README.md +++ b/src/seth/README.md @@ -189,10 +189,9 @@ the `ETH_RPC_ACCOUNTS` variable or use the `--rpc-accounts` flag. This probably means you need to use Geth's or Parity's account management tools to "unlock" your account. -If both `ETH_RPC_ACCOUNTS` and `ETH_FROM` are set, Seth will first check if the -provided account is in the keystore and only use the RPC node's signer if the -account does not exist. - +If both `ETH_RPC_ACCOUNTS` and `ETH_FROM` are set, `seth` will first check if the +provided account can be found in the keystore, or in any connected hardware +wallet, and only use the RPC node's signer if the account does not exist. Note: Seth uses the [`ethsign`] tool for signing transactions. This tool uses Geth as a library.