Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - theoretical

Pages: 1 2 [3] 4
31
We are operating BTSX as a DAC banking firm.  Human participants include depositors (BitAsset holders), shareholders (BTSX holders), and management (delegates).  AFAICT no human has access to a complete and reliable income statement or balance sheet for two of the DAC's main activities (BitAsset yield and interest on shorts; the latter has not yet been launched).  Why this makes me uneasy should be obvious.

To be clear, I do not think BTSX is in danger of insolvency anytime soon [1].  Rather, I think the network is tying up more funds than it needs to, for longer periods than it needs to, with little transparency as to the amount or intended purpose of the funds which are tied up [2] [3].

Sending a bunch of BitUSD into an accounting rabbit hole for a year is not the best use of that BitUSD, compared to the alternatives:  Paying to longs as yield, auctioning off as interest in a BitBond market to tie up a much larger sum of investor BitUSD, or buying up and burning BTSX.

I believe there are two justifications for letting this situation happen:

- It is desirable to hold some BitUSD in reserve for policy purposes, such as buffering yields to make them less "lumpy" in order to cater to BitAsset holders' preferences for stable, accurate yield projections (and defeat certain technical trading strategies), or an FDIC fund to get rid of underwater shorts.
- Implementation is done at the "micro-level" of individual long balances and short positions.  Exact "macro-level" computations which maintain continuously updated sums of the micro-level activity of O(n) positions undergoing O(m) updates using O(m*log(n)) or less computational resources, is a hard technical engineering problem.

To these I would reply:

- Under the current implementation, policy funds may end up grossly under- or over-capitalized with respect to how much is needed to achieve their intended objectives.  Regardless of whether we as policymakers decide a sufficient FDIC would be 1%, 5%, 10%, 20%, or 50% of existing BitUSD, it would be an incredible coincidence if the reserve developed by the yield implementation reached an equilibrium near the desired reserve level under most market conditions.  (Unless the yield fund was specifically designed to do so, of course.)
- In various forum posts and whitepapers, I've published macro-level algorithms that solve the engineering problems of how to implement efficient macro-level computations.

[1] The much-discussed case of "black swan" price movements that put too many shorts too far "underwater" is always a possibility, but I won't discuss that further here.

[2] Specifically, there are gross approximations in the yield fund computations that result in an enormous percentage of the yield fund being untouchable -- BitUSD holders could not access most of the fund even if everyone claimed yield in the next block.  Similar approximations are planned for the currently proposed implementation of shorts paying interest to longs.

[3] A while ago I posted somewhere on this forum some back-of-the-envelope calculations about what the amount of untouchable BitUSD may be for the yield fund.  While the amount of untouchable BitUSD could, in principle, be determined from the blockchain, AFAIK nobody has actually done this calculation and published the result.

32

This is a small series of ~5 posts.  I invite you to read each one on its own, then stop and think about the post's final thought for a minute before moving on to the next post.

Example from new system:
You use (tie up) $10,000 worth of BTSX to post a large collateral to short 1,000 bitUSD into existance (at par)… 15mins later someone offers for sale 1,000 bitUSD for $970… would you cover?

Sure why not, you just made $30 in 15 mins, and you can get right back to the front of the shorting line by putting up your big collateral again.  If you have a robot doing this you are making $120/ hr.

This comment made me think of a little story.

Alice has $1000 worth of BTSX and she wants to go short $1000 BitUSD at a 2x collateral ratio.  Bob wants to buy BitUSD at the feed price.  But Bob always buys from deep-pocketed Dan instead of Alice, because Dan has more money than Bob and is willing to offer all of it at a 9.99x collateral ratio.

So Alice calls her rich friend Carrie, and upon seeing Alice's business plan (short $1000 BitUSD), Carrie agrees to loan Alice $8000 worth of BTSX.  Combining Alice's $1000 cash with creditor Carrie's $8000 loan, Alice can successfully compete with Dan:  Including Bob the BitUSD buyer's purchase price of $1000 worth of BTSX, the total collateral is $10000 worth of BTSX, Alice now has a 10x ratio that narrowly out-competes Dan's offer.

Giving friends discounts in business deals is against Carrie's religion.  So the interest rate Carrie will charge Alice depends on the risk in Alice's business plan.  But all the credit rating agencies say that, based on Alice's business plan, her possibility of default is very very small.  Especially if the loan has a clause allowing Carrie to margin call the debt and force liquidation if Alice's equity in the deal starts to get dangerously low.

So Carrie is willing to offer the loan to Alice at very good interest rate, and everybody's happy (except for Dan who's just been out-competed, but hey, it's a free market so that's okay).

However, there is one small problem, which I'll explain in the next post...

33
The max short holding period [1] will greatly improve the ease of implementation of shorts paying yield to the longs.  Let's discuss my proposed implementation:

Figure out the monthly yield rate r, I will use r = 1% for examples because it is easy to work with.  How the value of r should be determined is a totally separate issue that I will not address in this post.

When a short starts out, its USD liability will internally be set to (1+r) times the BitUSD given to the buyer.  The extra BitUSD will go into a network-controlled "short yield fund".  In exchange, the short position will get a "short yield fund claim note" with a face value equal to the extra BitUSD.  The claim note is a network-enforced promise from the short yield fund with the following terms:

Code: [Select]
If the attached short position is liquidated after t months, this claim note shall be redeemed for 1-t times its face value.

Shorting 100 BitUSD at 30 BTSX / BitUSD at the minimum collateral ratio would then result in the short position's balance sheet looking like this:

Code: [Select]
Assets                                          Liabilities
Collateral                  6000 BTSX           Promise to repay        101 BitUSD
Claim note                   1-t BitUSD         Short holder equity     ???

The columns must balance.  This allows us to solve for the short holder's equity:

Code: [Select]
101 BitUSD + short_holder_equity = 6000 BTSX + (1-t) BitUSD
->           short_holder_equity = 6000 BTSX - (100+t) BitUSD

Moreover the short yield fund's books are very simple.  The decrease over time of the value of claim notes issued by the fund will generate income for the fund.  This income will occur at an easily computable linear rate that only changes when new shorts are executed or existing shorts cover.  This income can go directly into the yield fund payable to longs every block.  No unbacked BitUSD are ever printed; every BitUSD is at all times backed by a collateralized short promise.

It should be emphasized that the short yield fund and claim notes are an internal book-keeping mechanism.  The user interface should simply show the BitUSD required to cover (in the example, 101 BitUSD minus the claim note's current value) at any given time.  So after 0.75 months for example, the user covers with 100.75 BitUSD, the claim note is redeemed for 0.25 BitUSD.  The total of 101 BitUSD then satisfies the Promise to Repay 101 BitUSD.

We may wish to change the margin call price and minimum collateral requirement computations to be based on 101 BitUSD instead of 100 BitUSD, especially if the mechanism for setting r is some algorithm that could potentially set a high value for r.

[1] https://bitsharestalk.org/index.php?topic=9512.0

34
The system's current implementation relies more heavily on feeds than the original design.  Frequent publishing of feeds will increase the stability and integrity of the system.

However, AFAIK currently delegates must pay a transaction fee to publish a feed.  I think a delegate who has published fewer than, say, 200 feed updates in the past 72 hours should be able to publish a feed update for free (no tx fee).

The quota should be high enough to allow delegates to allow rapid response in volatile market conditions, but low enough that all delegates regularly filling their quotas would still use only a negligible amount of blockchain storage.

Scripts should still defer publishing updates due to tiny price movements, to conserve quota which can be "bursted" if a volatile condition occurs later.

Thoughts?

35
General Discussion / Someone please tell DACsunlimited not to use MD5
« on: September 28, 2014, 08:07:38 pm »
Anyone who uses the BitShares client is trusting their money to the maintainers' cryptography skills.

Signing releases with MD5 does not inspire confidence in those skills.

For security, it is necessary to use an up-to-date hash algorithm like sha256sum.  MD5 is insecure; it has a history of published vulnerabilities and successful practical collision attacks.

Using an up-to-date algorithm is not sufficient to guarantee security.  An attacker with the capability to replace the binary download with a malicious file would also be able to replace the hash.  The hash MUST be signed with a trusted public key!

Here is how releases should be signed:

Code: [Select]
$ sha256sum BitSharesX-0.4.18-x64.exe | tee BitSharesX-0.4.18-x64.exe.sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  BitSharesX-0.4.18-x64.exe
$ bitshares_client
>>> wallet_sign_hash drltc "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
"20db75781b52d8830b1eb080fc0f130bce8ce76d0cf1b04a4a00a589404085675b2afc812c9847d1656e0504b6bc0a33f2a4f62671a585c1eec6b5f65cb7ef4b1d"

Then publish the two hex values above.  (For convenience, we put the first number in a file.)  To check, you can run:

Code: [Select]
$ sha256sum -c BitSharesX-0.4.18-x64.exe.sha256sum
BitSharesX-0.4.18-x64.exe: OK
$ bitshares_client
>>> blockchain_verify_signature drltc "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" "20db75781b52d8830b1eb080fc0f130bce8ce76d0cf1b04a4a00a589404085675b2afc812c9847d1656e0504b6bc0a33f2a4f62671a585c1eec6b5f65cb7ef4b1d"
true

Note, "drltc" in the above commands should be replaced with the name of the DACsunlimited release signing account (it is an implementation detail whether to use the main DACsunlimited account for this, or a dedicated sub-account).

The second step is necessary -- an adversary offering a malicious download can compute their own hash, but cannot produce a signature for the malicious hash without access to the private key of the DACsunlimited signing account.  Which can be more thoroughly secured than access to the DACsunlimited Github account (e.g. cold storage).  I was going to post this last night, but I noticed that you can't actually do the last step with the current client version because there is no blockchain_verify_signature command.  I fixed it in this pull request:  https://github.com/BitShares/bitshares_toolkit/pull/822

We should also work on making builds reproducible, so anyone can verify that the released executable was generated from the published source code without any malicious modifications.  But this will likely need more than a single Saturday evening of development time.

36
General Discussion / Feature request: More detailed upgrade notes
« on: September 22, 2014, 12:41:21 am »

Users are frustrated by the lack of communication surrounding the new v0.4.16 shorting mechanics:

yea it would be nice to know things like this BEFORE or at least once they are implemented......idk maybe under some kind changes to this version or something like that.

I realize developer time is at a premium, but there should be some official announcement channel to tell us about the changes in upcoming Mandatory Upgrades [1], such as the new shorting mechanics.

I am aware of two existing channels for this purpose, but one of them does not mention short issues at all [2], and the other merely says "Revised consensus market engine shorting mechanics" [3].

If we want traders and investors to take our markets seriously and make investments in our ecosystem, we need to provide a channel to tell them about major changes like this one.  Without requiring them to wade through many pages of irrelevant forum discussion, of which only a small handful of posts will contain accurate, up-to-date information.

IMHO such a channel should have an RSS feed and anyone should be able to submit improvements to the descriptions, but the description should be approved by the developers for accuracy, brevity and clarity before it can be posted.  I like the idea of using a Github repo with version-controlled Markdown files and accepting pull requests.  But a wiki, forum thread, or documentation file(s) in the main BitShares repo would also be reasonable choices.

My post in the pre-change discussion [4] or the help that I gave to the above frustrated user [5] contains the sort of description of the mechanics I'm thinking about.  But before the project adopts content from either of those posts as an official or semi-official description of how the system works, I would want the description to be reviewed for accuracy by bytemaster, vikram or another developer who's actually written or reviewed the patches which implement the new mechanics.

[1] The term "Mandatory Upgrade" is preferred to "Hardfork" for marketing reasons.

[2] https://bitsharestalk.org/index.php?topic=7067.30

[3] https://github.com/dacsunlimited/bitsharesx/releases

[4] https://bitsharestalk.org/index.php?topic=9029.msg117125#msg117125

[5] https://bitsharestalk.org/index.php?topic=9159.msg118819#msg118819

37

The current yield computation is very crude.  The approximations result in a very low yield compared to "exact" computations.

If we pay 0.01% to everybody whenever the yield fund accumulates to a level where we can afford to do so, what would happen?

I have a feeling this would be very easy to implement and keep the level of network equity in the yield fund to a minimum [1] [2].  I think I have a solution to the compounding problem with this scheme as well, but that'll be a separate post.

[1] By "network equity in the yield fund," I mean "if everyone asked for their yield immediately, how much would be left over?"  I think answer to this question will always be "most of the yield fund" in the current implementation.  Meaning we hold BitUSD potential back because we could afford to pay more interest (which would attract more investors).  And we might be setting the stage for a supply-side margin crisis if shorts need to buy BitUSD to cover, but can't because too much BitUSD is tied up in the yield fund.

[2] If we think it's important to keep a reserve for macro-economic purposes other than yield, like buying up underwater shorts, we can simply set up a separate fund, and explicitly set (an algorithm to determine) its desired balance level (e.g. 10% of BitUSD in circulation).  Then divert fee income into that "macro fund" when the fund is below the desired balance, and "change the sign" of this flow when the fund's balance is above the desired level (pay a portion of the fund's balance as fees).

38

In several different threads [1] [2] [3] there are various ideas for market-driven interest rates.

In several other different threads [4] [5] [6] [7] [8] [9] people express a desire to have some on-chain support for peer-to-peer trading of BitAssets against BTC.

In one particularly contentious thread, I got into a heated discussion with bytemaster [10] about whether writing detailed specifications and analyses such as [11] [12] [13] [14] is something that should be rewarded with I3 funds.  (The outcome of that discussion was that both bytemaster and I support the idea of rewards-after-the-fact for good ideas and careful analysis.  While I have received tips from several generous community members for my work -- for which I thank them -- I still have not received anything from bytemaster, which makes me question bytemaster's commitment to the rewards-after-the-fact paradigm.)

To address all three of these issues while conserving core developer time to focus on bugfixes and stability, I think I3 should post two new bounties:  One for a market-driven interest rate scheme, and one for an automated peer-to-peer BTSX / BitAsset-to-BTC market (with possible BTSX chain modifications to support escrow.)

There should be a pre-specified split between the phases of specification (30%), analysis / pointing out attacks, corner cases, unintended consequences of a specification (20%), blockchain / CLI implementation (30%), and GUI / web wallet implementation (20%).  In the case of the implementation phases, the bounty becomes payable when the implementation is merged into official I3 and/or dacsunlimited client.  In the case of a specification, the bounty becomes payable when an implementation based on that spec is committed or merged into the official client (regardless of whether the implementation was developed by core developers or by external developers hoping for the implementation bounty).  In case more than one person works on a phase and they can't decide how to split the bounty, bytemaster has the right to make final decision and the bounty payout is reduced (by 20%) to encourage the parties to make their own consensus.  In the case of analysis, each individual problem should be worth ~10% of the analysis budget (so ~2% of the total bounty amount for each problem).

Thoughts?

[1] https://bitsharestalk.org/index.php?topic=8422.0
[2] https://bitsharestalk.org/index.php?topic=8872.0
[3] https://bitsharestalk.org/index.php?topic=7865.0
[4] https://bitsharestalk.org/index.php?topic=9031
[5] https://bitsharestalk.org/index.php?topic=8986.0
[6] https://bitsharestalk.org/index.php?topic=8762.0
[7] https://bitsharestalk.org/index.php?topic=8818.0
[8] https://bitsharestalk.org/index.php?topic=8626.0
[9] https://bitsharestalk.org/index.php?topic=8393.0
[10] https://bitsharestalk.org/index.php?topic=8372
[11] https://github.com/drltc/bitbond-proposal/blob/master/airdrop.md
[12] https://github.com/drltc/bitbond-proposal/blob/master/bitbond.md
[13] https://github.com/drltc/bitbond-proposal/blob/master/btc-trade.md
[14] https://github.com/drltc/bitbond-proposal/blob/master/interest-0.4.13.md

39
General Discussion / Feature request: Private airdrops
« on: September 16, 2014, 06:00:11 am »

Some users proposed airdropping user-issued BitAsset FREE [1] to some other coin.

I realized it would be technically possible to support "Private airdrops" with some additions to the blockchain code.  Basically this would involve allowing anyone to help fund an airdrop by sending BTSX or BitAsset(s) to what I call a "dividend address" for that airdrop, which is basically a Merkle hash -- a single 20-byte value representing a snapshot of the Dogecoin blockchain (or some other altcoin) at some point in time.

Anyone with a Dogecoin wallet would then be able to publish a proof to the BTSX blockchain showing how much they owned at the snapshot (which we can verify with the Merkle hash).  The proof functions as a claim against the funds sent to the dividend address.  After some pre-set time elapses, like two weeks, the network stops allowing new funds to be sent to the dividend address, and anyone who published a claim can take their share of the airdrop -- proportional only to other claims.

You can read all the technical details in [2], including an extension allowing the transaction fees to be pre-paid by the airdrop, so people with only Doge could publish their claims to the blockchain without having to buy BTSX from an exchange.

[1] https://bitsharestalk.org/index.php?topic=8858.0
[2] https://github.com/drltc/bitbond-proposal/blob/master/airdrop.md

40

I'm very slowly working on the bounty for documenting the blockchain format.

In order for me to be sure I understand it, I'm writing a parser for the raw block format in Python.  You can see it in action at http://bitblockexplorer.com:8888/block/55555?format=html+hex

The website is obviously very raw and untested.  There is absolutely no processing of transactions or signatures.  Someone else has a better blockchain website (I can't remember the URL offhand), and there is of course a block explorer in the client code.

But I think all of them work internally by calling into the JSON-RPC API of the client.  The internal setup of bitblockexplorer.com is a little different -- I communicate "at arms' length" with the BitShares client by using the chain server protocol to download the raw binary block data, which I then parse into a database.

41

As a result of a market order being filled, I see this in my tx history via wallet_account_transaction_history:

    |2014-09-11T15:34:03 458522    BID-3728b667        MARKET              0.10001000 BTC          pay bid @ 0.000081967213114754 BTC / BTSX   0.00000 BTSX        [6212bd]|

The first thing I noticed is that the time is wrong, for which I've filed an issue already.

My question to this forum is:  What do I do with [6212bd]?  I have tried:

Code: [Select]
>>> blockchain_get_transaction 6212bd
null
>>> blockchain_get_transaction [6212bd]
0 exception: unspecified
Invalid hex character '['
    {"c":"["}
    th_a  hex.cpp:13 from_hex

    {}
    th_a  common_api_client.cpp:163 blockchain_get_transaction

    {"command":"blockchain_get_transaction"}
    th_a  cli.cpp:537 execute_command

I want to make sure I'm not missing something obvious before I file another ticket and bother the developers.

42

Trying to cover a BitBTC margin with the GUI, I get "unknown market order (20011) Cannot find that market order".  The order shows briefly pending, then reverts and doesn't cover.  (Fortunately I got my BitBTC back.)

Anyone else seeing that problem?

Here is my version info:

Code: [Select]
{
  "bitshares_toolkit_revision": "aa333b28d4dda0a7f627ba8166da7229c9c5d7ff",
  "bitshares_toolkit_revision_age": "28 hours ago",
  "fc_revision": "55e7a073cf7ab19b88f90ffceba24c70e0c7b1c4",
  "fc_revision_age": "29 hours ago",
  "compile_date": "compiled on Sep 10 2014 at 11:54:31"
}

43
General Discussion / drltc's analysis of various yield implementation issues
« on: September 10, 2014, 06:49:57 am »

I have posted at https://github.com/drltc/bitbond-proposal/blob/master/interest-0.4.13.md an analysis of 0.4.13 yield changes, along with a few proposed modifications to the (approximate) 0.4.13 yield algorithm which should make it much less approximate without making the devs work too hard :)

My most important algorithmic insight, however, is that an implementation of "exact" yield need not be as resource-intensive as bytemaster currently believes.  So I'll copy-paste my explanation in its entirety as the opening post of this thread, in hopes that will make it less likely to be missed (as I can scarcely blame others for failing to read threads beyond the first three pages when I seldom do so myself):

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

Yes.  It would greatly increase database size and transaction processing time.  I know how to "do it proper" from the original dividends design for BTSX.  It requires an accumulation table that must be updated every block for 1 years worth of blocks. 


I'm guessing bytemaster wants to save the product between b[m] and b[n] for all pairs of blocks m, n.  I posted how to avoid this earlier in this thread (four word answer: partial sum skip list), but I'll go into more detail since both of you apparently missed (or misunderstood) that post.

I propose using sums of logarithms instead of multiplying (so we can do many-block sequences without worrying too much about various approximation issues).  Then only save partial sums that are aligned power-of-two length.  So you save (in your notation):

Code: [Select]
run(m,  1) = f_m                                     # for all blocks
run(m,  2) = f_m + f_{m+1}                           # for every 2nd block
run(m,  4) = f_m + f_{m+1} + f_{m+2} + f_{m+3}       # for every 4th block
run(m,  8) = f_m + f_{m+1} + f_{m+2} + f_{m+3} + f_{m+4} + f_{m+5} + f_{m+6} + f_{m+7}
                                                     # for every 8th block, etc... for every power of 2

If total number of blocks is N, this data structure needs at most 2N-1 entries (hint: total size is a geometric series).

So if you want to find e.g. the sum of logs from 0x7159 (inclusive) to 0x1258a (exclusive), you can compute that as:

Code: [Select]
run(0x7159, 1) + run(0x715a, 2) + run(0x715c, 4) + run(0x7160, 0x20) + run(0x7180, 0x80) + run(0x7200, 0x200) + run(0x7400, 0x400) + run(0x7800, 0x800) + run(0x8000, 0x8000) + run(0x10000, 0x2000) + run(0x12000, 0x400) + run(0x12400, 0x100) + run(0x12500, 0x80) + run(0x12580, 8) + run(0x12588, 2)

The proper bit twiddling operations to implement this are left as an exercise to the reader.

Updating a block will usually be fast, requiring only the last few blocks.  Block heights divisible by large powers of 2 will happen and reach higher in the blockchain (on an exponentially rare basis), but in all cases at most log(N) values need be saved, each of which requires at most log(N) time.  (I think the actual bound is just log(N) instead of log(N)^2 because you re-use the tail part and only need to reach back one more entry, but log^2(N) is still fast enough.)


44
General Discussion / Bids not executing against shorts
« on: September 08, 2014, 06:36:51 pm »

I made a short at the top of the book, 26.75 which was above median and average price.  The short showed up in the GUI order list confirming it is OK price-feed-wise.

Then I made a bid for the same quantity at price of 26.7501.  The bid did not execute.  Why?

45
General Discussion / drltc's interest rate and BitBond proposal
« on: September 06, 2014, 06:22:58 am »

I've put my response to bytemaster's latest interest proposal in a whitepaper on Github.  Available at https://github.com/drltc/bitbond-proposal/blob/master/bitbond.md

Basically the conclusions are:

- bytemaster's proposal will sink BitUSD decentralization by making BitUSD non-fungible
- Fixed interest rate on BitUSD is important for marketing reasons
- A mechanism to reverse BitUSD destruction and return BitUSD-denominated fees to circulation is necessary to prevent a margin crisis if we get into a situation where too many BitUSD have been destroyed
- Market-determined variable interest rate (bond market) is necessary to absorb randomness of fees
- Short interest is necessary to guarantee fixed interest rate
- Implementing a bond market is not too hard in practice

To this I will add in a future revision:

- A highly USD-correlated, cryptocurrency-based bond market is a "killer app" that will drive (currently anemic) BitUSD demand through the roof, and BTSX valuation along with it.

Pages: 1 2 [3] 4