Retirement tax questions

Thank you for the response. You mention that "You have a capital gain when you sell for more than your purchase price". What if I sell not all the bitcoins, but only an amount equal to the value I invested (Eg. if I invested $1000, I am withdrawing only $1000 and the remaining bitcoins are kept in the exchange). Do I need to pay tax still? Also, as per the substantial presence test, I am considered resident for tax purposes.