Author: Alan Reiner
Contact: [email protected]
Status: Draft
Orig Date: 28 Oct, 2011
===== | |
Finding all non-std tx | |
===== | |
Attempting to interpret script: | |
Block: 13139 Tx: 0 | |
ThisOut: fb73d48b12d03053a03f5c01f18befcf7c8726532b274f4b8810eb169fcf4ddb, 0 | |
Raw Script: 4704000a0342000443d955e20dac59a23ed7beea83a96667576853f6650a98e7afb11646c7d6599bd45946a3b4296aa2c6c04a78d2baf685d4a1fdd2729d2e90c1d1db1195adbd17ac | |
Raw Tx: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff070428f21d1c010affffffff0100f2052a01000000494704000a0342000443d955e20dac59a23ed7beea83a96667576853f6650a98e7afb11646c7d6599bd45946a3b4296aa2c6c04a78d2baf685d4a1fdd2729d2e90c1d1db1195adbd17ac00000000 | |
pprint: |
from pybtcengine import * | |
# Create new private key and get its address information | |
print 'Creating new address:' | |
newAddr = PyBtcAddress().generateNew() | |
newAddr.pprint() | |
print ' Private key (integer):', newAddr.privKeyInt | |
print ' Private key (hex, BE):', int_to_hex(newAddr.privKeyInt, widthBytes=32, endOut=BIGENDIAN) | |
privKeyBinary33 = '\x80' + int_to_binary(newAddr.privKeyInt, widthBytes=32, endOut=BIGENDIAN) | |
chksum = hash256(privKeyBinary33) |
All hex values are definitely big-endian, except for Msg, which is *probably* BE. | |
#1 | |
Msg: 9d80933fe66d99317bb9600f40136f843fb33732c4e0456feca748f1463a2baa | |
Sig1r: 6e6259bf19ef089929a64618ac505983f5e5f060ab1e7cec5a74b3ec1810fe83 | |
Sig1s: 80cf29cbb1786a4a96f5b4b1b6d0fbbde5d9c64db9fc162ab5a8858c8dc293d4 | |
Sig2r: 19a59bdef0406a2ac9bf798c5b3250e814e04d6caa71b0a434f6e2688a5c4b9d | |
Sig2s: d4779e4d445290e0e1fb2a568f8051dba1a8a520066797f78e375ad9983559ea |
Verify 2-of-2 tx from Testnet: | |
Testnet Tx: 1c9608650a912be7fa88eecec664e6fbfa4b676708697fa99c28b3370005f32d (LE) | |
Spent: Block 26670 Tx: 1 | |
OP_PUSHDATA : 30450220 | |
OP_PUSHDATA : 30450220 04e83c1d | |
OP_PUSHDATA : 30450220 04e83c1d 30460221 | |
OP_PUSHDATA : 30450220 04e83c1d 30460221 047cf315 | |
OP_2 : 30450220 04e83c1d 30460221 047cf315 2 | |
OP_TOALTSTAC: 30450220 04e83c1d 30460221 047cf315 | |
OP_0 : 30450220 04e83c1d 30460221 047cf315 0 |
- Author: Alan Reiner (Armory)
- Orig Date: 04 April, 2012 First Draft: Sorting out ideas, and event sequences, handling details like who signs what when and where change outputs and fees fit into the equation.
Here's an example of Alice and Bob setting up the transaction. Bob posts an item on craigslist, knowing that unknown, untrusted Alice will try to buy it. In this case, Bob is the seller and will set the "Risk Deposit" (could also be "Escrow Deposit"). This can be negotiated by the buyer, but I expect that something like 15-25% would be standard and not a point of contention. Remember, buyer does not trust seller, and vice versa.
Following is the test code I used. Generate the same sequences in both | |
private key space and public key space, make sure they generate the same | |
addresses. | |
Extended Keys are a triplet of (Priv, Pub, Chain). For extended public | |
keys, Priv is empty. When Priv is populated, Pub is computed. | |
----------------------------------------------------------------------------------------------- | |
// Confirm endianness of integer-to-binary |
Motivation
Armory currently holds address & transaction comments/labels as data appended to the wallet file (zeroed out when replaced/deleted). While it would be nice to keep comments in a separately backup-able file, the data is typically not critical and has not justified the effort to add complexity to the application to accommodate separate backups (or at least a backup that doesn't also include your maybe-encrypted private keys).
P2SH changes this.
Most P2SH scripts will be recoverable if you have backed-up the relevant wallets (which is likely available for personal P2SH/two-factor-auth setups). However, multi-signature transactions executed with other parties, such as escrow or various contracts, is considered critical data. So is the contact information of the other parties in the transaction. Reconstructing your own wallet will not help you find P2SH/multi-sig transactions involving your wallet, and even if you could, it would not help you figure out who the other parties are. You s
class ModInt: | |
""" An int that adds when you * and multiplies when you + """ | |
def __init__(self, val): | |
self.val = val | |
def __mul__(self, other): | |
return ModInt(self.val + other.val) | |
def __add__(self, other): | |
return ModInt(self.val * other.val) |