Make process transaction able to sign transaction offline (without getting chain_id from node via get_config api call)
I've tested it with the following steps:
- Run testnet_node.py
clive process transfer --to "bob" --amount "1 HIVE" --no-broadcast --save-file trx_unsigned.json
cat trx_unsigned.json
{"ref_block_num": 174, "ref_block_prefix": 3871287508, "expiration": "2023-11-27T14:21:18", "extensions": [], "signatures": [], "operations": [{"type": "transfer_operation", "value": {"from": "alice", "to": "bob", "amount": {"amount": "1000", "precision": 3, "nai": "@@000000021"}, "memo": ""}}]}
-
clive configure node set --node-address http://not.existing:8090
-
clive show balances
Error, as expected
-
clive process transaction --from-file trx_unsigned.json --save-file trx_signed.json --sign alice_key --password alice --no-broadcast --chain-id 18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e
-
cat trx_signed.json
{"ref_block_num": 174, "ref_block_prefix": 3871287508, "expiration": "2023-11-27T14:21:18", "extensions": [], "signatures": ["1f25bccf058a954a4aa6f1109ee434e53a8276dbc0992778ca8a802ca1a19abfb4361b8801e832aa74a8a68fcd3766abc546727fba4154ec4c6b55366f2b01bd62"], "operations": [{"type": "transfer_operation", "value": {"from": "alice", "to": "bob", "amount": {"amount": "1000", "precision": 3, "nai": "@@000000021"}, "memo": ""}}]}
clive configure node set --node-address http://localhost:8090
clive process transaction --from-file trx_signed.json
Launching beekeeper...
Loaded transaction:
{
"ref_block_num": 174,
"ref_block_prefix": 3871287508,
"expiration": "2023-11-27T14:21:18",
"extensions": [],
"signatures": [
"1f25bccf058a954a4aa6f1109ee434e53a8276dbc0992778ca8a802ca1a19abfb4361b8801e832aa74a8a68fcd3766abc546727fba4154ec4c6b55366f2b01bd62"
],
"operations": [
{
"type": "transfer_operation",
"value": {
"from": "alice",
"to": "bob",
"amount": {
"amount": "1000",
"precision": 3,
"nai": "@@000000021"
},
"memo": ""
}
}
],
"transaction_id": "364010e774c77f97306eaeeae2e655cf3672c335"
}
Transaction was successfully broadcasted.
clive show balances
Actually shows balance reduced by 1 HIVE
Edited by Mateusz Żebrak