Bitcoin Forum
July 24, 2019, 03:25:06 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 »  All
  Print  
Author Topic: Blockchain security tracking/colored coins/smart contracts - short python script  (Read 8680 times)
yoniassia
Newbie
*
Offline Offline

Activity: 42
Merit: 0



View Profile WWW
October 13, 2012, 07:07:51 AM
 #21

Could you suggest the code changes for this script to support order based ?
1563938706
Hero Member
*
Offline Offline

Posts: 1563938706

View Profile Personal Message (Offline)

Ignore
1563938706
Reply with quote  #2

1563938706
Report to moderator
1563938706
Hero Member
*
Offline Offline

Posts: 1563938706

View Profile Personal Message (Offline)

Ignore
1563938706
Reply with quote  #2

1563938706
Report to moderator
1563938706
Hero Member
*
Offline Offline

Posts: 1563938706

View Profile Personal Message (Offline)

Ignore
1563938706
Reply with quote  #2

1563938706
Report to moderator
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1563938706
Hero Member
*
Offline Offline

Posts: 1563938706

View Profile Personal Message (Offline)

Ignore
1563938706
Reply with quote  #2

1563938706
Report to moderator
1563938706
Hero Member
*
Offline Offline

Posts: 1563938706

View Profile Personal Message (Offline)

Ignore
1563938706
Reply with quote  #2

1563938706
Report to moderator
killerstorm
Legendary
*
Offline Offline

Activity: 994
Merit: 1000



View Profile
October 13, 2012, 10:22:03 AM
Last edit: October 13, 2012, 02:07:32 PM by killerstorm
 #22

A relatively easy approach to handle multiple inputs, and particularly a mix of colored and uncolored inputs, in setting like one used in this script is:

  • Get a list of "potentially colored transactions".
  • Sort it in such a way that dependencies never appear after dependent transactions. (This is known as 'toposort'.)
  • Go through this list of transactions in order and identify all colored outputs. (When we scan transaction we already know which of its inputs are colored and thus it is easy to identify colored outputs.)

This script already has a recursive traversal function (called rec), with some modifications it can be used to identify 'potentially colored transactions'. Moreover, if it produces such list via "reverse postordering", list will be dependency-sorted, see here: http://en.wikipedia.org/wiki/Depth-first_search#Vertex_orderings ("Reverse postordering produces a topological sorting of any directed acyclic graph.")

Then for each transaction, we can count sum of values of colored inputs and use it color an appropriate number of outputs. Additional check should be made to make sure that all colored inputs go before all uncolored.

However, there is a problem: a list of potentially colored transactions might be huge. Especially if you include uncolored outputs.

To solve this performance problem one might limit depth of DFS by block number: i.e. do this coloring process in batches, block by block or something like that. Whenever you see a transaction in a block too far ahead, simple ignore it, it will be considered later. This works because transactions in later blocks cannot affect transactions in earlier blocks.

colored coins proof-of-concept: private currencies, stock/bond p2p exchange

Tips and donations: 16v13Fa9cPmfFzpm9mmbWwAkXY4gyY6uh4
matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 13, 2012, 07:13:23 PM
 #23

As long as the shareholders don't massively disagree I'm going to offer out a 0.5% ownership of the former GLBSE mining stock/asset RSM - (https://bitcointalk.org/index.php?topic=63257.0) - That works out currently as ownership of 0.9(GH/s) of BFL-SC-Singles although we will be saving 50% of profits towards buying more ASIC's to increase the (MH/s) per share ratio.  For you to implement this idea and maintain it.  You wont receive the coloured coins relating to that 0.5% that will be held in a separate account managed by me but you will receive all profits made from 0.5% ownership as long as you maintain the code.  I've also offered this bounty to this coloured coins project too - (https://bitcointalk.org/index.php?topic=106373.0) - so the first/best implementation will win the bounty.  We don't need to use the coloured coins for about another month yet when we receive our first BFL-SC-Single.

matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 13, 2012, 11:57:23 PM
 #24

Is there anyway this idea could be used to hold motions/voting weighted off coloured coins ownership?

killerstorm
Legendary
*
Offline Offline

Activity: 994
Merit: 1000



View Profile
October 14, 2012, 12:04:20 AM
 #25

Is there anyway this idea could be used to hold motions/voting weighted off coloured coins ownership?

Yes. Owners of colored coins can sign messages with private keys corresponding to addresses which hold colored coins.

issuer, or perhaps some third party, would then collect these messages and check that they indeed come from owners of coins, i.e. shareholders.

People might post these signed messages on forum to make voting public.

colored coins proof-of-concept: private currencies, stock/bond p2p exchange

Tips and donations: 16v13Fa9cPmfFzpm9mmbWwAkXY4gyY6uh4
jgarzik
Legendary
*
Offline Offline

Activity: 1554
Merit: 1005


View Profile
October 14, 2012, 12:13:26 AM
 #26

Is there anyway this idea could be used to hold motions/voting weighted off coloured coins ownership?

Yes.  The issuer may determine what public key currently controls a colored coin.  That is the only information present in the public blockchain data.

It is obvious that voting is possible:  a colored coin holder may use the 'signmessage' feature to sign any arbitrary text using their bitcoin ECDSA keys.

Let us assume that a colored coin has been sent to bitcoin address 1ABCD1234ABCD1234.

1. A public notice of voting is posted <somewhere>, of a vote.  This notice includes a sample ballot, a simple text message format.
2. The owner of 1ABCD1234ABCD1234 downloads the sample ballot, edits it to reflect their vote, and then uses the 'signmessage' RPC to add a cryptographic signature.
3. The owner of 1ABCD1234ABCD1234 emails the signed ballot to voting@mycompany.com, or maybe, voting@thirdpartyballotservice.com.
4. The bond issuer, or 3rd party vote tabulation service, looks at the blockchain to verify that the email just received is signed by the holder of public key 1ABCD1234ABCD1234, and that 1ABCD1234ABCD1234 does indeed still control the colored coin.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 14, 2012, 12:40:51 AM
 #27

Is there anyway this idea could be used to hold motions/voting weighted off coloured coins ownership?

Yes.  The issuer may determine what public key currently controls a colored coin.  That is the only information present in the public blockchain data.

It is obvious that voting is possible:  a colored coin holder may use the 'signmessage' feature to sign any arbitrary text using their bitcoin ECDSA keys.

Let us assume that a colored coin has been sent to bitcoin address 1ABCD1234ABCD1234.

1. A public notice of voting is posted <somewhere>, of a vote.  This notice includes a sample ballot, a simple text message format.
2. The owner of 1ABCD1234ABCD1234 downloads the sample ballot, edits it to reflect their vote, and then uses the 'signmessage' RPC to add a cryptographic signature.
3. The owner of 1ABCD1234ABCD1234 emails the signed ballot to voting@mycompany.com, or maybe, voting@thirdpartyballotservice.com.
4. The bond issuer, or 3rd party vote tabulation service, looks at the blockchain to verify that the email just received is signed by the holder of public key 1ABCD1234ABCD1234, and that 1ABCD1234ABCD1234 does indeed still control the colored coin.



Cool, sounds complex but I'm sure it could be built into the new altered wallet and made simple enough.

Another question while I'm still trying to grasp the concept.  The initial creation of the coloured coins is stored in the blockchain of the wallet that created them.  Is it very important the record of this genesis creation/transaction of the coloured coin is kept?  If so how does this individual colour marked blockchain be distributed?  Or does each wallet just keep its own new colour marked blockchain from receipt of the coloured coins to prove ownership?

jgarzik
Legendary
*
Offline Offline

Activity: 1554
Merit: 1005


View Profile
October 14, 2012, 01:43:38 AM
 #28

Another question while I'm still trying to grasp the concept.  The initial creation of the coloured coins is stored in the blockchain of the wallet that created them.  Is it very important the record of this genesis creation/transaction of the coloured coin is kept?  If so how does this individual colour marked blockchain be distributed?  Or does each wallet just keep its own new colour marked blockchain from receipt of the coloured coins to prove ownership?

There is only one blockchain, the public blockchain.

Let me try to draw an analogy:

Every US dollar has a serial number on it.  The US dollar version of colored coins would be analogous to: "the holder of $20 bill with serial number ABCD1234 owns Chevrolet Corvette VIN 137YA9031WE239523"

Colored coins says "bitcoin ABCD1234", whatever its value, is somehow more special than regular bitcoins.

This requires special software for the bond issuer and the bond holder, both, that recognizes bitcoin ABCD1234 as special.  This is simply an agreement enforced (or not) by running special software.

The bond issuer runs software that searches for the current public key holding ABCD1234, and pays dividends to that public key.  The bond issuer does not know or care who is the owner.

The bond holder runs software that stores ABCD1234 in a special wallet, separate from other bitcoin wallets.  This guarantees that the bond holder does not accidentally spend their "special" coin accidentally -- analogous to accidentally giving a rare coin to a vending machine for soda.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 14, 2012, 02:24:52 AM
 #29

Another question while I'm still trying to grasp the concept.  The initial creation of the coloured coins is stored in the blockchain of the wallet that created them.  Is it very important the record of this genesis creation/transaction of the coloured coin is kept?  If so how does this individual colour marked blockchain be distributed?  Or does each wallet just keep its own new colour marked blockchain from receipt of the coloured coins to prove ownership?

There is only one blockchain, the public blockchain.

Let me try to draw an analogy:

Every US dollar has a serial number on it.  The US dollar version of colored coins would be analogous to: "the holder of $20 bill with serial number ABCD1234 owns Chevrolet Corvette VIN 137YA9031WE239523"

Colored coins says "bitcoin ABCD1234", whatever its value, is somehow more special than regular bitcoins.

This requires special software for the bond issuer and the bond holder, both, that recognizes bitcoin ABCD1234 as special.  This is simply an agreement enforced (or not) by running special software.

The bond issuer runs software that searches for the current public key holding ABCD1234, and pays dividends to that public key.  The bond issuer does not know or care who is the owner.

The bond holder runs software that stores ABCD1234 in a special wallet, separate from other bitcoin wallets.  This guarantees that the bond holder does not accidentally spend their "special" coin accidentally -- analogous to accidentally giving a rare coin to a vending machine for soda.



As I'm looking at issuing coloured coins based on the ownership of over $4,000 of ASIC's how do I prove ownership of the issued coloured coins permanently taking into account of hardware failures.

jgarzik
Legendary
*
Offline Offline

Activity: 1554
Merit: 1005


View Profile
October 14, 2012, 04:19:41 AM
 #30

As I'm looking at issuing coloured coins based on the ownership of over $4,000 of ASIC's how do I prove ownership of the issued coloured coins permanently taking into account of hardware failures.

The most important concept to remember is that colored coins are like rules of the road:  they only work because everybody agrees on what side of the road to drive.  There is no law of physics preventing cars from driving in the opposing lane of traffic.  There is no software rule preventing you from using your colored coins to buy Alpaca socks at a web shop.

The basic process works like this:

1. Publicly declare a list of coins in the existing blockchain as colored.
2. Transfer the colored coins to their new owners.  These new owners may freely transfer them to other owners.
3. If the colored coin transfer follows the Colored Coin Rules(tm), software may search the blockchain, and precisely identify the list of colored coin holders.
4. If the colored coin transfer does not follow the Colored Coin Rules(tm), then that person is essentially "burning the money", by making it impossible to track the colored coin beyond a certain point.

It is up to each colored coin owner to keep track of their own public keys.  All other information is stored in the public blockchain.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1010


View Profile
October 14, 2012, 04:44:49 AM
 #31

As I'm looking at issuing coloured coins based on the ownership of over $4,000 of ASIC's how do I prove ownership of the issued coloured coins permanently taking into account of hardware failures.

The most important concept to remember is that colored coins are like rules of the road:  they only work because everybody agrees on what side of the road to drive.  There is no law of physics preventing cars from driving in the opposing lane of traffic.  There is no software rule preventing you from using your colored coins to buy Alpaca socks at a web shop.

The basic process works like this:

1. Publicly declare a list of coins in the existing blockchain as colored.
2. Transfer the colored coins to their new owners.  These new owners may freely transfer them to other owners.
3. If the colored coin transfer follows the Colored Coin Rules(tm), software may search the blockchain, and precisely identify the list of colored coin holders.
4. If the colored coin transfer does not follow the Colored Coin Rules(tm), then that person is essentially "burning the money", by making it impossible to track the colored coin beyond a certain point.

It is up to each colored coin owner to keep track of their own public keys.  All other information is stored in the public blockchain.



I think a better version of rule 4 should be: If the colored coin transfer does not follow the Colored Coin Rules(tm), the last owner retains the extra value of the colored coin. (i.e. the last owner will still receive dividend etc.) However, that person may no longer transfer the extra value to other owners. The issuer may re-issue a new colored coin to the last owner to replace the burnt one, with or without service fee charged.

This will prevent most "money burning accident".

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
bitfair
Sr. Member
****
Offline Offline

Activity: 362
Merit: 250


View Profile
October 15, 2012, 01:29:47 PM
 #32

Update

A new version of the script has been posted, and OP has been updated with a usage example that showcases the current capabilities of the program.

The main new feature is the possibility to pay dividends from your wallet to the holders of colored coins.

Enjoy!
bitfair
Sr. Member
****
Offline Offline

Activity: 362
Merit: 250


View Profile
October 15, 2012, 01:49:42 PM
Last edit: October 15, 2012, 02:24:09 PM by bitfair
 #33

I'd like to thank the big brains for weighing in here in this thread.

With the script now working "as I originally had in mind", I am now very keen on making improving the script and making it compatible with the approaches discussed by the venerable mr. killerstorm and sir jgarzik. However, there are so many long threads at this point that I don't have time to dig through the coal to find the diamonds, so if anyone can point to a whitepaper, a spec, a particularly enlightening post, preferably showing examples of transactions and how the color should be interpreted in the input/output for various approaches, then I would be very grateful. A deconstructed example of for instance 2 colored+2 uncolored inputs should be pretty comprehensive - anyone seen such a thing?

But first, I would like to invite matthewh3 - as the only "asset issuer" that has weighed in so far - to describe a little more in detail what features he is looking for.

Update: I've been reading up on the discussion ,and it seems that the consensus is something like this: https://bitcointalk.org/index.php?topic=106449.msg1203918#msg1203918, so I intend to try following those rules (until problems start surfacing).
jgarzik
Legendary
*
Offline Offline

Activity: 1554
Merit: 1005


View Profile
October 15, 2012, 02:04:44 PM
 #34

PS. Thank you for using 'sendmany'  It helps keep blockchain bloat to a minimum.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
allten
Sr. Member
****
Offline Offline

Activity: 450
Merit: 250


You Don't Bitcoin 'till You Mint Coin


View Profile WWW
October 15, 2012, 03:08:49 PM
 #35

There's a bounty available:
https://bitcointalk.org/index.php?topic=106373.msg1269388#msg1269388

I'm hoping the main group of people pushing for the development of this technology will
post a link to this bounty to inspire others to donate as well.

This is really great stuff and I'm very excited to see where it will go.
matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 15, 2012, 03:21:00 PM
 #36

It'd be good if the coloured coins could be held in one blockchain.info wallet and dividends paid to any of the coins owners choosing.  Also what keep's the proof of the coloured coins?  If it's just your 'short python script' on my machine then I need a way to back proof up online and to be able to distribute it to each coloured coin owner.  Sorry if that sounds stupid and/or I've missed the point, still trying to figure this all out.

matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 15, 2012, 03:31:24 PM
 #37

There's a bounty available:
https://bitcointalk.org/index.php?topic=106373.msg1269388#msg1269388

I'm hoping the main group of people pushing for the development of this technology will
post a link to this bounty to inspire others to donate as well.

This is really great stuff and I'm very excited to see where it will go.

I've also put a bounty up in this thread and the other thread - https://bitcointalk.org/index.php?topic=117630.msg1270041#msg1270041

jgarzik
Legendary
*
Offline Offline

Activity: 1554
Merit: 1005


View Profile
October 15, 2012, 03:57:30 PM
 #38

It'd be good if the coloured coins could be held in one blockchain.info wallet and dividends paid to any of the coins owners choosing.  Also what keep's the proof of the coloured coins?  If it's just your 'short python script' on my machine then I need a way to back proof up online and to be able to distribute it to each coloured coin owner.  Sorry if that sounds stupid and/or I've missed the point, still trying to figure this all out.

Given current bitcoin software, it is strongly advisable to keep separate wallets for smartcoins (colored coins) and regular bitcoins.  Mix the two at your peril; it is too easy to "spend away" an asset as regular bitcoins, with a single wallet.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
matthewh3
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile WWW
October 15, 2012, 04:31:35 PM
 #39

It'd be good if the coloured coins could be held in one blockchain.info wallet and dividends paid to any of the coins owners choosing.  Also what keep's the proof of the coloured coins?  If it's just your 'short python script' on my machine then I need a way to back proof up online and to be able to distribute it to each coloured coin owner.  Sorry if that sounds stupid and/or I've missed the point, still trying to figure this all out.

Given current bitcoin software, it is strongly advisable to keep separate wallets for smartcoins (colored coins) and regular bitcoins.  Mix the two at your peril; it is too easy to "spend away" an asset as regular bitcoins, with a single wallet.



Yes that was my idea to recommend use of a separate blockchain.info/wallet to asset holders as they do automatic backups to your email, Google drive or dropbox.  I understand other online wallets can't be used as they mix your coins.

Energizer
Sr. Member
****
Offline Offline

Activity: 274
Merit: 250



View Profile
October 15, 2012, 05:29:36 PM
 #40

Is it possible to force a specific transaction fee to any colored coin transaction?

For example: a transaction fee of 0.00050321

In this case the colored coin application/script should:

  • Always use such specific "fixed" transaction fee value in transferring colored coins
  • And in return, ignore "doesn't interpret" any transaction that doesn't have such "fixed" transaction fee

This way the application can guard colored coins from accidentally being spent.
Pages: « 1 [2] 3 4 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!