Bitcoin Forum
June 22, 2024, 02:54:25 PM *
News: Voting for pizza day contest
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 09:54:43 PM
Sweet. We should probably:
1) Write a test for the other branch as well
2) Try sending the tx to a 0.10 node before using blochain.info/pushtx on it to prove that the network will really take these things when it starts to upgrade.

1) Ok. I have to learn how to do a push request (I suck at GIT) and I'll make a suggestion to  your test.
2)  the blockchain.info method is a kind of a cheat ;-) But if it works ;-) but I'd LOVE to test that. I'm just happy it's working (and it worked. I got my 2 cents ;-) Who tests on the testnet any more ;-)


P.S. Your library will be talked about at tomorrow's Miami Bitcoin hackathon cause it's amazing. Thank you so much for helping me with this.
2  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 06:51:18 PM
Just updating the group.

We have created successfully a MultiSig Signature from JUST the Bitcoin Addresses (I think we're the first to do that, can't find anyone else online doing this.)
NO PUBKEY WAS USED (well the PubKey HASH was using, but not the original uncompressed full PubKey)

See transactions IN (the first from edmundedgar with the public Keys and the second from ME using the code below)

https://blockchain.info/address/3PcxJeW5f6Tp4mVAXe4ggGRvDREAPCMF4o


Thanks of course to everyone. And especially to edmundedgar for his amazing code examples INCLUDING his private keys (which makes live easier)

You need to do a:
1) download edmundedgar's Bitcoin Branching Transaction builder: https://github.com/edmundedgar/bitcoin-branching-transaction-builder
2) run "npm install bitcoinjs-lib" on that root directory
3) Make an app.js in the root of that project with the following code below (of course you have to have NODEjs installed)

Code:
var bitcoin = require('bitcoinjs-lib');
var BranchingTransactionBuilder = require('./src/branching_transaction_builder');
var ECKey = bitcoin.ECKey;
var Address = bitcoin.Address;
var scripts = bitcoin.scripts;

var BitcoinAddress1 = "1Fratqwo3Bu2FwMBzAex8WgDbmmGgJYLGH";
var BitcoinAddress2 = "112jFbM3Lp3qRSjezGFCv2rejT3UQ6rH5Z";

var addr1 =  Address.fromBase58Check(BitcoinAddress1);
var addr2 =  Address.fromBase58Check(BitcoinAddress2);

var branch1 = scripts.pubKeyHashOutput(addr1.hash);
var branch2 = scripts.pubKeyHashOutput(addr2.hash);


var branch_builder = new BranchingTransactionBuilder();
branch_builder.addSubScript(branch1);
branch_builder.addSubScript(branch2);
var branch_redeem_script = branch_builder.script();

var scriptPubKey = bitcoin.scripts.scriptHashOutput(branch_redeem_script.getHash())
var multisigAddress = bitcoin.Address.fromOutputScript(scriptPubKey).toString()
console.log("MultiSig Address: " + multisigAddress);
console.log("Redeem script: " + branch_redeem_script.buffer.toString('hex'));           


console.log("");
console.log("Ok. Now you FUND the account with something of MORE than 0.0001 bitcoins (that's the minimum)");
console.log("");

// Make Transaction
var Transaction = bitcoin.Transaction;
var TransactionBuilder = bitcoin.TransactionBuilder;

var BitcoinToSendTo = "1GzUEmh472VwWydkhY4vDQMqY3xFpZRcKs";
var addrToSendTo = Address.fromBase58Check(BitcoinToSendTo);
var branchToSendTo = scripts.pubKeyHashOutput(addrToSendTo.hash);

// Just repeating what's above to reiterate and segregate the code
BitcoinAddress2 = "112jFbM3Lp3qRSjezGFCv2rejT3UQ6rH5Z";
addr2 =  Address.fromBase58Check(BitcoinAddress2);
branch2 = scripts.pubKeyHashOutput(addr2.hash);

// Unspent amount: from https://blockchain.info/unspent?active=3PcxJeW5f6Tp4mVAXe4ggGRvDREAPCMF4o
            var test_output = {"unspent_outputs":[
                    {
                        "tx_hash":"3be8387e161bfc927cd4d06e4f1a800806ba509f74185709ee460967fe1d57c5",
                        "tx_hash_big_endian":"c5571dfe670946ee095718749f50ba0608801a4f6ed0d47c92fc1b167e38e83b",
                        "tx_index":74160687,
                        "tx_output_n": 0,
                        "script":"a914f08e151def9e83a2d96b44b5d87c719dcd374d8a87",
                        "value": 200000,
                        "value_hex": "030d40",
                        "confirmations":0
                    }
            ]};


var branch_redeem_script2 = branch_builder.script(branch_redeem_script.buffer.toString('hex'));
var spend_builder = new TransactionBuilder();
spend_builder.addInput(test_output['unspent_outputs'][0]['tx_hash_big_endian'], 0);
spend_builder.addOutput("1Dc8JwPsxxwHJ9zX1ERYo9q7NQA9SRLqbC", test_output['unspent_outputs'][0]['value'] - 10000);


var priv2 = ECKey.fromWIF('L3MRgBTuEtfvEpwb4CcGtDm4s79fDR8UK1AhVYcDdRL4pRpsy686');
var gp_builder = new BranchingTransactionBuilder(spend_builder);

// input 0 of the tx, second branch of 2 (index 1)
gp_builder.selectInputBranch(0, 1, 2);
gp_builder.signBranch(0, priv2, branch_redeem_script2, null, branchToSendTo);
var tx = gp_builder.build();

console.log(tx.toHex());

3  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 05:08:47 PM
Let's see that proof. Because if you can help me find the "publicKey" from my EXISTING blockchain.info

Here you go:
 (((( Image excluded )))

Proof accepted. I absolutely do for blockchain.info
And also like @amaclin said. Do I have it if I can look up a transaction from this public address in the past? (I mean that happened an hour ago) can I get the public key from the blockchain? After all If your about to FUND my new key. YOU have GOTTEN some money in the past.


Also. Does my code (see in the last post) trump this argument? (of which Danny you have won)
4  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 04:57:17 PM
I just added a quick test for branching versions of pay-to-public-address-hash - hopefully this will make it clearer how it's supposed to work.

Alright. I think I have it. Here's a script that STARTS with your two BITCOIN ADDRESSES and ends with the same multiSig Key your test does.

BUT the redeem script looks too short. I'll have to try that transaction like you did yours.

Can you anything I'm doing wrong?

Code:
var bitcoin = require('bitcoinjs-lib');
var BranchingTransactionBuilder = require('./src/branching_transaction_builder');
var ECKey = bitcoin.ECKey;
var Address = bitcoin.Address;
var scripts = bitcoin.scripts;

var BitcoinAddress1 = "1Fratqwo3Bu2FwMBzAex8WgDbmmGgJYLGH";
var BitcoinAddress2 = "112jFbM3Lp3qRSjezGFCv2rejT3UQ6rH5Z";

var addr1 =  Address.fromBase58Check(BitcoinAddress1);
var addr2 =  Address.fromBase58Check(BitcoinAddress2);

var branch1 = scripts.pubKeyHashOutput(addr1.hash);
var branch2 = scripts.pubKeyHashOutput(addr2.hash);


var branch_builder = new BranchingTransactionBuilder();
branch_builder.addSubScript(branch1);
branch_builder.addSubScript(branch2);
var branch_redeem_script = branch_builder.script();

var scriptPubKey = bitcoin.scripts.scriptHashOutput(branch_redeem_script.getHash())
var multisigAddress = bitcoin.Address.fromOutputScript(scriptPubKey).toString()
console.log("MultiSig Address: " + multisigAddress);
console.log("Redeem script: " + branch_redeem_script.buffer.toString('hex')); 

RESULTS:
MultiSig Address: 3PcxJeW5f6Tp4mVAXe4ggGRvDREAPCMF4o
Redeem script: 6376a914a2f26faf639c9a7e6a3ae5076bf7bbbf6cf1732a88ac6776a9140053af91626c8e511b6 3f651161208b56ad0adac88ac68

5  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 03:08:00 PM
Quote
If you have the android client. if you have a blockchain.info account. You DON'T have your public key.

In fact, you do.

Let's see that proof. Because if you can help me find the "publicKey" from my EXISTING blockchain.info or android wallet accounts then We've solve my initial problem.

Real problem.

I want to make a 1of2 address and I have MY PubKey, but I don't have my mom's (or sisters, or friends) because they use a blockchain.info account and Android Wallet software.
6  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 05:30:21 AM

@edmundedgar; using your code and  your "bitcoin-branching-transaction-builder" project (and Peter Todd's public Bitcoin Address so he could sign a TRANSACTION)

Code:
var bitcoin = require('bitcoinjs-lib');
var BranchingTransactionBuilder = require('./src/branching_transaction_builder');
var Script = bitcoin.Script;

var BitcoinAddress1 = "1KYestTGTEJzM5pR7AAQ7ckBE55ytLRaDk";
var BitcoinAddress2 = "1FCYd7j4CThTMzts78rh6iQJLBRGPW9fWv";
var rules = "OP_IF OP_DUP OP_HASH160 "+ BitcoinAddress1 + " OP_EQUALVERIFY OP_CHECKSIG. OP_ELSE OP_DUP OP_HASH160 " + BitcoinAddress2 + "  OP_EQUALVERIFY OP_CHECKSIG. OP_ENDIF";
var NewP2SHAddress = Script.fromASM(rules);

console.log(NewP2SHAddress.buffer.toString('hex'));


 I get a bitcoin address of: 6376a90088006776a900880068

Is this right? Where is the redeemScript
7  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 09, 2015, 04:40:23 AM
Code:
OP_IF
OP_DUP OP_HASH160 <address1> OP_EQUALVERIFY OP_CHECKSIG.
OP_ELSE
OP_DUP OP_HASH160 <address2> OP_EQUALVERIFY OP_CHECKSIG.
OP_ENDIF

1) Peter Todd. You say your version is better. But it seems to include the PubKeys. I need to include two (or at least one) Bitcoin Address (because I don't have the PubKey, they're not my addresses)
So will BIP19 help me here? and is it available now?

2) Edmundedgar: Thank you. So your solution should work once everyone moves to 0.10 bitcoin and if maybe the right pool catches my transaction. Did I understand that right? If the wrong pool gets it. does it go back in the queue until they THEY process the transaction?

I'm new at this. but hopefully your link for the bitcoin-branching-transaction-builder will help. but their "tests" and therefor only documentation keeps mentioning PubKeys. So I'm trying to make the code work right now and it's not easy.

I'll update this thread with my solution if I can get bitcoinJS-lib to build.
8  Bitcoin / Development & Technical Discussion / Re: MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 08, 2015, 09:36:19 PM
Thank you DeathAndTaxes;

How can I make a multiSig address with just regular Bitcoin Addresses?

I'm trying to create a bitcoin address where any ONE of TWO (or THREE) bitcoin private addresses can SIGN a transaction.
9  Bitcoin / Development & Technical Discussion / MultiSig BUT with Bitcoin Addresses NOT Public Keys on: January 08, 2015, 07:43:53 PM
I'm building a Bitcoin ATM that will use Multi-Sig for security and I realized I can't create a MultiSig Account with ONLY the Bitcoin Addresses.

Why does MultiSig Use Public Key's as opposed to the compressed 1xxxxx Bitcoin address?

I feel that most of the time I'll be building MultiSig Accounts with other people. Most of whom will NOT have their public Key. Only their private key and bitcoin address.

If you have the android client. if you have a blockchain.info account. You DON'T have your public key.

Is there a way to build a multi sig with BITCOIN ADDRESSES only? (or at least ONE public key from one person (me) and a the bitcoin address of someone else?)

is there a way to CALCULATE the PUBLIC KEY (PUBKEY) from the Bitcoin Address?

Please help!
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!