main.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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. // signer is a utility that can be used so sign transactions and
  17. // arbitrary data.
  18. package main
  19. import (
  20. "bufio"
  21. "context"
  22. "crypto/rand"
  23. "crypto/sha256"
  24. "encoding/hex"
  25. "encoding/json"
  26. "fmt"
  27. "io"
  28. "io/ioutil"
  29. "os"
  30. "os/signal"
  31. "os/user"
  32. "path/filepath"
  33. "runtime"
  34. "strings"
  35. "github.com/ethereum/go-ethereum/cmd/utils"
  36. "github.com/ethereum/go-ethereum/common"
  37. "github.com/ethereum/go-ethereum/crypto"
  38. "github.com/ethereum/go-ethereum/log"
  39. "github.com/ethereum/go-ethereum/node"
  40. "github.com/ethereum/go-ethereum/rpc"
  41. "github.com/ethereum/go-ethereum/signer/core"
  42. "github.com/ethereum/go-ethereum/signer/rules"
  43. "github.com/ethereum/go-ethereum/signer/storage"
  44. "gopkg.in/urfave/cli.v1"
  45. )
  46. // ExternalAPIVersion -- see extapi_changelog.md
  47. const ExternalAPIVersion = "2.0.0"
  48. // InternalAPIVersion -- see intapi_changelog.md
  49. const InternalAPIVersion = "2.0.0"
  50. const legalWarning = `
  51. WARNING!
  52. Clef is alpha software, and not yet publically released. This software has _not_ been audited, and there
  53. are no guarantees about the workings of this software. It may contain severe flaws. You should not use this software
  54. unless you agree to take full responsibility for doing so, and know what you are doing.
  55. TLDR; THIS IS NOT PRODUCTION-READY SOFTWARE!
  56. `
  57. var (
  58. logLevelFlag = cli.IntFlag{
  59. Name: "loglevel",
  60. Value: 4,
  61. Usage: "log level to emit to the screen",
  62. }
  63. keystoreFlag = cli.StringFlag{
  64. Name: "keystore",
  65. Value: filepath.Join(node.DefaultDataDir(), "keystore"),
  66. Usage: "Directory for the keystore",
  67. }
  68. configdirFlag = cli.StringFlag{
  69. Name: "configdir",
  70. Value: DefaultConfigDir(),
  71. Usage: "Directory for Clef configuration",
  72. }
  73. rpcPortFlag = cli.IntFlag{
  74. Name: "rpcport",
  75. Usage: "HTTP-RPC server listening port",
  76. Value: node.DefaultHTTPPort + 5,
  77. }
  78. signerSecretFlag = cli.StringFlag{
  79. Name: "signersecret",
  80. Usage: "A file containing the password used to encrypt Clef credentials, e.g. keystore credentials and ruleset hash",
  81. }
  82. dBFlag = cli.StringFlag{
  83. Name: "4bytedb",
  84. Usage: "File containing 4byte-identifiers",
  85. Value: "./4byte.json",
  86. }
  87. customDBFlag = cli.StringFlag{
  88. Name: "4bytedb-custom",
  89. Usage: "File used for writing new 4byte-identifiers submitted via API",
  90. Value: "./4byte-custom.json",
  91. }
  92. auditLogFlag = cli.StringFlag{
  93. Name: "auditlog",
  94. Usage: "File used to emit audit logs. Set to \"\" to disable",
  95. Value: "audit.log",
  96. }
  97. ruleFlag = cli.StringFlag{
  98. Name: "rules",
  99. Usage: "Enable rule-engine",
  100. Value: "rules.json",
  101. }
  102. stdiouiFlag = cli.BoolFlag{
  103. Name: "stdio-ui",
  104. Usage: "Use STDIN/STDOUT as a channel for an external UI. " +
  105. "This means that an STDIN/STDOUT is used for RPC-communication with a e.g. a graphical user " +
  106. "interface, and can be used when Clef is started by an external process.",
  107. }
  108. testFlag = cli.BoolFlag{
  109. Name: "stdio-ui-test",
  110. Usage: "Mechanism to test interface between Clef and UI. Requires 'stdio-ui'.",
  111. }
  112. app = cli.NewApp()
  113. initCommand = cli.Command{
  114. Action: utils.MigrateFlags(initializeSecrets),
  115. Name: "init",
  116. Usage: "Initialize the signer, generate secret storage",
  117. ArgsUsage: "",
  118. Flags: []cli.Flag{
  119. logLevelFlag,
  120. configdirFlag,
  121. },
  122. Description: `
  123. The init command generates a master seed which Clef can use to store credentials and data needed for
  124. the rule-engine to work.`,
  125. }
  126. attestCommand = cli.Command{
  127. Action: utils.MigrateFlags(attestFile),
  128. Name: "attest",
  129. Usage: "Attest that a js-file is to be used",
  130. ArgsUsage: "<sha256sum>",
  131. Flags: []cli.Flag{
  132. logLevelFlag,
  133. configdirFlag,
  134. signerSecretFlag,
  135. },
  136. Description: `
  137. The attest command stores the sha256 of the rule.js-file that you want to use for automatic processing of
  138. incoming requests.
  139. Whenever you make an edit to the rule file, you need to use attestation to tell
  140. Clef that the file is 'safe' to execute.`,
  141. }
  142. addCredentialCommand = cli.Command{
  143. Action: utils.MigrateFlags(addCredential),
  144. Name: "addpw",
  145. Usage: "Store a credential for a keystore file",
  146. ArgsUsage: "<address> <password>",
  147. Flags: []cli.Flag{
  148. logLevelFlag,
  149. configdirFlag,
  150. signerSecretFlag,
  151. },
  152. Description: `
  153. The addpw command stores a password for a given address (keyfile). If you invoke it with only one parameter, it will
  154. remove any stored credential for that address (keyfile)
  155. `,
  156. }
  157. )
  158. func init() {
  159. app.Name = "Clef"
  160. app.Usage = "Manage Ethereum account operations"
  161. app.Flags = []cli.Flag{
  162. logLevelFlag,
  163. keystoreFlag,
  164. configdirFlag,
  165. utils.NetworkIdFlag,
  166. utils.LightKDFFlag,
  167. utils.NoUSBFlag,
  168. utils.RPCListenAddrFlag,
  169. utils.RPCVirtualHostsFlag,
  170. utils.IPCDisabledFlag,
  171. utils.IPCPathFlag,
  172. utils.RPCEnabledFlag,
  173. rpcPortFlag,
  174. signerSecretFlag,
  175. dBFlag,
  176. customDBFlag,
  177. auditLogFlag,
  178. ruleFlag,
  179. stdiouiFlag,
  180. testFlag,
  181. }
  182. app.Action = signer
  183. app.Commands = []cli.Command{initCommand, attestCommand, addCredentialCommand}
  184. }
  185. func main() {
  186. if err := app.Run(os.Args); err != nil {
  187. fmt.Fprintln(os.Stderr, err)
  188. os.Exit(1)
  189. }
  190. }
  191. func initializeSecrets(c *cli.Context) error {
  192. if err := initialize(c); err != nil {
  193. return err
  194. }
  195. configDir := c.String(configdirFlag.Name)
  196. masterSeed := make([]byte, 256)
  197. n, err := io.ReadFull(rand.Reader, masterSeed)
  198. if err != nil {
  199. return err
  200. }
  201. if n != len(masterSeed) {
  202. return fmt.Errorf("failed to read enough random")
  203. }
  204. err = os.Mkdir(configDir, 0700)
  205. if err != nil && !os.IsExist(err) {
  206. return err
  207. }
  208. location := filepath.Join(configDir, "secrets.dat")
  209. if _, err := os.Stat(location); err == nil {
  210. return fmt.Errorf("file %v already exists, will not overwrite", location)
  211. }
  212. err = ioutil.WriteFile(location, masterSeed, 0700)
  213. if err != nil {
  214. return err
  215. }
  216. fmt.Printf("A master seed has been generated into %s\n", location)
  217. fmt.Printf(`
  218. This is required to be able to store credentials, such as :
  219. * Passwords for keystores (used by rule engine)
  220. * Storage for javascript rules
  221. * Hash of rule-file
  222. You should treat that file with utmost secrecy, and make a backup of it.
  223. NOTE: This file does not contain your accounts. Those need to be backed up separately!
  224. `)
  225. return nil
  226. }
  227. func attestFile(ctx *cli.Context) error {
  228. if len(ctx.Args()) < 1 {
  229. utils.Fatalf("This command requires an argument.")
  230. }
  231. if err := initialize(ctx); err != nil {
  232. return err
  233. }
  234. stretchedKey, err := readMasterKey(ctx)
  235. if err != nil {
  236. utils.Fatalf(err.Error())
  237. }
  238. configDir := ctx.String(configdirFlag.Name)
  239. vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10]))
  240. confKey := crypto.Keccak256([]byte("config"), stretchedKey)
  241. // Initialize the encrypted storages
  242. configStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "config.json"), confKey)
  243. val := ctx.Args().First()
  244. configStorage.Put("ruleset_sha256", val)
  245. log.Info("Ruleset attestation updated", "sha256", val)
  246. return nil
  247. }
  248. func addCredential(ctx *cli.Context) error {
  249. if len(ctx.Args()) < 1 {
  250. utils.Fatalf("This command requires at leaste one argument.")
  251. }
  252. if err := initialize(ctx); err != nil {
  253. return err
  254. }
  255. stretchedKey, err := readMasterKey(ctx)
  256. if err != nil {
  257. utils.Fatalf(err.Error())
  258. }
  259. configDir := ctx.String(configdirFlag.Name)
  260. vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10]))
  261. pwkey := crypto.Keccak256([]byte("credentials"), stretchedKey)
  262. // Initialize the encrypted storages
  263. pwStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "credentials.json"), pwkey)
  264. key := ctx.Args().First()
  265. value := ""
  266. if len(ctx.Args()) > 1 {
  267. value = ctx.Args().Get(1)
  268. }
  269. pwStorage.Put(key, value)
  270. log.Info("Credential store updated", "key", key)
  271. return nil
  272. }
  273. func initialize(c *cli.Context) error {
  274. // Set up the logger to print everything
  275. logOutput := os.Stdout
  276. if c.Bool(stdiouiFlag.Name) {
  277. logOutput = os.Stderr
  278. // If using the stdioui, we can't do the 'confirm'-flow
  279. fmt.Fprintf(logOutput, legalWarning)
  280. } else {
  281. if !confirm(legalWarning) {
  282. return fmt.Errorf("aborted by user")
  283. }
  284. }
  285. log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int(logLevelFlag.Name)), log.StreamHandler(logOutput, log.TerminalFormat(true))))
  286. return nil
  287. }
  288. func signer(c *cli.Context) error {
  289. if err := initialize(c); err != nil {
  290. return err
  291. }
  292. var (
  293. ui core.SignerUI
  294. )
  295. if c.Bool(stdiouiFlag.Name) {
  296. log.Info("Using stdin/stdout as UI-channel")
  297. ui = core.NewStdIOUI()
  298. } else {
  299. log.Info("Using CLI as UI-channel")
  300. ui = core.NewCommandlineUI()
  301. }
  302. db, err := core.NewAbiDBFromFiles(c.String(dBFlag.Name), c.String(customDBFlag.Name))
  303. if err != nil {
  304. utils.Fatalf(err.Error())
  305. }
  306. log.Info("Loaded 4byte db", "signatures", db.Size(), "file", c.String("4bytedb"))
  307. var (
  308. api core.ExternalAPI
  309. )
  310. configDir := c.String(configdirFlag.Name)
  311. if stretchedKey, err := readMasterKey(c); err != nil {
  312. log.Info("No master seed provided, rules disabled")
  313. } else {
  314. if err != nil {
  315. utils.Fatalf(err.Error())
  316. }
  317. vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10]))
  318. // Generate domain specific keys
  319. pwkey := crypto.Keccak256([]byte("credentials"), stretchedKey)
  320. jskey := crypto.Keccak256([]byte("jsstorage"), stretchedKey)
  321. confkey := crypto.Keccak256([]byte("config"), stretchedKey)
  322. // Initialize the encrypted storages
  323. pwStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "credentials.json"), pwkey)
  324. jsStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "jsstorage.json"), jskey)
  325. configStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "config.json"), confkey)
  326. //Do we have a rule-file?
  327. ruleJS, err := ioutil.ReadFile(c.String(ruleFlag.Name))
  328. if err != nil {
  329. log.Info("Could not load rulefile, rules not enabled", "file", "rulefile")
  330. } else {
  331. hasher := sha256.New()
  332. hasher.Write(ruleJS)
  333. shasum := hasher.Sum(nil)
  334. storedShasum := configStorage.Get("ruleset_sha256")
  335. if storedShasum != hex.EncodeToString(shasum) {
  336. log.Info("Could not validate ruleset hash, rules not enabled", "got", hex.EncodeToString(shasum), "expected", storedShasum)
  337. } else {
  338. // Initialize rules
  339. ruleEngine, err := rules.NewRuleEvaluator(ui, jsStorage, pwStorage)
  340. if err != nil {
  341. utils.Fatalf(err.Error())
  342. }
  343. ruleEngine.Init(string(ruleJS))
  344. ui = ruleEngine
  345. log.Info("Rule engine configured", "file", c.String(ruleFlag.Name))
  346. }
  347. }
  348. }
  349. apiImpl := core.NewSignerAPI(
  350. c.Int64(utils.NetworkIdFlag.Name),
  351. c.String(keystoreFlag.Name),
  352. c.Bool(utils.NoUSBFlag.Name),
  353. ui, db,
  354. c.Bool(utils.LightKDFFlag.Name))
  355. api = apiImpl
  356. // Audit logging
  357. if logfile := c.String(auditLogFlag.Name); logfile != "" {
  358. api, err = core.NewAuditLogger(logfile, api)
  359. if err != nil {
  360. utils.Fatalf(err.Error())
  361. }
  362. log.Info("Audit logs configured", "file", logfile)
  363. }
  364. // register signer API with server
  365. var (
  366. extapiURL = "n/a"
  367. ipcapiURL = "n/a"
  368. )
  369. rpcAPI := []rpc.API{
  370. {
  371. Namespace: "account",
  372. Public: true,
  373. Service: api,
  374. Version: "1.0"},
  375. }
  376. if c.Bool(utils.RPCEnabledFlag.Name) {
  377. vhosts := splitAndTrim(c.GlobalString(utils.RPCVirtualHostsFlag.Name))
  378. cors := splitAndTrim(c.GlobalString(utils.RPCCORSDomainFlag.Name))
  379. // start http server
  380. httpEndpoint := fmt.Sprintf("%s:%d", c.String(utils.RPCListenAddrFlag.Name), c.Int(rpcPortFlag.Name))
  381. listener, _, err := rpc.StartHTTPEndpoint(httpEndpoint, rpcAPI, []string{"account"}, cors, vhosts)
  382. if err != nil {
  383. utils.Fatalf("Could not start RPC api: %v", err)
  384. }
  385. extapiURL = fmt.Sprintf("http://%s", httpEndpoint)
  386. log.Info("HTTP endpoint opened", "url", extapiURL)
  387. defer func() {
  388. listener.Close()
  389. log.Info("HTTP endpoint closed", "url", httpEndpoint)
  390. }()
  391. }
  392. if !c.Bool(utils.IPCDisabledFlag.Name) {
  393. if c.IsSet(utils.IPCPathFlag.Name) {
  394. ipcapiURL = c.String(utils.IPCPathFlag.Name)
  395. } else {
  396. ipcapiURL = filepath.Join(configDir, "clef.ipc")
  397. }
  398. listener, _, err := rpc.StartIPCEndpoint(ipcapiURL, rpcAPI)
  399. if err != nil {
  400. utils.Fatalf("Could not start IPC api: %v", err)
  401. }
  402. log.Info("IPC endpoint opened", "url", ipcapiURL)
  403. defer func() {
  404. listener.Close()
  405. log.Info("IPC endpoint closed", "url", ipcapiURL)
  406. }()
  407. }
  408. if c.Bool(testFlag.Name) {
  409. log.Info("Performing UI test")
  410. go testExternalUI(apiImpl)
  411. }
  412. ui.OnSignerStartup(core.StartupInfo{
  413. Info: map[string]interface{}{
  414. "extapi_version": ExternalAPIVersion,
  415. "intapi_version": InternalAPIVersion,
  416. "extapi_http": extapiURL,
  417. "extapi_ipc": ipcapiURL,
  418. },
  419. })
  420. abortChan := make(chan os.Signal)
  421. signal.Notify(abortChan, os.Interrupt)
  422. sig := <-abortChan
  423. log.Info("Exiting...", "signal", sig)
  424. return nil
  425. }
  426. // splitAndTrim splits input separated by a comma
  427. // and trims excessive white space from the substrings.
  428. func splitAndTrim(input string) []string {
  429. result := strings.Split(input, ",")
  430. for i, r := range result {
  431. result[i] = strings.TrimSpace(r)
  432. }
  433. return result
  434. }
  435. // DefaultConfigDir is the default config directory to use for the vaults and other
  436. // persistence requirements.
  437. func DefaultConfigDir() string {
  438. // Try to place the data folder in the user's home dir
  439. home := homeDir()
  440. if home != "" {
  441. if runtime.GOOS == "darwin" {
  442. return filepath.Join(home, "Library", "Signer")
  443. } else if runtime.GOOS == "windows" {
  444. return filepath.Join(home, "AppData", "Roaming", "Signer")
  445. } else {
  446. return filepath.Join(home, ".clef")
  447. }
  448. }
  449. // As we cannot guess a stable location, return empty and handle later
  450. return ""
  451. }
  452. func homeDir() string {
  453. if home := os.Getenv("HOME"); home != "" {
  454. return home
  455. }
  456. if usr, err := user.Current(); err == nil {
  457. return usr.HomeDir
  458. }
  459. return ""
  460. }
  461. func readMasterKey(ctx *cli.Context) ([]byte, error) {
  462. var (
  463. file string
  464. configDir = ctx.String(configdirFlag.Name)
  465. )
  466. if ctx.IsSet(signerSecretFlag.Name) {
  467. file = ctx.String(signerSecretFlag.Name)
  468. } else {
  469. file = filepath.Join(configDir, "secrets.dat")
  470. }
  471. if err := checkFile(file); err != nil {
  472. return nil, err
  473. }
  474. masterKey, err := ioutil.ReadFile(file)
  475. if err != nil {
  476. return nil, err
  477. }
  478. if len(masterKey) < 256 {
  479. return nil, fmt.Errorf("master key of insufficient length, expected >255 bytes, got %d", len(masterKey))
  480. }
  481. // Create vault location
  482. vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), masterKey)[:10]))
  483. err = os.Mkdir(vaultLocation, 0700)
  484. if err != nil && !os.IsExist(err) {
  485. return nil, err
  486. }
  487. //!TODO, use KDF to stretch the master key
  488. // stretched_key := stretch_key(master_key)
  489. return masterKey, nil
  490. }
  491. // checkFile is a convenience function to check if a file
  492. // * exists
  493. // * is mode 0600
  494. func checkFile(filename string) error {
  495. info, err := os.Stat(filename)
  496. if err != nil {
  497. return fmt.Errorf("failed stat on %s: %v", filename, err)
  498. }
  499. // Check the unix permission bits
  500. if info.Mode().Perm()&077 != 0 {
  501. return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
  502. }
  503. return nil
  504. }
  505. // confirm displays a text and asks for user confirmation
  506. func confirm(text string) bool {
  507. fmt.Printf(text)
  508. fmt.Printf("\nEnter 'ok' to proceed:\n>")
  509. text, err := bufio.NewReader(os.Stdin).ReadString('\n')
  510. if err != nil {
  511. log.Crit("Failed to read user input", "err", err)
  512. }
  513. if text := strings.TrimSpace(text); text == "ok" {
  514. return true
  515. }
  516. return false
  517. }
  518. func testExternalUI(api *core.SignerAPI) {
  519. ctx := context.WithValue(context.Background(), "remote", "clef binary")
  520. ctx = context.WithValue(ctx, "scheme", "in-proc")
  521. ctx = context.WithValue(ctx, "local", "main")
  522. errs := make([]string, 0)
  523. api.UI.ShowInfo("Testing 'ShowInfo'")
  524. api.UI.ShowError("Testing 'ShowError'")
  525. checkErr := func(method string, err error) {
  526. if err != nil && err != core.ErrRequestDenied {
  527. errs = append(errs, fmt.Sprintf("%v: %v", method, err.Error()))
  528. }
  529. }
  530. var err error
  531. _, err = api.SignTransaction(ctx, core.SendTxArgs{From: common.MixedcaseAddress{}}, nil)
  532. checkErr("SignTransaction", err)
  533. _, err = api.Sign(ctx, common.MixedcaseAddress{}, common.Hex2Bytes("01020304"))
  534. checkErr("Sign", err)
  535. _, err = api.List(ctx)
  536. checkErr("List", err)
  537. _, err = api.New(ctx)
  538. checkErr("New", err)
  539. _, err = api.Export(ctx, common.Address{})
  540. checkErr("Export", err)
  541. _, err = api.Import(ctx, json.RawMessage{})
  542. checkErr("Import", err)
  543. api.UI.ShowInfo("Tests completed")
  544. if len(errs) > 0 {
  545. log.Error("Got errors")
  546. for _, e := range errs {
  547. log.Error(e)
  548. }
  549. } else {
  550. log.Info("No errors")
  551. }
  552. }
  553. /**
  554. //Create Account
  555. curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_new","params":["test"],"id":67}' localhost:8550
  556. // List accounts
  557. curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_list","params":[""],"id":67}' http://localhost:8550/
  558. // Make Transaction
  559. // safeSend(0x12)
  560. // 4401a6e40000000000000000000000000000000000000000000000000000000000000012
  561. // supplied abi
  562. curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x82A2A876D39022B3019932D30Cd9c97ad5616813","gas":"0x333","gasPrice":"0x123","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x10", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"},"test"],"id":67}' http://localhost:8550/
  563. // Not supplied
  564. curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x82A2A876D39022B3019932D30Cd9c97ad5616813","gas":"0x333","gasPrice":"0x123","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x10", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"}],"id":67}' http://localhost:8550/
  565. // Sign data
  566. curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_sign","params":["0x694267f14675d7e1b9494fd8d72fefe1755710fa","bazonk gaz baz"],"id":67}' http://localhost:8550/
  567. **/