Bitcoin Forum
November 13, 2024, 06:14:57 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How much blockchain required for raw transactions?  (Read 1175 times)
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 12, 2013, 02:28:12 PM
 #1

I want to use bitcoind for one very specific purpose: create and sign raw transactions where I specify all the inputs, outputs and private keys for signing. I thought I could do this without downloading the blockchain since I was explicitly specifying the inputs. But it doesn't work. So how much of the chain is required to be able to do this?



CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 12, 2013, 02:30:42 PM
 #2

With the way that bitcoind works currently you will have to have the entire blockchain (it doesn't let you do otherwise).

I think this will be changing in future versions - at a minimum you would need the tx's for each UTXO you want to use as an "input" for your tx.

If blockchain.info supported a "createrawtransaction" API then it would be much easier (you wouldn't need the blockchain at all - just the private keys to sign the raw transaction).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 12, 2013, 02:48:03 PM
 #3

The CIYAM Safe (http://susestudio.com/a/kp8B3G/ciyam-safe) uses the no blockchain approach with bitcoind (I would love blockchain.info to add a "createrawtransaction" API so I could streamline it).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 12, 2013, 03:16:50 PM
 #4

Ok thanks. You are right about having the txs you want to spend locally (even though I am specifying them explicitly). I may be able to manage that much of the chain.

I too would love to see bci implement raw transactions. But until then I either have to run bitcoind or use Vitalik's script.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 12, 2013, 03:40:21 PM
 #5

I too would love to see bci implement raw transactions. But until then I either have to run bitcoind or use Vitalik's script.

They do have the APIs decode-tx and pushtx but just lack the create-tx one (if you want to send piuk a PM about that then I will do the same).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 12, 2013, 03:57:06 PM
 #6

I too would love to see bci implement raw transactions. But until then I either have to run bitcoind or use Vitalik's script.

They do have the APIs decode-tx and pushtx but just lack the create-tx one (if you want to send piuk a PM about that then I will do the same).


They also lack signrawtransaction which I'd like to have too. I've sent in the request. Please do the same when you get a chance.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 12, 2013, 04:01:56 PM
 #7

They also lack signrawtransaction which I'd like to have too. I've sent in the request. Please do the same when you get a chance.

The "signrawtransaction" should probably not be made available as it would require them to have your private keys. You can do the "signrawtransaction" without needing a blockchain though so although you'd still need bitcoind it does make things much simpler (such as having the signing occur on a completely offline computer as I do with CIYAM Safe).

I will make the request about "createrawtransaction" to piuk shortly.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 12, 2013, 04:10:00 PM
 #8

They also lack signrawtransaction which I'd like to have too. I've sent in the request. Please do the same when you get a chance.

The "signrawtransaction" should probably not be made available as it would require them to have your private keys. You can do the "signrawtransaction" without needing a blockchain though so although you'd still need bitcoind it does make things much simpler (such as having the signing occur on a completely offline computer as I do with CIYAM Safe).

For my use case the private key has effectively stopped being private so sending it to bci for signing is not a big deal.

Anyway if you know of a way to sign a transaction without the blockchain I'd love to know? Right now createrawtransaction is working without the chain but not the signing part. signrawtransaction is returning an empty "complete" value (empty, not even 0).
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 12, 2013, 04:13:27 PM
 #9

The CIYAM Safe does the "signrawtransaction" with no blockchain (and I've used it many times).

All you need to do a "signrawtransaction" is the unsigned raw tx and the keys in the wallet (so use "importprivkey").

The "signrawtransaction" will not create a "complete" tx unless it has all the required private keys. All the UTXO information is contained in the raw tx from "createrawtransaction" (thus it is the "missing link" here).


With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 12, 2013, 04:42:27 PM
 #10

The CIYAM Safe does the "signrawtransaction" with no blockchain (and I've used it many times).

All you need to do a "signrawtransaction" is the unsigned raw tx and the keys in the wallet (so use "importprivkey").

The "signrawtransaction" will not create a "complete" tx unless it has all the required private keys.

Well it's not working for me. I've tried it both after importing the private key and by specifying it as the third argument of signrawtransaction. If I have the blockchain it will do it but not without it.

Which version if bitcoind are you using in CIYAM Safe? I am using the 0.8.5 version.
Amitabh S
Legendary
*
Offline Offline

Activity: 1001
Merit: 1005


View Profile
November 12, 2013, 05:48:03 PM
Last edit: November 12, 2013, 06:05:33 PM by Amitabh S
 #11

Blockchain is not needed. There is a demo site here that allows you to create (and broadcast) a raw transaction.

https://spendcoins.cfapps.io

(of course, it needs private key, so be aware of risks!)

Coinsecure referral ID: https://coinsecure.in/signup/refamit (use this link to signup)
gmaxwell
Staff
Legendary
*
Offline Offline

Activity: 4270
Merit: 8805



View Profile WWW
November 12, 2013, 07:06:17 PM
 #12

With the way that bitcoind works currently you will have to have the entire blockchain (it doesn't let you do otherwise).
Uh. No. Thats absolutely not true. If you provide the required information (including scriptpubkeys for the inputs) you can sign transactions without a blockchain at all.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4847



View Profile
November 12, 2013, 08:44:46 PM
 #13

If you provide the required information (including scriptpubkeys for the inputs) you can sign transactions without a blockchain at all.

That's what I thought.  Thanks.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 13, 2013, 02:25:32 AM
Last edit: November 13, 2013, 03:05:09 AM by CIYAM Open
 #14

Uh. No. Thats absolutely not true. If you provide the required information (including scriptpubkeys for the inputs) you can sign transactions without a blockchain at all.

I think you misunderstood my point (which I probably didn't make very well) - you need to get the UTXO info (scriptPubKeys) from somewhere and that is typically going to have to come from a blockchain (whether local or via say blockchain.info) - I never meant that you need a blockchain to *sign* a raw transaction (as CIYAM Safe does not use a blockchain at all).

What I was getting at in regards to upcoming versions of bitcoind was the SPV support.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 13, 2013, 02:44:29 AM
Last edit: November 13, 2013, 03:19:13 AM by CIYAM Open
 #15

Well it's not working for me. I've tried it both after importing the private key and by specifying it as the third argument of signrawtransaction. If I have the blockchain it will do it but not without it.

I am guessing that you are missing the scriptPubKey parts of the UTXO's used as inputs (which you normally would get from the blockchain).

Have a play with this: http://ciyam.org/rawtx_helper.html (and don't worry it doesn't ask or want private keys).

You can find each UTXO's scriptPubKey through blockchain.info (starting with an address then click on a transaction with an unspent output and click the "Show scripts & coinbase" link - the scriptPubKeys will appear at the bottom left of the page).

It seems my first reply was not clear so let me just expand the steps to create, sign and send a raw tx as I do it with CIYAM Safe:

1) Find your UTXO information (you can do this using "listunspent" via bitcoind with a blockchain or using blockchain.info).
2) Select the destination address(es) and amount(s).
3) Issue the "createrawtransaction" command.
4) Add the scriptPubKey(s) to the rawtransaction in order to create the "signrawtransaction" command.
5) Issue the "signrawtransaction" command (this part requires the private keys to either be in the wallet or explicitly included).
6) Send the raw tx via "sendrawtransaction" (perhaps you might want to do a "decoderawtransaction" first to double check it).

You are needing blockchain information to get the UTXO information (txid, vout and scriptPubKey) but you do not need a blockchain to issue any of the raw tx commands themselves.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4847



View Profile
November 13, 2013, 03:07:00 AM
 #16

you need to get the UTXO info (scriptPubKeys) from somewhere and that is typically going to have to come from a blockchain (whether local or via say blockchain.info)

When the OP stated:

where I specify all the inputs, outputs and private keys for signing. I thought I could do this without downloading the blockchain since I was explicitly specifying the inputs.

I assumed that the OP was planning on supplying the scriptPubKeys in the signrawtransaction command:

As specified in the API:

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 13, 2013, 03:16:59 AM
 #17

I assumed that the OP was planning on supplying the scriptPubKeys in the signrawtransaction command:

Seems more likely that he doesn't have the scriptPubKeys (maybe he didn't follow that part of the "signrawtransaction").

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 13, 2013, 05:14:38 AM
 #18

you need to get the UTXO info (scriptPubKeys) from somewhere and that is typically going to have to come from a blockchain (whether local or via say blockchain.info)

When the OP stated:

where I specify all the inputs, outputs and private keys for signing. I thought I could do this without downloading the blockchain since I was explicitly specifying the inputs.

I assumed that the OP was planning on supplying the scriptPubKeys in the signrawtransaction command:

As specified in the API:

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list



Yes I missed that part. I thought it was optional like it says in the wiki.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4847



View Profile
November 13, 2013, 05:31:54 AM
 #19

Yes I missed that part. I thought it was optional like it says in the wiki.

It is optional (in a full client that has access to enough of the blockchain to look up the scriptPubKeys with the transaction ID and vout that was supplied with the createrawtransaction).

If you opt not to use client that has enough blockchain to look it up, then you have to provide it yourself.
Abdussamad (OP)
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 13, 2013, 05:41:36 AM
 #20

Yes I missed that part. I thought it was optional like it says in the wiki.

It is optional (in a full client that has access to enough of the blockchain to look up the scriptPubKeys with the transaction ID and vout that was supplied with the createrawtransaction).

If you opt not to use client that has enough blockchain to look it up, then you have to provide it yourself.

Yes I understand that now. Thanks.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!