Is there any tooling for signing shielded transactions offline? Also, what’s the best way to do offline transactions in general (either t or z)? Thanks!
3 Likes
opened 02:24PM - 07 Jun 18 UTC
closed 11:57PM - 19 Sep 18 UTC
A-rpc-interface
NU0-overwinter
usi
### Describe the issue
There is an error when signing a transaction on an offli… ne node as described at https://bitcoin.org/en/developer-examples#offline-signing.
### Can you reliably reproduce the issue?
#### If so, please list the steps to reproduce below:
1. Setup an online node with the following zcash.conf. Continue once it's fully synced.
```
testnet=1
disablewallet=0
server=1
rpcuser=foo
rpcpassword=bar
rpcallowip=0.0.0.0/0
rpcallowip=::/0
rpcport=8762
printtoconsole=1
```
2. Make sure there is at least one UTXO and run the following commands to build an unsigned transaction. I included my results.
```shell
$ zcash-cli listunspent
[
{
"txid": "a4fca062739f85a98b56e985e930b1174a1eb52873b35d94ef754d779923dc3f",
"vout": 1,
"generated": false,
"address": "tmRTaMngZ81K44GyGpPjqajmdkB9NLWirj4",
"account": "",
"scriptPubKey": "76a914acb6a5f2de3f6859daddccda56c9903c1623b56d88ac",
"amount": 2.99900000,
"confirmations": 1,
"spendable": true
}
]
$ zcash-cli getaddressesbyaccount ""
[
"tmQHbuXodHL8mZtUsw8dYXxbcgS6PFo8rSd",
"tmRTaMngZ81K44GyGpPjqajmdkB9NLWirj4"
]
$ zcash-cli dumpprivkey tmRTaMngZ81K44GyGpPjqajmdkB9NLWirj4
cSXVP4HVBkW4cSoV2kv9F5jWz9gfRTwxJAW5gVA8uPGENyjz9CXU
$ zcash-cli createrawtransaction '[{"txid": "a4fca062739f85a98b56e985e930b1174a1eb52873b35d94ef754d779923dc3f", "vout": 1}]' '{"tmQHbuXodHL8mZtUsw8dYXxbcgS6PFo8rSd": "2.998"}'
030000807082c403013fdc2399774d75ef945db37328b51e4a17b130e985e9568ba9859f7362a0fca40100000000ffffffff01c095de11000000001976a9149fdba78a88de72be825a80fc6de4ad239a03851588ac0000000074ca030000
```
3. Switch to an offline node with the following zcash.conf. It doesn't have to be fully synced.
```
testnet=1
disablewallet=0
server=1
rpcuser=foo
rpcpassword=bar
rpcallowip=0.0.0.0/0
rpcallowip=::/0
rpcport=8762
printtoconsole=1
maxconnections=0
```
4. Sign the transaction from the 2nd step.
```shell
$ zcash-cli signrawtransaction 030000807082c403013fdc2399774d75ef945db37328b51e4a17b130e985e9568ba9859f7362a0fca40100000000ffffffff01c095de11000000001976a9149fdba78a88de72be825a80fc6de4ad239a03851588ac0000000074ca030000 '[{"txid": "a4fca062739f85a98b56e985e930b1174a1eb52873b35d94ef754d779923dc3f", "vout": 1, "scriptPubKey": "76a914acb6a5f2de3f6859daddccda56c9903c1623b56d88ac"}]' '["cSXVP4HVBkW4cSoV2kv9F5jWz9gfRTwxJAW5gVA8uPGENyjz9CXU"]'
{
"hex": "030000807082c403013fdc2399774d75ef945db37328b51e4a17b130e985e9568ba9859f7362a0fca4010000006b483045022100ba4a8a53511842c41bc7883733bbb66e1cf51377ef6b72bf89c5424601b47e0702206586793dd0ad460f3632de6894eeb2be77cd007ba9bf017fc7d0ecc39befba19012102674cafc2d1afba93a76398e045e1cca26a822618f6201725e7f7941539a1c8cbffffffff01c095de11000000001976a9149fdba78a88de72be825a80fc6de4ad239a03851588ac0000000074ca030000",
"complete": true
}
```
5. Switch back to the online node and send the transaction from the previous step.
```shell
$ zcash-cli sendrawtransaction 030000807082c403013fdc2399774d75ef945db37328b51e4a17b130e985e9568ba9859f7362a0fca4010000006b483045022100ba4a8a53511842c41bc7883733bbb66e1cf51377ef6b72bf89c5424601b47e0702206586793dd0ad460f3632de6894eeb2be77cd007ba9bf017fc7d0ecc39befba19012102674cafc2d1afba93a76398e045e1cca26a822618f6201725e7f7941539a1c8cbffffffff01c095de11000000001976a9149fdba78a88de72be825a80fc6de4ad239a03851588ac0000000074ca030000
error code: -26
error message:
16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)
```
### Expected behaviour
The transaction is successfully broadcasted. Its TXID is obtained.
### Actual behaviour + errors
`sendrawtransaction` fails with `mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)` error message. I performed the steps above with the latest Bitcoin Core (except it had addresstype=legacy in its conf file) and it worked.
### The version of Zcash you were using:
Zcash Daemon version v1.1.0-42e302523-dirty
### Machine specs:
- OS: Arch Linux, latest:
- CPU: Intel® Core™ i7-7700HQ CPU @ 2.80GHz × 8
- RAM: 15.5 GiB
- Disk size: 502.7 GB
- Disk Type (HD/SDD): SSD
- Linux kernel version (uname -a): Linux archlinux 4.16.13-1-ARCH #1 SMP PREEMPT Thu May 31 23:29:29 UTC 2018 x86_64 GNU/Linux
- Compiler version (gcc -version): gcc version 8.1.0 (GCC)
This person used createrawtranasction on a synced online node, signrawtransaction on a synced offline node then sendrawtransaction on the online node, the problem they had looks like they weren’t fully synced and perhaps that Zcashd maybe wasn’t really designed for that idk
1 Like
Thanks for the link. Looks like it’s reasonably possible with zcashd, at least for t-addresses. Is this process any different for z-addr transactions though?
Also, that thread is over 2 years old. I’m a little surprised no offline-tx specific tooling exists yet.
1 Like
The z address calls usually have a “z_” pre-appended
Yeah, but is the signing process exactly the same?
1 Like
Im not sure, it doesn’t specify permitted types (I’d try to help more but Im at work and not able at the moment)
daira
August 29, 2020, 10:32am
8
4 Likes