Bitcoin Forum
May 06, 2024, 09:50:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Storing scripts (smart contracts) outside the blockchain  (Read 923 times)
hjpbarcelos (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 2


View Profile
March 15, 2016, 12:52:47 PM
Merited by ABCbits (2)
 #1

I'm following "Mastering Bitcoin" from Andreas Antonopoulos in order to understande the Bitcoin implementation.

In the chapter about transactions, he points some advantages of P2SH transactions:

  • Complex scripts are replaced by shorter fingerprints in the transaction output, making the transaction smaller.
  • Scripts can be coded as an address, so the sender and the sender’s wallet don’t need complex engineering to implement P2SH.
  • P2SH shifts the burden of constructing the script to the recipient, not the sender.
  • P2SH shifts the burden in data storage for the long script from the output (which is in the UTXO set) to the input (stored on the blockchain).
  • P2SH shifts the burden in data storage for the long script from the present time (payment) to a future time (when it is spent).
  • P2SH shifts the transaction fee cost of a long script from the sender to the recipient, who has to include the long redeem script to spend it.

About item 4, it still looks suboptimal to me.

Imagine that I have a firm where in order to spend the payment from customers I also have to get the signatures from at least 1 of 2 other partners. My script would look like:

Code:
2 <My PubKey> <Partner 1's PubKey> <Partner 2's PubKey> 3 OP_CHECKMULTISIG

So, for every incoming payments that I'd like to spend, my scriptSig would have to be bloated with the script above plus 2 signatures <sig1> <sig2>.

Imagine that I'll have thousands of these transactions, this would be bloating the blockchain, probably decreasing the processing capabilities of the network.

I was wondering: is there any way of mantaining these scripts as "accounts" in "script wallets" and not storing it inside the blockchain?

When there is need for validation, I could simply retrieve this script form the "wallet" and check the transaction.

How would it be possible?
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
Bitcoin addresses contain a checksum, so it is very unlikely that mistyping an address will cause you to lose money.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
1715032253
Hero Member
*
Offline Offline

Posts: 1715032253

View Profile Personal Message (Offline)

Ignore
1715032253
Reply with quote  #2

1715032253
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6587


Just writing some code


View Profile WWW
March 15, 2016, 02:23:03 PM
Merited by ABCbits (2)
 #2

About item 4, it still looks suboptimal to me.

Imagine that I have a firm where in order to spend the payment from customers I also have to get the signatures from at least 1 of 2 other partners. My script would look like:

Code:
2 <My PubKey> <Partner 1's PubKey> <Partner 2's PubKey> 3 OP_CHECKMULTISIG

So, for every incoming payments that I'd like to spend, my scriptSig would have to be bloated with the script above plus 2 signatures <sig1> <sig2>.

Imagine that I'll have thousands of these transactions, this would be bloating the blockchain, probably decreasing the processing capabilities of the network.

I was wondering: is there any way of mantaining these scripts as "accounts" in "script wallets" and not storing it inside the blockchain?

When there is need for validation, I could simply retrieve this script form the "wallet" and check the transaction.

How would it be possible?
It's all the same, both will still end up in the blockchain one way or another. The difference is that with bare multisig, nodes will have to maintain that extra data in a UTXO database instead of not at all in a database when it is in the blockchain.

watashi-kokoto
Sr. Member
****
Offline Offline

Activity: 682
Merit: 268



View Profile
March 15, 2016, 03:15:42 PM
 #3

Don't worry about bloating the chain. Just do it , and if Bitcoin becomes too expensive you can run it on doge or elsewhere.

just imagine the blockchain is free don't be afraid

You wouldn't believe it but even a shitcoin offers a pretty good level of security.
hjpbarcelos (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 2


View Profile
March 15, 2016, 03:27:19 PM
 #4

I think I did not explained myself properly.

I'm thinking about different blockchain implementations.

Imagine that I'm creating a private specialized network that will process complex contracts.

Would there be any way that I could store contratcs outside the blockchain and just reference them in the transactions?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6587


Just writing some code


View Profile WWW
March 15, 2016, 03:28:21 PM
 #5

I think I did not explained myself properly.

I'm thinking about different blockchain implementations.

Imagine that I'm creating a private specialized network that will process complex contracts.

Would there be any way that I could store contratcs outside the blockchain and just reference them in the transactions?
Of course. You can do anything with your own blockchain but such a thing doesn't exist in the bitcoin blockchain.

YarkoL
Legendary
*
Offline Offline

Activity: 996
Merit: 1012


View Profile
March 16, 2016, 08:37:23 AM
 #6


Imagine that I'll have thousands of these transactions, this would be bloating the blockchain, probably decreasing the processing capabilities of the network.

I was wondering: is there any way of mantaining these scripts as "accounts" in "script wallets" and not storing it inside the blockchain?

When there is need for validation, I could simply retrieve this script form the "wallet" and check the transaction.

How would it be possible?

You could receive the incoming payments as ordinary p2pkh transactions
to an address that automatically collects the inputs into larger sums and forwards them as
multisig transactions.

“God does not play dice"
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!