Offline Signature

Offline Signature is only supported on [cli_wallet].
Run with the websocker server of [cli_wallet].

1. Setting

Drive two [cli_wallets] with a websocket server. One is linked to the RPC port of the blockchain and the other runs offline.

$ ./cli_wallet -s ws://127.0.0.1:7002 -r 0.0.0.0:11222 -d
Logging RPC to file: logs/rpc/rpc.log
Wallet is online mode
2078356ms th_a       main.cpp:178                  startOnlineWallet    ] wdata.ws_server: ws://127.0.0.1:7002
2078357ms th_a       main.cpp:183                  startOnlineWallet    ] wdata.ws_user:  wdata.ws_password:
2078357ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":1,"result":true}
2078358ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":2,"result":0}
2078358ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":3,"result":3}
2078358ms th_a       main.cpp:226                  startOnlineWallet    ] Listening for incoming RPC requests on 0.0.0.0:11222
2078358ms th_a       main.cpp:290                  startOnlineWallet    ] Entering Daemon Mode, ^C to exit
$ ./cli_wallet -s local -r 0.0.0.0:11223 -d
Logging RPC to file: logs/rpc/rpc.log
Wallet is local mode
2064583ms th_a       main.cpp:103                  startLocalWallet     ] Listening for incoming RPC requests on 0.0.0.0:11223
2064583ms th_a       main.cpp:167                  startLocalWallet     ] Entering Daemon Mode, ^C to exit

2. Create an offline wallet.

In the offline [cli_wallet], [suggest_brain_key ],is imported 4 times, and a wrallet is generated in the online [cli_wallet] with a public key.

> {"jsonrpc": "2.0", "method": "suggest_brain_key", "params": [], "id":1 }
< {
  "id": 1,
  "result": {
    "brain_priv_key": "PENCEL GAFF WAYBILL PA SHAMMY DOWNWAY SHIES KUAN PEPLUS CARVER VEINLET VULN SYENITE HISS SQUAIL SEMITAE",
    "wif_priv_key": "5K7vBVpHcXRbkSwGdDGfLJ1skDvUj6LmjCop7PRp1RXtXNFdxP5",
    "pub_key": "ADC5KCx7eZTgzhp3gs21dmYy2UkGxUZsfbrXoaT7yfDMAGAQ9Ja1P"
  }
}

> {"jsonrpc": "2.0", "method": "suggest_brain_key", "params": [], "id":1 }
< {
  "id": 1,
  "result": {
    "brain_priv_key": "PANTAS SOAM PAPOOSE THECA TACIT CRINGLE DREEP OUTPOLL BROCKET YOUZE PLUMOUS SOCKEYE PUGMAN WORRIED KIMNEL BOMBER",
    "wif_priv_key": "5KCQGVctXY4YwNkAK2jPKL2aMRLHvUVyDEqYpJgAskbRZsDurFB",
    "pub_key": "ADC8bYu4bspwyrEQenUGGdhxfqhH4hWKtJTt8oh9pPsPtheYTr3zv"
  }
}

> {"jsonrpc": "2.0", "method": "suggest_brain_key", "params": [], "id":1 }
< {
  "id": 1,
  "result": {
    "brain_priv_key": "MINIUM ROW DIPETTO BUAL SLOUCH SATRAPY SAMADH POESY TUARN LEDGED GLUEY DISTALE CARABID SYRUPED BENDED DESYL",
    "wif_priv_key": "5KNWsCjns1YhTHpEpiqfn4agKhTKBHQdv4oyzULWfbZDbsUKPk5",
    "pub_key": "ADC5fnKi2NJDnW3HTWEF6cWN4zA4nFb197dDx3A5tcBguwTXmjRSD"
  }
}

> {"jsonrpc": "2.0", "method": "suggest_brain_key", "params": [], "id":1 }
< {
  "id": 1,
  "result": {
    "brain_priv_key": "KOLLAST WHIPSAW VISCOSE KHOKA DIPLEX TOADY FIRCA BENMOST BALLI MOPE PUFFERY UNDEWY SKIPPER BILOBED ICICLE SPICANT",
    "wif_priv_key": "5J5gDai1DUyPC9ygRW7eyhBT3h6w16WLgRVcuiSWDfM5XkUM56x",
    "pub_key": "ADC7uTvZy58V4iWEFku8tnuaCBapRzFzgxVmjaLCZCbEtWys1Tuf4"
  }
}
> {"jsonrpc": "2.0", "method": "import_key", "params": ["5K7vBVpHcXRbkSwGdDGfLJ1skDvUj6LmjCop7PRp1RXtXNFdxP5"], "id":1 }
< {"id":1,"result":true}

> {"jsonrpc": "2.0", "method": "import_key", "params": ["5KCQGVctXY4YwNkAK2jPKL2aMRLHvUVyDEqYpJgAskbRZsDurFB"], "id":1 }
< {"id":1,"result":true}

> {"jsonrpc": "2.0", "method": "import_key", "params": ["5KNWsCjns1YhTHpEpiqfn4agKhTKBHQdv4oyzULWfbZDbsUKPk5"], "id":1 }
< {"id":1,"result":true}

> {"jsonrpc": "2.0", "method": "import_key", "params": ["5J5gDai1DUyPC9ygRW7eyhBT3h6w16WLgRVcuiSWDfM5XkUM56x"], "id":1 }
< {"id":1,"result":true}
> {"jsonrpc": "2.0", "method": "create_account_with_keys",
    "params": ["adcaccount", "test012", "", "ADC5KCx7eZTgzhp3gs21dmYy2UkGxUZsfbrXoaT7yfDMAGAQ9Ja1P",
                                            "ADC8bYu4bspwyrEQenUGGdhxfqhH4hWKtJTt8oh9pPsPtheYTr3zv",
                                            "ADC5fnKi2NJDnW3HTWEF6cWN4zA4nFb197dDx3A5tcBguwTXmjRSD",
                                            "ADC7uTvZy58V4iWEFku8tnuaCBapRzFzgxVmjaLCZCbEtWys1Tuf4", true], "id":1 }
< {
  "id": 1,
  "result": {
    "ref_block_num": 62974,
    "ref_block_prefix": 2408068821,
    "expiration": "2021-11-18T06:51:30",
    "operations": [
      [
        "account_create",
        {
          "creator": "adcaccount",
          "new_account_name": "test012",
          "owner": {
            "weight_threshold": 1,
            "account_auths": [

            ],
            "key_auths": [
              [
                "ADC5KCx7eZTgzhp3gs21dmYy2UkGxUZsfbrXoaT7yfDMAGAQ9Ja1P",
                1
              ]
            ]
          },
          "active": {
            "weight_threshold": 1,
            "account_auths": [

            ],
            "key_auths": [
              [
                "ADC8bYu4bspwyrEQenUGGdhxfqhH4hWKtJTt8oh9pPsPtheYTr3zv",
                1
              ]
            ]
          },
          "posting": {
            "weight_threshold": 1,
            "account_auths": [

            ],
            "key_auths": [
              [
                "ADC5fnKi2NJDnW3HTWEF6cWN4zA4nFb197dDx3A5tcBguwTXmjRSD",
                1
              ]
            ]
          },
          "memo_key": "ADC7uTvZy58V4iWEFku8tnuaCBapRzFzgxVmjaLCZCbEtWys1Tuf4",
          "json_metadata": ""
        }
      ]
    ],
    "extensions": [

    ],
    "signatures": [
      "1f3829607a1cad584c2781a59e4d92e2f7d504d616193e7207b07a2cc86a6a0fd56ea6036b6b6724742547771a4427a7465699587aab39f72f4c3d3e7056dd063e"
    ],
    "transaction_id": "39e1e03dfab6b324e822e382590e786ca269e711",
    "block_num": 1439231,
    "transaction_num": 0
  }
}

3. Create Transfer Transaction

Create transfer transaction in the online server.

> {"jsonrpc": "2.0", "method": "transfer_offline", "params": ["test012","test1","1.000000 ADC" "memo"], "id":1 }
< {
  "id": 1,
  "result": {
    "ref_block_num": 63441,
    "ref_block_prefix": 930511411,
    "expiration": "2021-11-18T07:14:51",
    "operations": [
      [
        "transfer",
        {
          "from": "test012",
          "to": "test1",
          "amount": "1.000000 ADC",
          "memo": "memo"
        }
      ]
    ],
    "extensions": [

    ],
    "signatures": [

    ],
    "pkeys": [
      "ADC8bYu4bspwyrEQenUGGdhxfqhH4hWKtJTt8oh9pPsPtheYTr3zv"
    ]
  }
}

4. Offline Signature

Create a signature by putting the result data returned from #3 above into the offline server as it is.

> {
  "jsonrpc": "2.0",
  "method": "sign_offline_transaction",
  "params": [
    {
      "ref_block_num": 63511,
      "ref_block_prefix": 3927359701,
      "expiration": "2021-11-18T07:18:21",
      "operations": [
        [
          "transfer",
          {
            "from": "test012",
            "to": "test1",
            "amount": "1.000000 ADC",
            "memo": "memo"
          }
        ]
      ],
      "extensions": [

      ],
      "signatures": [

      ],
      "pkeys": [
        "ADC8bYu4bspwyrEQenUGGdhxfqhH4hWKtJTt8oh9pPsPtheYTr3zv"
      ]
    }
  ],
  "id": 1
}

< {
  "id": 1,
  "result": {
    "ref_block_num": 63511,
    "ref_block_prefix": 3927359701,
    "expiration": "2021-11-18T07:18:21",
    "operations": [
      [
        "transfer",
        {
          "from": "test012",
          "to": "test1",
          "amount": "1.000000 ADC",
          "memo": "memo"
        }
      ]
    ],
    "extensions": [

    ],
    "signatures": [
      "1f1862f68f70a175aadd56c8f358b3201e110853f0ef779d8d73e1a74727707c5679b8d322041a283764c75aeace56f98efc1040e9847c9de61a2c99ffa260b72c"
    ]
  }
}

5. Push Transaction

Send the result data returned from #4 above to the online server as it is.
Since the validity time is set to 30 seconds, block mounting fails after 30 seconds of creating Transaction.

>{
  "jsonrpc": "2.0",
  "method": "push_transaction",
    "params": [
    {
      "ref_block_num": 63781,
      "ref_block_prefix": 2242585533,
      "expiration": "2021-11-18T07:31:51",
      "operations": [
        [
          "transfer",
          {
            "from": "test012",
            "to": "test1",
            "amount": "1.000000 ADC",
            "memo": "memo"
          }
        ]
      ],
      "extensions": [

      ],
      "signatures": [
        "205c07da121c2e683376e255e9c8df335858dd92216a5bd2ab7c9bf312d16325047f68dc1d68b0122d2528aabfdcc553ebb51f8e94e766bb35055a83d2d2591246"
      ]
    }
,
    true
  ],
  "id": 1
}

<{
  "id": 1,
  "result": {
    "ref_block_num": 63781,
    "ref_block_prefix": 2242585533,
    "expiration": "2021-11-18T07:31:51",
    "operations": [
      [
        "transfer",
        {
          "from": "test012",
          "to": "test1",
          "amount": "1.000000 ADC",
          "memo": "memo"
        }
      ]
    ],
    "extensions": [

    ],
    "signatures": [
      "205c07da121c2e683376e255e9c8df335858dd92216a5bd2ab7c9bf312d16325047f68dc1d68b0122d2528aabfdcc553ebb51f8e94e766bb35055a83d2d2591246"
    ],
    "transaction_id": "1ebd44a68a262f1c386634f4736892ac872b0c34",
    "block_num": 1440045,
    "transaction_num": 0
  }
}

©2021 ADC. All rights reserved.

Close

Create Post

Close

Edit Post

Close

Post Password

Please enter the password
you entered when writing the post to edit the post.

Close

Post Password

Please enter the password
you entered when creating the post to delete the post.

Close

Please enter a nickname.

Your post has been completed.