Author

Topic: How to gain a deep understanding of transactions (Read 14630 times)

sr. member
Activity: 294
Merit: 250
You are a geek if you are too early to the party!
December 08, 2013, 05:09:19 PM
#18
@nwbitcoin oh, you are referring to "A script is essentially a list of instructions recorded with each transaction that describe how the next person wanting to spend the Bitcoins being transferred can gain access to them."
So i have a tx with an output script and the transaction is over and out. But the next transaction can be done only after the timer.

The timer we are talking hereis not nLockTime, right? Because nLockTime says "Otherwise, the transaction may not be added to a block until after lock_time"
https://en.bitcoin.it/wiki/Protocol_specification#tx

So what is this disabled feature in the script you are talking about?

many thanks!





I think I understand the confusion, the instruction in the transaction script, includes an area where more complex script instructions can be placed.  Currently, that is limited to just one instruction, but it will be extended.

The articles in this thread might be useful to explain  - its where I asked a similar question and found my answers.

https://bitcointalksearch.org/topic/a-peer-to-peer-options-and-futures-exchange-using-confidence-chains-360087

sr. member
Activity: 481
Merit: 252
@vosovich:  You are right, that article is excellent.
newbie
Activity: 37
Merit: 0
@vosovich: awsome, reading it right now!
sr. member
Activity: 481
Merit: 252
@genjix:  Appreciate all your work on Bitcoin and libbitcoin, but is there a program to write and test Bitcoin Scripts?  A sort of Bitcoin Script IDE?  I think you need a little more than gforth.
newbie
Activity: 37
Merit: 0
@nwbitcoin oh, you are referring to "A script is essentially a list of instructions recorded with each transaction that describe how the next person wanting to spend the Bitcoins being transferred can gain access to them."
So i have a tx with an output script and the transaction is over and out. But the next transaction can be done only after the timer.

The timer we are talking hereis not nLockTime, right? Because nLockTime says "Otherwise, the transaction may not be added to a block until after lock_time"
https://en.bitcoin.it/wiki/Protocol_specification#tx

So what is this disabled feature in the script you are talking about?

many thanks!



sr. member
Activity: 294
Merit: 250
You are a geek if you are too early to the party!

You can post date your transactions through contracts, and that does limit the spend as you can't transfer the bitcoin once you have assigned it to a future transfer.


Are you sure? My intuition is that Alice's transaction is not spent, and therefore she can spend another tx instead.

If the contract is set up with a value to transfer at a future date, then its already spent, according to the script.

https://en.bitcoin.it/wiki/Script

This is not yet operational, but when it is, then the transaction goes through to the blockchain, with its post dated value transfer. the bitcoin will be recorded as being spent, but with no value, allocated, that will still show up in Alice's wallet.

This way Alice can't spend it either - think of it like a first confirmation delay that lasts the entire period of the contract!

A bond takes this transaction as its value and time stamp for existence - but this is where things start getting a bit complex because it starts following financial rules!





newbie
Activity: 37
Merit: 0

You can post date your transactions through contracts, and that does limit the spend as you can't transfer the bitcoin once you have assigned it to a future transfer.


Are you sure? My intuition is that Alice's transaction is not spent, and therefore she can spend another tx instead.
newbie
Activity: 28
Merit: 0
I have found an excellent article which introduces the bitcoin protocol. It has filled many gaps in my understanding of the protocol.
sr. member
Activity: 294
Merit: 250
You are a geek if you are too early to the party!
Are there transactions that are somehow reserved? By 'reserved' I mean they are not spent, but I would not be able to spent the money at the address somewhere else.
For example if I have a crowdfunding tx with SIGHASH_ALL | SIGHASH_ANYONECANPAY on the input and Alice buys in, but then spends all the money on a shopping spree before I collected all the moneys, her crowdfunding contribution would simply be invalidated, right?
 

It's probably not what you were asking for, but feel free to precise the question.

Thank you Piotr,
I look at the crowdfunding example "Assurance contracts" https://en.bitcoin.it/wiki/Contracts#Example_3:_Assurance_contracts
It is pretty clear to me how it works generally but I have some specific questions:
I am wondering if a person Alice that makes a pledge of 100 BTC in a 1000 BTC assurance contract can then still spent the 100 BTC?
Infact the output of the assurance tx is set to 1000 BTC, so until 1000 BTC are not collected the assurance tx remains unspent.
This leads to the matter that also Alices pledge is unspent? For her 100 BTC are an input into the assurance tx?
If so Alice could decide any time to spend the 100 BTC for something else. Is this correct?

Not that its a problem for me if Alice wants to do here shopping. I just wonder if bitcoin works that way, and if yes how you would make a "reservation" of the money, like with nTimelock but instead of spending the money only after a certain time, you reserve it for a certain amount of time.

This is exactly what I've been looking at, and it seems it links to script contracts and bonds.

You can post date your transactions through contracts, and that does limit the spend as you can't transfer the bitcoin once you have assigned it to a future transfer.
However, you can use that value as part of a bond, where the bond assumes the value of the contract, and you are free to spend it, as long as you buy back the bond before your contract hits its time to transfer.

I am thinking it would be a fantastic way to create a community credit card which gives a credit union the facility that currently are only available through banks.
legendary
Activity: 2053
Merit: 1356
aka tonikt
My pleasure, man.

Since I am just a regular bitcoins user, with no woman whatsoever, these kind of contracts are not my domain of interest Smiley
Though I am pretty sure that you can do all kind of a weird stuff with the bitcoin scripts.
Whether such transaction would be routed/mined or not - that's a different topic, but in theory the protocol is pretty open and you can mine whatever is not against it, as long as you find a miner which does not censor your script just because it is "non-standard" according to rules arbitrary defined by the bitcoin elite.

I know people around here have been working on solving all kind of strange contracts.
So if you ask patiently enough, eventually someone will show you the right way, not just pretend to know that he thinks there is one... Wink
You definitely ask a smart questions - that's why I don't want to give you a stupid answers.
newbie
Activity: 37
Merit: 0
Are there transactions that are somehow reserved? By 'reserved' I mean they are not spent, but I would not be able to spent the money at the address somewhere else.
For example if I have a crowdfunding tx with SIGHASH_ALL | SIGHASH_ANYONECANPAY on the input and Alice buys in, but then spends all the money on a shopping spree before I collected all the moneys, her crowdfunding contribution would simply be invalidated, right?
 

It's probably not what you were asking for, but feel free to precise the question.

Thank you Piotr,
I look at the crowdfunding example "Assurance contracts" https://en.bitcoin.it/wiki/Contracts#Example_3:_Assurance_contracts
It is pretty clear to me how it works generally but I have some specific questions:
I am wondering if a person Alice that makes a pledge of 100 BTC in a 1000 BTC assurance contract can then still spent the 100 BTC?
Infact the output of the assurance tx is set to 1000 BTC, so until 1000 BTC are not collected the assurance tx remains unspent.
This leads to the matter that also Alices pledge is unspent? For her 100 BTC are an input into the assurance tx?
If so Alice could decide any time to spend the 100 BTC for something else. Is this correct?

Not that its a problem for me if Alice wants to do here shopping. I just wonder if bitcoin works that way, and if yes how you would make a "reservation" of the money, like with nTimelock but instead of spending the money only after a certain time, you reserve it for a certain amount of time.
legendary
Activity: 1232
Merit: 1076
legendary
Activity: 2053
Merit: 1356
aka tonikt
Are there transactions that are somehow reserved? By 'reserved' I mean they are not spent, but I would not be able to spent the money at the address somewhere else.
For example if I have a crowdfunding tx with SIGHASH_ALL | SIGHASH_ANYONECANPAY on the input and Alice buys in, but then spends all the money on a shopping spree before I collected all the moneys, her crowdfunding contribution would simply be invalidated, right?
 

I am not sure if I understood the question but if I did...

Bitcoin transaction are not like credit cards - your girlfriend Alice cannot go on a shopping spree with your money if the money in her purse does not exist.
Using an analogy, it's more like a pre-paid card.
The only form of the money in her bitcoin purse is a set of a so-called "unspent outputs".

The way how an unspent output can be spent - that's a different topic. A pretty huge one, in fact..
You can for instance use the multisig transactions - so it would require e.g. 2 of 3 keys to spend the output and this way Alice would not be able to spend the money without a second signature.

It's probably not what you were asking for, but feel free to precise the question.
newbie
Activity: 37
Merit: 0
Put aside the commentary of some financial entertainers, people are in the media to entertain not to seek the truth.
Some more questions about transactions:

Are there transactions that are somehow reserved? By 'reserved' I mean they are not spent, but I would not be able to spent the money at the address somewhere else.
For example if I have a crowdfunding tx with SIGHASH_ALL | SIGHASH_ANYONECANPAY on the input and Alice buys in, but then spends all the money on a shopping spree before I collected all the moneys, her crowdfunding contribution would simply be invalidated, right?
 
legendary
Activity: 2053
Merit: 1356
aka tonikt
this is really useful - more people need to understand the mechanics of how Bitcoin works because they can then understand the potential!
I couldn't agree more.

Reading some economical experts - e.g. like Bill Fleckenstein, it seems pretty obvious that they have no clue what bitcoin is and why its security is much stronger than any army can give. If the guy was really smart, as he pretends to be, he would have known that it is a solid money that builds an army and not the other way around... Smiley

Quote
Eric King:  “Bill, Bitcoin, do you have any thoughts on that?”

Fleckenstein:  “Yeah, it’s a giant chain-letter.  Everyone will lose all of their money that puts money in it.  It’s a complete joke.  Even a crappy currency has government taxing ability behind it, or some sort of a standing army or something like that.

Bitcoin is nothing.  It’s dot-com mania 3.0 just moved one step over, right?  People are so enamored with communication with their phones and online commerce and all of that.  Now they’ve invented what they call a currency to mess around with it, and people are speculating in it the same way they speculated in this other crap.  It’s not a currency at all, it’s a complete joke.”

http://kingworldnews.com/kingworldnews/KWN_DailyWeb/Entries/2013/12/6_Fleckentstein_-_Global_Meltdown_%26_Why_Bitcoin_Will_Go_To_Zero.html
sr. member
Activity: 294
Merit: 250
You are a geek if you are too early to the party!
this is really useful - more people need to understand the mechanics of how Bitcoin works because they can then understand the potential!
legendary
Activity: 2053
Merit: 1356
aka tonikt
Start here:
https://en.bitcoin.it/wiki/Protocol_specification#tx
https://en.bitcoin.it/wiki/Script
https://en.bitcoin.it/wiki/OP_CHECKSIG

Try to decode few raw transactions manually (from the hexdump) - that should give you a good start of what they are.

Also what is important and confuses many new people: each transaction (except of the coinbase/mining ones) refers to output scripts from its inputs, which are in previous transactions.
So validating a transaction involves executing a script that is a part of some previous transaction... same case for signing - just the opposite.
newbie
Activity: 37
Merit: 0
What is the best way to understand the protocol better?
1. how can I perform some testnet transactions, what are the best tools to create custom transactions? sx or what tool do you guys use for that?
2. to understand complex transactions my best source is https://en.bitcoin.it/wiki/Contracts, is there more documentation I should read?

Jump to: