api.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. // Copyright 2018 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // go-ethereum is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package core
  17. import (
  18. "context"
  19. "encoding/json"
  20. "errors"
  21. "fmt"
  22. "io/ioutil"
  23. "math/big"
  24. "reflect"
  25. "github.com/ethereum/go-ethereum/accounts"
  26. "github.com/ethereum/go-ethereum/accounts/keystore"
  27. "github.com/ethereum/go-ethereum/accounts/usbwallet"
  28. "github.com/ethereum/go-ethereum/common"
  29. "github.com/ethereum/go-ethereum/common/hexutil"
  30. "github.com/ethereum/go-ethereum/internal/ethapi"
  31. "github.com/ethereum/go-ethereum/log"
  32. "github.com/ethereum/go-ethereum/rlp"
  33. )
  34. const (
  35. // numberOfAccountsToDerive For hardware wallets, the number of accounts to derive
  36. numberOfAccountsToDerive = 10
  37. // ExternalAPIVersion -- see extapi_changelog.md
  38. ExternalAPIVersion = "5.0.0"
  39. // InternalAPIVersion -- see intapi_changelog.md
  40. InternalAPIVersion = "3.1.0"
  41. )
  42. // ExternalAPI defines the external API through which signing requests are made.
  43. type ExternalAPI interface {
  44. // List available accounts
  45. List(ctx context.Context) ([]common.Address, error)
  46. // New request to create a new account
  47. New(ctx context.Context) (accounts.Account, error)
  48. // SignTransaction request to sign the specified transaction
  49. SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error)
  50. // SignData - request to sign the given data (plus prefix)
  51. SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (hexutil.Bytes, error)
  52. // SignTypedData - request to sign the given structured data (plus prefix)
  53. SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error)
  54. // EcRecover - recover public key from given message and signature
  55. EcRecover(ctx context.Context, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error)
  56. // Export - request to export an account
  57. Export(ctx context.Context, addr common.Address) (json.RawMessage, error)
  58. // Import - request to import an account
  59. // Should be moved to Internal API, in next phase when we have
  60. // bi-directional communication
  61. //Import(ctx context.Context, keyJSON json.RawMessage) (Account, error)
  62. Version(ctx context.Context) (string, error)
  63. }
  64. // SignerUI specifies what method a UI needs to implement to be able to be used as a UI for the signer
  65. type SignerUI interface {
  66. // ApproveTx prompt the user for confirmation to request to sign Transaction
  67. ApproveTx(request *SignTxRequest) (SignTxResponse, error)
  68. // ApproveSignData prompt the user for confirmation to request to sign data
  69. ApproveSignData(request *SignDataRequest) (SignDataResponse, error)
  70. // ApproveExport prompt the user for confirmation to export encrypted Account json
  71. ApproveExport(request *ExportRequest) (ExportResponse, error)
  72. // ApproveImport prompt the user for confirmation to import Account json
  73. ApproveImport(request *ImportRequest) (ImportResponse, error)
  74. // ApproveListing prompt the user for confirmation to list accounts
  75. // the list of accounts to list can be modified by the UI
  76. ApproveListing(request *ListRequest) (ListResponse, error)
  77. // ApproveNewAccount prompt the user for confirmation to create new Account, and reveal to caller
  78. ApproveNewAccount(request *NewAccountRequest) (NewAccountResponse, error)
  79. // ShowError displays error message to user
  80. ShowError(message string)
  81. // ShowInfo displays info message to user
  82. ShowInfo(message string)
  83. // OnApprovedTx notifies the UI about a transaction having been successfully signed.
  84. // This method can be used by a UI to keep track of e.g. how much has been sent to a particular recipient.
  85. OnApprovedTx(tx ethapi.SignTransactionResult)
  86. // OnSignerStartup is invoked when the signer boots, and tells the UI info about external API location and version
  87. // information
  88. OnSignerStartup(info StartupInfo)
  89. // OnInputRequired is invoked when clef requires user input, for example master password or
  90. // pin-code for unlocking hardware wallets
  91. OnInputRequired(info UserInputRequest) (UserInputResponse, error)
  92. }
  93. // SignerAPI defines the actual implementation of ExternalAPI
  94. type SignerAPI struct {
  95. chainID *big.Int
  96. am *accounts.Manager
  97. UI SignerUI
  98. validator *Validator
  99. rejectMode bool
  100. }
  101. // Metadata about a request
  102. type Metadata struct {
  103. Remote string `json:"remote"`
  104. Local string `json:"local"`
  105. Scheme string `json:"scheme"`
  106. UserAgent string `json:"User-Agent"`
  107. Origin string `json:"Origin"`
  108. }
  109. // MetadataFromContext extracts Metadata from a given context.Context
  110. func MetadataFromContext(ctx context.Context) Metadata {
  111. m := Metadata{"NA", "NA", "NA", "", ""} // batman
  112. if v := ctx.Value("remote"); v != nil {
  113. m.Remote = v.(string)
  114. }
  115. if v := ctx.Value("scheme"); v != nil {
  116. m.Scheme = v.(string)
  117. }
  118. if v := ctx.Value("local"); v != nil {
  119. m.Local = v.(string)
  120. }
  121. if v := ctx.Value("Origin"); v != nil {
  122. m.Origin = v.(string)
  123. }
  124. if v := ctx.Value("User-Agent"); v != nil {
  125. m.UserAgent = v.(string)
  126. }
  127. return m
  128. }
  129. // String implements Stringer interface
  130. func (m Metadata) String() string {
  131. s, err := json.Marshal(m)
  132. if err == nil {
  133. return string(s)
  134. }
  135. return err.Error()
  136. }
  137. // types for the requests/response types between signer and UI
  138. type (
  139. // SignTxRequest contains info about a Transaction to sign
  140. SignTxRequest struct {
  141. Transaction SendTxArgs `json:"transaction"`
  142. Callinfo []ValidationInfo `json:"call_info"`
  143. Meta Metadata `json:"meta"`
  144. }
  145. // SignTxResponse result from SignTxRequest
  146. SignTxResponse struct {
  147. //The UI may make changes to the TX
  148. Transaction SendTxArgs `json:"transaction"`
  149. Approved bool `json:"approved"`
  150. Password string `json:"password"`
  151. }
  152. // ExportRequest info about query to export accounts
  153. ExportRequest struct {
  154. Address common.Address `json:"address"`
  155. Meta Metadata `json:"meta"`
  156. }
  157. // ExportResponse response to export-request
  158. ExportResponse struct {
  159. Approved bool `json:"approved"`
  160. }
  161. // ImportRequest info about request to import an Account
  162. ImportRequest struct {
  163. Meta Metadata `json:"meta"`
  164. }
  165. ImportResponse struct {
  166. Approved bool `json:"approved"`
  167. OldPassword string `json:"old_password"`
  168. NewPassword string `json:"new_password"`
  169. }
  170. SignDataRequest struct {
  171. ContentType string `json:"content_type"`
  172. Address common.MixedcaseAddress `json:"address"`
  173. Rawdata []byte `json:"raw_data"`
  174. Message []*NameValueType `json:"message"`
  175. Hash hexutil.Bytes `json:"hash"`
  176. Meta Metadata `json:"meta"`
  177. }
  178. SignDataResponse struct {
  179. Approved bool `json:"approved"`
  180. Password string
  181. }
  182. NewAccountRequest struct {
  183. Meta Metadata `json:"meta"`
  184. }
  185. NewAccountResponse struct {
  186. Approved bool `json:"approved"`
  187. Password string `json:"password"`
  188. }
  189. ListRequest struct {
  190. Accounts []Account `json:"accounts"`
  191. Meta Metadata `json:"meta"`
  192. }
  193. ListResponse struct {
  194. Accounts []Account `json:"accounts"`
  195. }
  196. Message struct {
  197. Text string `json:"text"`
  198. }
  199. PasswordRequest struct {
  200. Prompt string `json:"prompt"`
  201. }
  202. PasswordResponse struct {
  203. Password string `json:"password"`
  204. }
  205. StartupInfo struct {
  206. Info map[string]interface{} `json:"info"`
  207. }
  208. UserInputRequest struct {
  209. Prompt string `json:"prompt"`
  210. Title string `json:"title"`
  211. IsPassword bool `json:"isPassword"`
  212. }
  213. UserInputResponse struct {
  214. Text string `json:"text"`
  215. }
  216. )
  217. var ErrRequestDenied = errors.New("Request denied")
  218. // NewSignerAPI creates a new API that can be used for Account management.
  219. // ksLocation specifies the directory where to store the password protected private
  220. // key that is generated when a new Account is created.
  221. // noUSB disables USB support that is required to support hardware devices such as
  222. // ledger and trezor.
  223. func NewSignerAPI(chainID int64, ksLocation string, noUSB bool, ui SignerUI, abidb *AbiDb, lightKDF bool, advancedMode bool) *SignerAPI {
  224. var (
  225. backends []accounts.Backend
  226. n, p = keystore.StandardScryptN, keystore.StandardScryptP
  227. )
  228. if lightKDF {
  229. n, p = keystore.LightScryptN, keystore.LightScryptP
  230. }
  231. // support password based accounts
  232. if len(ksLocation) > 0 {
  233. backends = append(backends, keystore.NewKeyStore(ksLocation, n, p))
  234. }
  235. if advancedMode {
  236. log.Info("Clef is in advanced mode: will warn instead of reject")
  237. }
  238. if !noUSB {
  239. // Start a USB hub for Ledger hardware wallets
  240. if ledgerhub, err := usbwallet.NewLedgerHub(); err != nil {
  241. log.Warn(fmt.Sprintf("Failed to start Ledger hub, disabling: %v", err))
  242. } else {
  243. backends = append(backends, ledgerhub)
  244. log.Debug("Ledger support enabled")
  245. }
  246. // Start a USB hub for Trezor hardware wallets
  247. if trezorhub, err := usbwallet.NewTrezorHub(); err != nil {
  248. log.Warn(fmt.Sprintf("Failed to start Trezor hub, disabling: %v", err))
  249. } else {
  250. backends = append(backends, trezorhub)
  251. log.Debug("Trezor support enabled")
  252. }
  253. }
  254. signer := &SignerAPI{big.NewInt(chainID), accounts.NewManager(backends...), ui, NewValidator(abidb), !advancedMode}
  255. if !noUSB {
  256. signer.startUSBListener()
  257. }
  258. return signer
  259. }
  260. func (api *SignerAPI) openTrezor(url accounts.URL) {
  261. resp, err := api.UI.OnInputRequired(UserInputRequest{
  262. Prompt: "Pin required to open Trezor wallet\n" +
  263. "Look at the device for number positions\n\n" +
  264. "7 | 8 | 9\n" +
  265. "--+---+--\n" +
  266. "4 | 5 | 6\n" +
  267. "--+---+--\n" +
  268. "1 | 2 | 3\n\n",
  269. IsPassword: true,
  270. Title: "Trezor unlock",
  271. })
  272. if err != nil {
  273. log.Warn("failed getting trezor pin", "err", err)
  274. return
  275. }
  276. // We're using the URL instead of the pointer to the
  277. // Wallet -- perhaps it is not actually present anymore
  278. w, err := api.am.Wallet(url.String())
  279. if err != nil {
  280. log.Warn("wallet unavailable", "url", url)
  281. return
  282. }
  283. err = w.Open(resp.Text)
  284. if err != nil {
  285. log.Warn("failed to open wallet", "wallet", url, "err", err)
  286. return
  287. }
  288. }
  289. // startUSBListener starts a listener for USB events, for hardware wallet interaction
  290. func (api *SignerAPI) startUSBListener() {
  291. events := make(chan accounts.WalletEvent, 16)
  292. am := api.am
  293. am.Subscribe(events)
  294. go func() {
  295. // Open any wallets already attached
  296. for _, wallet := range am.Wallets() {
  297. if err := wallet.Open(""); err != nil {
  298. log.Warn("Failed to open wallet", "url", wallet.URL(), "err", err)
  299. if err == usbwallet.ErrTrezorPINNeeded {
  300. go api.openTrezor(wallet.URL())
  301. }
  302. }
  303. }
  304. // Listen for wallet event till termination
  305. for event := range events {
  306. switch event.Kind {
  307. case accounts.WalletArrived:
  308. if err := event.Wallet.Open(""); err != nil {
  309. log.Warn("New wallet appeared, failed to open", "url", event.Wallet.URL(), "err", err)
  310. if err == usbwallet.ErrTrezorPINNeeded {
  311. go api.openTrezor(event.Wallet.URL())
  312. }
  313. }
  314. case accounts.WalletOpened:
  315. status, _ := event.Wallet.Status()
  316. log.Info("New wallet appeared", "url", event.Wallet.URL(), "status", status)
  317. derivationPath := accounts.DefaultBaseDerivationPath
  318. if event.Wallet.URL().Scheme == "ledger" {
  319. derivationPath = accounts.DefaultLedgerBaseDerivationPath
  320. }
  321. var nextPath = derivationPath
  322. // Derive first N accounts, hardcoded for now
  323. for i := 0; i < numberOfAccountsToDerive; i++ {
  324. acc, err := event.Wallet.Derive(nextPath, true)
  325. if err != nil {
  326. log.Warn("account derivation failed", "error", err)
  327. } else {
  328. log.Info("derived account", "address", acc.Address)
  329. }
  330. nextPath[len(nextPath)-1]++
  331. }
  332. case accounts.WalletDropped:
  333. log.Info("Old wallet dropped", "url", event.Wallet.URL())
  334. event.Wallet.Close()
  335. }
  336. }
  337. }()
  338. }
  339. // List returns the set of wallet this signer manages. Each wallet can contain
  340. // multiple accounts.
  341. func (api *SignerAPI) List(ctx context.Context) ([]common.Address, error) {
  342. var accs []Account
  343. for _, wallet := range api.am.Wallets() {
  344. for _, acc := range wallet.Accounts() {
  345. acc := Account{Typ: "Account", URL: wallet.URL(), Address: acc.Address}
  346. accs = append(accs, acc)
  347. }
  348. }
  349. result, err := api.UI.ApproveListing(&ListRequest{Accounts: accs, Meta: MetadataFromContext(ctx)})
  350. if err != nil {
  351. return nil, err
  352. }
  353. if result.Accounts == nil {
  354. return nil, ErrRequestDenied
  355. }
  356. addresses := make([]common.Address, 0)
  357. for _, acc := range result.Accounts {
  358. addresses = append(addresses, acc.Address)
  359. }
  360. return addresses, nil
  361. }
  362. // New creates a new password protected Account. The private key is protected with
  363. // the given password. Users are responsible to backup the private key that is stored
  364. // in the keystore location thas was specified when this API was created.
  365. func (api *SignerAPI) New(ctx context.Context) (accounts.Account, error) {
  366. be := api.am.Backends(keystore.KeyStoreType)
  367. if len(be) == 0 {
  368. return accounts.Account{}, errors.New("password based accounts not supported")
  369. }
  370. var (
  371. resp NewAccountResponse
  372. err error
  373. )
  374. // Three retries to get a valid password
  375. for i := 0; i < 3; i++ {
  376. resp, err = api.UI.ApproveNewAccount(&NewAccountRequest{MetadataFromContext(ctx)})
  377. if err != nil {
  378. return accounts.Account{}, err
  379. }
  380. if !resp.Approved {
  381. return accounts.Account{}, ErrRequestDenied
  382. }
  383. if pwErr := ValidatePasswordFormat(resp.Password); pwErr != nil {
  384. api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", (i + 1), pwErr))
  385. } else {
  386. // No error
  387. return be[0].(*keystore.KeyStore).NewAccount(resp.Password)
  388. }
  389. }
  390. // Otherwise fail, with generic error message
  391. return accounts.Account{}, errors.New("account creation failed")
  392. }
  393. // logDiff logs the difference between the incoming (original) transaction and the one returned from the signer.
  394. // it also returns 'true' if the transaction was modified, to make it possible to configure the signer not to allow
  395. // UI-modifications to requests
  396. func logDiff(original *SignTxRequest, new *SignTxResponse) bool {
  397. modified := false
  398. if f0, f1 := original.Transaction.From, new.Transaction.From; !reflect.DeepEqual(f0, f1) {
  399. log.Info("Sender-account changed by UI", "was", f0, "is", f1)
  400. modified = true
  401. }
  402. if t0, t1 := original.Transaction.To, new.Transaction.To; !reflect.DeepEqual(t0, t1) {
  403. log.Info("Recipient-account changed by UI", "was", t0, "is", t1)
  404. modified = true
  405. }
  406. if g0, g1 := original.Transaction.Gas, new.Transaction.Gas; g0 != g1 {
  407. modified = true
  408. log.Info("Gas changed by UI", "was", g0, "is", g1)
  409. }
  410. if g0, g1 := big.Int(original.Transaction.GasPrice), big.Int(new.Transaction.GasPrice); g0.Cmp(&g1) != 0 {
  411. modified = true
  412. log.Info("GasPrice changed by UI", "was", g0, "is", g1)
  413. }
  414. if v0, v1 := big.Int(original.Transaction.Value), big.Int(new.Transaction.Value); v0.Cmp(&v1) != 0 {
  415. modified = true
  416. log.Info("Value changed by UI", "was", v0, "is", v1)
  417. }
  418. if d0, d1 := original.Transaction.Data, new.Transaction.Data; d0 != d1 {
  419. d0s := ""
  420. d1s := ""
  421. if d0 != nil {
  422. d0s = hexutil.Encode(*d0)
  423. }
  424. if d1 != nil {
  425. d1s = hexutil.Encode(*d1)
  426. }
  427. if d1s != d0s {
  428. modified = true
  429. log.Info("Data changed by UI", "was", d0s, "is", d1s)
  430. }
  431. }
  432. if n0, n1 := original.Transaction.Nonce, new.Transaction.Nonce; n0 != n1 {
  433. modified = true
  434. log.Info("Nonce changed by UI", "was", n0, "is", n1)
  435. }
  436. return modified
  437. }
  438. // SignTransaction signs the given Transaction and returns it both as json and rlp-encoded form
  439. func (api *SignerAPI) SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error) {
  440. var (
  441. err error
  442. result SignTxResponse
  443. )
  444. msgs, err := api.validator.ValidateTransaction(&args, methodSelector)
  445. if err != nil {
  446. return nil, err
  447. }
  448. // If we are in 'rejectMode', then reject rather than show the user warnings
  449. if api.rejectMode {
  450. if err := msgs.getWarnings(); err != nil {
  451. return nil, err
  452. }
  453. }
  454. req := SignTxRequest{
  455. Transaction: args,
  456. Meta: MetadataFromContext(ctx),
  457. Callinfo: msgs.Messages,
  458. }
  459. // Process approval
  460. result, err = api.UI.ApproveTx(&req)
  461. if err != nil {
  462. return nil, err
  463. }
  464. if !result.Approved {
  465. return nil, ErrRequestDenied
  466. }
  467. // Log changes made by the UI to the signing-request
  468. logDiff(&req, &result)
  469. var (
  470. acc accounts.Account
  471. wallet accounts.Wallet
  472. )
  473. acc = accounts.Account{Address: result.Transaction.From.Address()}
  474. wallet, err = api.am.Find(acc)
  475. if err != nil {
  476. return nil, err
  477. }
  478. // Convert fields into a real transaction
  479. var unsignedTx = result.Transaction.toTransaction()
  480. // The one to sign is the one that was returned from the UI
  481. signedTx, err := wallet.SignTxWithPassphrase(acc, result.Password, unsignedTx, api.chainID)
  482. if err != nil {
  483. api.UI.ShowError(err.Error())
  484. return nil, err
  485. }
  486. rlpdata, err := rlp.EncodeToBytes(signedTx)
  487. response := ethapi.SignTransactionResult{Raw: rlpdata, Tx: signedTx}
  488. // Finally, send the signed tx to the UI
  489. api.UI.OnApprovedTx(response)
  490. // ...and to the external caller
  491. return &response, nil
  492. }
  493. // Export returns encrypted private key associated with the given address in web3 keystore format.
  494. func (api *SignerAPI) Export(ctx context.Context, addr common.Address) (json.RawMessage, error) {
  495. res, err := api.UI.ApproveExport(&ExportRequest{Address: addr, Meta: MetadataFromContext(ctx)})
  496. if err != nil {
  497. return nil, err
  498. }
  499. if !res.Approved {
  500. return nil, ErrRequestDenied
  501. }
  502. // Look up the wallet containing the requested signer
  503. wallet, err := api.am.Find(accounts.Account{Address: addr})
  504. if err != nil {
  505. return nil, err
  506. }
  507. if wallet.URL().Scheme != keystore.KeyStoreScheme {
  508. return nil, fmt.Errorf("Account is not a keystore-account")
  509. }
  510. return ioutil.ReadFile(wallet.URL().Path)
  511. }
  512. // Import tries to import the given keyJSON in the local keystore. The keyJSON data is expected to be
  513. // in web3 keystore format. It will decrypt the keyJSON with the given passphrase and on successful
  514. // decryption it will encrypt the key with the given newPassphrase and store it in the keystore.
  515. // OBS! This method is removed from the public API. It should not be exposed on the external API
  516. // for a couple of reasons:
  517. // 1. Even though it is encrypted, it should still be seen as sensitive data
  518. // 2. It can be used to DoS clef, by using malicious data with e.g. extreme large
  519. // values for the kdfparams.
  520. func (api *SignerAPI) Import(ctx context.Context, keyJSON json.RawMessage) (Account, error) {
  521. be := api.am.Backends(keystore.KeyStoreType)
  522. if len(be) == 0 {
  523. return Account{}, errors.New("password based accounts not supported")
  524. }
  525. res, err := api.UI.ApproveImport(&ImportRequest{Meta: MetadataFromContext(ctx)})
  526. if err != nil {
  527. return Account{}, err
  528. }
  529. if !res.Approved {
  530. return Account{}, ErrRequestDenied
  531. }
  532. acc, err := be[0].(*keystore.KeyStore).Import(keyJSON, res.OldPassword, res.NewPassword)
  533. if err != nil {
  534. api.UI.ShowError(err.Error())
  535. return Account{}, err
  536. }
  537. return Account{Typ: "Account", URL: acc.URL, Address: acc.Address}, nil
  538. }
  539. // Returns the external api version. This method does not require user acceptance. Available methods are
  540. // available via enumeration anyway, and this info does not contain user-specific data
  541. func (api *SignerAPI) Version(ctx context.Context) (string, error) {
  542. return ExternalAPIVersion, nil
  543. }