-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coloredcoinlib: implement bitfield-tagged color kernel demo1 #27
Comments
Looked at it, understand the task. Starting to work on it now. Holding task for another 24 hours. |
working on this now |
first attempt: maraoz@bdb8e7c |
The second version:
Possible exceptional situations:
If exceptional situation is detected, we return a list of null colorvalues. (Note that we inspect only nSequence field only for inputs which have non-null colorvalue, other inputs are ignored.) At this step we have total colorvalue for each output group.
|
Great! I'll look into this |
Alex, some questions:
|
I believe it should be all-or-nothing: if validation fails, no coins are transferred. I believe it is more consistent and it is easier to recover if failure is consistent. Say, if you were transferring ownership of shares, malformed transaction would mean that transfer failed. That is, legally you still own shares, but you can no longer transfer them using coins you have. Issuer might offer to fix this problem by sending replacement shares, for example. Partial transfer only makes things worse.
OBC and POBC require fixed svalue/colorvalue ratio (e.g. one satoshi per atom of colored coin). This means that higher precision requires more satoshi to be used, and so it is more expensive. Additionally, POBC requires fixed-size padding, which might become expensive at some point. But it is possible to make it adjustable: people might want to adjust it depending on price of Bitcoin, dust limit and precision they'd like to achieve. We want factor to be of form 2^n to avoid problems with infinite precision arithmetic. So, basically, in case with OBC we need 10000 satoshi per unit (due to dust limit), and it remains that way forever But in case with bitfield-tagging it can be chosen for each transaction. E.g. currently one unit might be represented with 2^13=8192 satoshi. (n=13). If min fee is slashed in half, one can choose 2^12=4096 satoshi per unit and so on. |
ACK. Starting with this. |
BFTColorDefinition inherits from ColorDefinition
For the first version we need only run_kernel, but no compose_tx_spec functions.
The idea:
nSequence of an transaction input (unused 32-bit integer) is used a a bit field which shows where colored coins from this input go.
For the demo1 version, we will only consider cases where nSequence has only 1 bit set.
So algorithm is this:
Note that CTransaction from coloredcoinlib/blockchain.py doesn't give you an access to nSequence, but tx.raw gives you access to CTransaction from bitcoin/core.py, which has all the data.
In demo2 we will cover the case where more than one bit is set...
The text was updated successfully, but these errors were encountered: