Last active
May 18, 2017 22:20
-
-
Save lastcanal/1653280c9f00f08a1ed19f0da86439dd to your computer and use it in GitHub Desktop.
TrezorConnect signTx example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function harden(n) { | |
return (n | 0x80000000) >>> 0 | |
} | |
var inputs = [ | |
{ | |
// m/44'/0'/1'/0/1 | |
// [2147483692, 2147483648, 2147483649, 0, 1] | |
"address_n": [ | |
harden(44), | |
harden(0), | |
harden(1), | |
0, | |
1 | |
], | |
"prev_index": 0, | |
"prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", | |
"script_type": "SPENDMULTISIG", | |
"multisig": { | |
"pubkeys": [ | |
{ | |
"node": "xpubZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", | |
"address_n": [] | |
}, | |
{ | |
"node": "xpubZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", | |
"address_n": [] | |
} | |
], | |
"signatures": [ | |
"", | |
"" | |
], | |
"m": 2 | |
} | |
} | |
] | |
var outputs = [ | |
{ | |
"address": "3ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", | |
"amount": 100000, | |
"script_type": "PAYTOSCRIPTHASH" | |
}, | |
{ | |
"address": "3ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", | |
"amount": 100000, | |
"script_type": "PAYTOSCRIPTHASH" | |
} | |
] | |
TrezorConnect.signTx(inputs, outputs, function(result) { | |
console.log(result) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment