Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Add documentation from 'Documentation' repo #921

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Online Webwallet for [Counterparty](http://www.counterparty.io).

Originally based off of [Carbonwallet](http://www.carbonwallet.com) (however virtually all the original code has been removed or rewritten).

[Counterwallet User Documentation](./docs/index.md)


Production Systems
-------------------
Expand Down
57 changes: 57 additions & 0 deletions docs/counterwallet-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Counterwallet notes
---

## More on multiple Counterwallet servers

For the time being, the Counterparty team itself operates the primary Counterwallet platform at `counterwallet.io`. However, as Counterwallet is open source software, it is possible to host your own site with Counterwallet site (for your personal use, or as an offering to others), or to even host your own Counterwallet servers to use with your own Counterparty wallet implementation. The Counterparty team supports and encourages this kind of activity (as long as the servers are secure), as it aids with increasing decentralization.

Also note that due to the nature of Counterwallet being a deterministic wallet, users using one Counterwallet platform (i.e. the official one, for instance) have the flexibility to start using a different Counterwallet platform instead at any time, and as funds (i.e. private keys) are not stored on the server in any fashion, they will be able to see their funds on either. (Note that the only thing that will not migrate are saved preferences, such as address aliases, the theme setting, etc.)

## Counterwallet MultiAPI specifics

Counterwallet utilizes a sort of a "poor man's load balancing/failover" implementation called multiAPI (and implemented
[here](https://github.com/CounterpartyXCP/counterwallet/blob/master/src/js/util.api.js)). multiAPI can operate in a number of fashions.

### multiAPIFailover for Read API (``get_``) Operations

*multiAPIFailover* functionality is currently used for all read API operations. In this model, the first Federated Node
on the shuffled list is called for the data, and if it returns an error or the request times out, the second one on the
list is called, and so on. The result of the first server to successfully return are used.

Here, a "hacked" server could be modified to return bogus data. As (until being discovered) the server would be in the
shuffled list, some clients may end up consulting it. However, as this functionality is essentially for data queries only,
the worse case result is that a Counterwallet client is shown incorrect/modified data which leads to misinformed actions
on the user's behalf. Moreover, the option always exists to move all read-queries to use multiAPIConsensus in the future should the need arise.

### multiAPIConsensus for Action/Write (``create_``) Operations

Based on this multiAPI capability, the wallet itself consults more than one of these Federated Nodes via consensus especially
for all ``create_``-type operations. For example, if you send XCP, `counterparty-server` on each server is still composing and sending
back the unsigned raw transaction, but for data security, it compares the results returned from all servers, and will
only sign and broadcast (both client-side) if all the results match). This is known as *multiAPIConsensus*.

The ultimate goal here is to have a federated net of semi-trusted backend servers not tied to any one country, provider, network or
operator/admin. Through requiring consensus on the unsigned transactions returned for all ``create_`` operations, 'semi-trust'
on a single server basis leads to an overall trustworthy network. Worst case, if backend server is hacked and owned
(and the `counterparty-server` code modified), then you may get some invalid read results, but it won't be rewriting your XCP send
destination address, for example. The attackers would have to hack the code on every single server in the same exact
way, undetected, to do that.

Moreover, the Counterwallet web client contains basic transaction validation code that will check that any unsigned Bitcoin
transaction returned from a Counterblock Federated Node contains expected inputs and outputs. This provides further
protection against potential attacks.

multiAPIConsensus actually helps discover any potential "hacked" servers as well, since a returned consensus set with
a divergent result will be rejected by the client, and thus trigger an examination of the root cause by the team.

### multiAPINewest for Redundant storage

In the same way, these multiple servers are used to provide redundant storage of client-side preferences, to ensure we
have no single point of failure. In the case of the stored preferences for instance, when retrieved on login, the data from all servers
is taken in, and the newest result is used. This *multiAPINewest* functionality effectively makes a query across all available
Federated Nodes, and chooses the newest result (based on a "last updated"-type timestamp).

Note that with this, a "hacked" server could be modified to always return the latest timestamp, so that its results
were used. However, wallet preferences (and other data stored via this functionality) is non-sensitive, and thus user's
funds would not be at risk before the hacked server could be discovered and removed.
23 changes: 23 additions & 0 deletions docs/counterwallet-tutorials/broadcast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Broadcast information on the Bitcoin blockchain
---

Counterparty lets you publish text and data on the Bitcoin blockchain, this is called a 'broadcast'. This is useful for proof-of-publication, notary purposes, and creating betting feeds and oracles. This information is timestamped (as blocks), freely browseable and permanently stored on the Bitcoin blockchain. You can view and search broadcasts on a block explorer such as [XChain](https://xchain.io/broadcasts):

![](../../../static/img/broadcast1.png)

### How to publish a broadcast in Counterwallet

**Click address actions and Feed Broadcast.**

![](../../../static/img/broadcast2.png)

**Enter the text or data you want to publish on the BTC blockchain. Note: The fields for fee and value are only used when creating a betting feed, you can leave the default values if you only wish to publish information.**

**Note: The fields for fee and value are only used when creating a betting feed, you can leave the default values if you only wish to publish information. "Broadcast Date" (date picker) has no effect here (because timestamping is done by bitcoin miners) and may be removed in a future version.**

![](../../../static/img/broadcast3.png)

**Wait for the Bitcoin network to confirm your broadcast, and it will be visible online.**

![](../../../static/img/broadcast4.png)
58 changes: 58 additions & 0 deletions docs/counterwallet-tutorials/buy-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Buy and sell assets (tokens) on the DEx using XCP
---

This tutorial takes you through the process of buying and consequently selling a Counterparty-issued asset (or token/coin) from Counterwallet. By "Counterparty-issued" we mean "issued on the Counterparty platform by its users" as the Counterparty Project does not issue assets (XCP is the only asset that was issued by the Project).

First, let's summarize how things work:

1. All Counterparty assets can be traded on the Counterparty Decentralized Exchange and most Counterwallet sellers denominate their asset in XCP.  It is possible, but rare, to sell your asset A for another asset B, although that may be interesting in some cases. Some main advantages of decentralized crypto-exchanges are obviously decentralization (no counterparty risk) and a lower cost of filled orders.

2. Some popular Counterparty-listed assets are available on traditional (centralized) crypto-exchanges such as Poloniex and MasterXchange where they are usually available denominated in BTC. This article covers only the DEx, but just so that you know the same asset can be traded on the DEx (usually denominated in XCP) and externally (usually denominated in BTC). Some advantages of centralized crypto-exchanges include the speed of trading and usually a better liquidity. 

3. In order to buy an XCP-denominated asset, the user needs to complete the following steps:

a) Create a wallet if you already don't have one (this one is easy, but make absolutely sure to write down your pass phrase). In case you'd like to practice first, there is a testnet (a network with "fake" (test) assets) wallet ([link](https://testnet.counterwallet.co/)) where you can open two wallets and practice without any risk or cost - see [What do I need to start using Counterwallet](https://counterpartytalk.org/t/what-do-i-need-to-start-using-counterwallet/1156). It is simpler, more reliable, faster and more secure to use Counterwallet in the private browsing mode (in Chrome, CTRL+SHIFT+N, in Firefox, CTRL+SHIFT+P) which disables extensions/addons (see [this for additional security-related](https://counterpartytalk.org/t/what-precautions-and-best-practices-can-i-use-for-counterwallet/1165) ideas).

b) Buy some XCP on a and send XCP [and a small amount of BTC](https://counterpartytalk.org/t/why-do-i-need-small-amounts-of-bitcoin-to-do-things/1142) (e.g. 0.01) to your wallet address.

c) Understand the fees (see [What is the difference between Total and Real Estimated Total when placing an order?](https://counterpartytalk.org/t/what-is-the-difference-between-total-and-real-estimated-total-when-placing-an-order/1178) and [What is the difference between 'miner's fee' and 'redeemable fee'?](https://counterpartytalk.org/t/what-is-the-difference-between-miners-fee-and-redeemable-fee/1188)), and [how to recognize fake (fraudulent) assets](https://counterpartytalk.org/t/how-to-recognize-fraudulent-counterparty-assets/1170))

d) Place a buy order on the DEx. If your offer gets matched within the duration of your order, your it will be settled. Otherwise it'll fail.  In case you change your mind or prices change, you can **cancel **your order before it expires (see [When is an order considered "active" and how can I cancel it?](https://counterpartytalk.org/t/when-is-a-dex-order-considered-active-and-how-can-i-cancel-it/1180))

Now that we covered the basics, let's walk through buy and sell scenarios.

Before we move on let's remind ourselves that the default order validity (which can be changed in Counterwallet **Settings** and which does not persist between logons) is 1000 blocks of the Bitcoin blockchain, so if you trade in unstable assets you may want to change that to a lower value or even switch to a centralized crypto-exchange where it normally doesn't cost anything to place (and cancel) an order. See KB articles under 3d (above) for additional details.

### Buy

In Counterwallet's left-hand menu find **Exchange > Markets**. If you're after a popular asset, you may already see it among **Top Pairs**. Make sure you get the correct asset name(s).

If not, move to the right and under **Select Another Pair **start typing the asset (token) name you're interested in. As you type Counterwallet will list available assets to save you time. Default unit of denomination is **XCP**, but you can select **Other **to enter another and as we mentioned above it is entirely possible that someone is selling WOOD for WATER. In that case you'd need have some WATER to buy WOOD and then you'd enter WOOD under **Token 1** and WATER under **Token 2**.  On a DEx level top assets (and their recent price trends) can be seen under **More > Top Assets**.

Here we keep it simple and look for TESTASSETONE/XCP.

![](../../../static/img/counterparty-dex-find-asset-to-buy1.jpg)


Once you click on TESTASSETONE, you will see the market. If it's any liquid, you'll see some buy and sell orders. We're buying so we're looking for Sell orders. At the very bottom of the screen we can see one sell offer: somebody is selling 22 TESTASSETONE in exchange for 2.2 XCP.  

![](../../../static/img/counterparty-dex-select-sell-offer.jpg)

If you're happy with that price, simply click on it and Counterwallet will populate your Buy Order form. Make sure the price is acceptable because matched orders cannot be cancelled! (It is not rare to hear that someone paid 0.001 for an asset that normally costs 0.0001.)

A populated buy form can be modified (**Price, Amount**). Visually inspect all fields (especially if **Total** is a large number) to make sure one last time and then press the Buy button.

![](../../../static/img/counterparty-dex-populate-buy-order.jpg)

Now your order will remain valid until it's matched, cancelled or expired (whichever comes faster - see related KB mentioned under 3d, above). 

Orders can be cancelled in two places - in **Exchange > Open Orders **and on the trading page for each asset pair where you have placed orders. The first location gives you a quicker way to see all your pending orders and cancel several on the same page. Orders can be partially matched and filled.

You can monitor your order status using [https://xchain.io/](https://xchain.io/).

### Sell

Selling is executed the same way as buying, just in the opposite direction, so please refer to Buy section for details.

The key part here is to carefully enter the price and quantity. Just because someone is offering 0.001 for your token that's normally selling for 0.01 doesn't mean you should click on their offer to auto-populate Sell order form with their values. If you are selling an asset that's also listed elsewhere (say, SJCX) you may want to check the price on other exchanges and see recently traded prices under **More > Top Assets**.
34 changes: 34 additions & 0 deletions docs/counterwallet-tutorials/change-token-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Change Token Settings
---

Once you have created a token, the address you have used will automatically be the owner of this token. This means that you will have access to certain token settings that can be changed. You can access these settings in Counterwallet by pressing the down arrow on the token's box.

![](../../../static/img/change_token_settings1.png)

**With ownership of a token you can:**
* change the token description
* issue additional units of your token
* lock the token in order to permanently prevent more unit from being issued
* transfer ownership of the token

### Issue additional tokens
If your token is not locked, you will be able to issue additional units of your token to increase supply. Click "Issue Additional" to do so. This action is irreversible, but tokens can be sent to an unspendable address to effectively 'destroy' them if needed.

![](../../../static/img/change_token_settings2.png)

### Lock your token
If you would like to create a verifiably finite token, you will have to lock your token to prevent more units from being issued. Click "Lock Token Issuance" to do so. This action is irreversible.

![](../../../static/img/change_token_settings3.png)

### Change description
You can change the description of your token as often as you like. This will be publicly viewble in the blockchain. If you would like to add images, and additional information in your description, click [here](../../basics/assets/enhanced-asset.md)

![](../../../static/img/change_token_settings4.png)


### Transfer ownership
You can transfer ownership, and therefore control over issuance and description, of your token. Please keep in mind this action takes some time, and is irreversible.

![](../../../static/img/change_token_settings5.png)
51 changes: 51 additions & 0 deletions docs/counterwallet-tutorials/create-addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Creating a new address
---


Counterwallet uses regular Bitcoin addresses, and you can create up to 20 in each wallet. If you need more, it is recommended and more secure if you create a new passphrase.

**Counterwallet supports the creation of several different kinds of addresses:**

- Regular Address
- [Armory Offline Address](create-armory-addresses.md) - compatible with the [Armory Wallet](https://bitcoinarmory.com/)
- Watch Only Address
- Multi-signature address

### Creating a regular address

It is very simple to create addresses, just click "Create New Address".

![](../../../static/img/create_addresses1.png)

You can create descriptions for your addresses. However, keep in mind that this information is not stored on the blockchain. Only you will be able to see the descriptions on your addresses.

![](../../../static/img/create_addresses2.png)

### Creating a watch-only address

If you would like to monitor the BTC, XCP and asset balance of any address, you can create a watch-only address. This means that you will be able to see the balance, and create raw transactions. However, there is no private key associated with such addresses. This means that you will have to sign any transactions manually. This feature is useful for keeping track of your cold-storage coins.

![](../../../static/img/create_addresses3.png)

### Displaying the private key of your address

If you would like to show the private key of an address, click address actions and show private key. If you cannot access Counterwallet for whatever reason, you can also generate your addresses and keys from your passphrase. For example, by using [this tool](https://blockscan.com/tool_generatekey). It's entirely client-side javascript. The source code is publicly visible, and you can even run it offline.

![](../../../static/img/create_addresses4.png)

Then you will be asked to confirm, to make sure nobody can see your screen.

![](../../../static/img/create_addresses5.png)


### Customizing the appearance of your addresses

Click the square next to address actions in order to set a color for your address.

![](../../../static/img/create_addresses6.png)

Click the - or + respectively next to the square in order to minimize or maximize the display of your address, for more space on your screen.

![](../../../static/img/create_addresses7.png)

Loading