swaponline / MultiCurrencyWallet

Bitcoin, Ethereum, ERC20 crypto wallets with 0x and atomic swap exchange.
https://swaponline.github.io
MIT License
482 stars 493 forks source link

(mostly) Wallet Permalinks #2419

Closed vladiuz1 closed 4 years ago

vladiuz1 commented 4 years ago

Problem

Two problems:

  1. Right now there is no blockchain explorer. However, its partly not true, because you can view your own transactions per wallet and combined transactions of all user wallets, so its not entirely true.

  2. The wallet permalink is there, but the wallet is referenced by its name, It's ok right now with absence of shareable permalinks, and only one bitcoin wallet per profile, but if we want to make simple blockchain explorer (let's call it wallet explorer - because its not entirely feature rich to qualify for blockchain explorer), we need to be able to make wallet permalink referenced by wallet address.

Right now the permalink looks like this: https://swaponline.io/#/Bitcoin-wallet

Task

Now, this permalink needs to be extended, so it can be shared between people, so they can view wallet's balance, its transactions, and statuses of the transactions.

This is a crazy must have feature for many reasons.

First of all it must universal, and can be the core of swaponline functionality in a way that it works for all types of wallets and for all currencies - simple, multisig, 2fa, bitcoin, ethereum, etc...

I suggest the following format: https://swaponline.io/#/btc/1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX

Now, as you open such link, the interface must determine wether or not this wallet is part of current profile (one of deterministically derived wallets from the current master key).

This could be one of wallets that belong to current profile (simple or 2fa, or multisig). In which case, the standard list of transactions for this wallet is shown, (1) the option to spend/send funds from it, if there is a balance.

If this wallet is not part of your profile, then you see (2) the address of this wallet, an option to send funds to this wallet. You still see (3) all the transactions, and balance and every detail of this wallet, but the interface (4) clearly shows that this is not your wallet, you are viewing someone else's wallet.

This can be achieved by color scheme for example. The balance could still be in the same place where you would see the balance if it was your wallet, but there should be (4) a clear message that this wallet is not yours, and the button "spend" would be missing in the place where it usually is if you were viewing your own wallet.

IMPORTANT Unlike many other blockchain explorers, our must be more accounting-oriented, rather than blockchain oriented. This means, our transaction list must be more user-friendly to professionals who wish to view balances and transactions, rather than understand the blockchain details. This means that in the (5) transaction list we need to

  1. display the date of transaction
  2. amount of transaction (in currency of the wallet. e.g. btc)
  3. balance (the new balance after the transaction was complete, or when it will be complete)
  4. we need an easy way to convert the transaction amount to fiat currency amount (usd), so you can see your transactions in fiat representation, the exchange rate must be valid for the time when the transaction was complete, rather than current exchange rate. So if you sent 3 months ago 0.1 btc, you should see first of all the 0.1 btc, but also its important that it was approx $700 at the time of transaction. (there is no need to convert resulting balance after transaction to fiat amount, as its irrelevant)
  5. We need to see current balance of the wallet in the currency of the wallet (BTC) as main focus, but there current balance should also be shown in preferred fiat currency (e.g. USD), with lighter accent.
  6. The he transaction descriptions must be editable, but dates should not be editable like it is now. They should always be there, you should not be able to edit date of transaction.

The (6) pending transactions should not influence the current balance, and the balance after transaction field must be empty, it will only be shown after transaction is accepted, and the time of acceptance should be the sorting value.

Extended use

Swaponline must be all about permalinks

The future permalinks must include:

All of these things are very important for marketing and for being up to date with modern requirements.

PERMALINKS ARE KING!

But they must be super intuitive.

DO NOT make named permalinks like it is now, they make no sense. names change, permalinks die. permalinks - mean exactly what they say - they must be PERMANENT. Just like ADDRESSES - they’ are also permanent, so keep them permanent, no permalinks based on names or on anyone thing that can change.

Multiwallet

For this to make sense, we need to be able to add multiple wallets of the same currency.

Not only that. We should be able to add "watch only" wallets. This is a supercool feature. If you have a cold wallet, why not add its balance to your browser, and watch how payments come in?

We can make even more sense to use "watch only" wallets - we can track invoices. Right now you create a separate wallet for every payment - its the best way to track your buyers, and invoices. This is great, but this means that you need to manually create new wallets, and eventually they grow to some crazy number of addresses hard to group or keep track of.

Our concept should be that you don't need multiple addresses, keep the addresses to minimum, and rather track your customers by invoice numbers. Create an invoice, mark it, send the permalink to it, and if transaction succeeds, this transaction remains with the marked description that you made when creating an invoice. This way you have one bitcoin address with multiple customers, and you can tell which transaction came from what customer.

Again, these invoices must come in permalinks.

The invoice generation must be done on 1-by-1 basis, or must be mass produced, by copying: invoice#, amount, currency, description, email to a handsontable from excel or .csv and generating as many invoices as needed. The link to each invoice would appear in handsontable. We could add a mass mail functionality to it too (by charging in btc modest amount for sending invoice emails to all receipents, and displaying progress). Wouldn't that be nice??? What you send in the email? That's right - permalinks to invoices.

Your /#/invoices endpoint would show all invoices you issued. And /#/invoices/btc/1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX would show all invoices you have issued with that address as a receiving address. And when you go visit these permalinks you see the status of each invoice: paid, unpaid.

So how do you know which invoice is paid if you issue for example 100 invoices to 100 different people with the same amount? Answer is simple: You don't. Do not issue 2 invoices with the same amount, and we should let the user knwo that they can't issue two invoices with the same amount to the same address, and if such invoices found, we need to prompt them to create another wallet, remove invoice or use another wallet if it has already more than one btc wallet.

Crypto check permalinks

We can create an amazing type of permalink. What if you want to send someone funds, but you don't have his address yet. Or you don't know if someone has a bitcoin wallet or not?

Then you can send checks.

Send funds to smart contract or p2sh address, and send a permalink to it. What happens next? The user has a secret as part of this permalink, this secret is in the #hash part of the link, so our server does not see it, but javascript of receiver stores it in cookies.

This secret is basically a private key, and the address of that private key is stored in smart contract or p2sh address. Now the receiver generates his own btc wallet, and signs the address of that wallet with the permalink privkey. He sends the signed address to our server, our server sends a request to transfer the funds from p2sh to that wallet using its transaction fee. now the p2sh is programmed in such a way, that it sends funds to the signed with that privkey from permalink address, but whoever sends the transfer request transaction gets compensated for the transaction fee plus a little bonus from the funds in the p2sh wallet.

If none claims the funds, the sender can claim the funds in 1 month (or whatever time limit set on the cryptocheck).

This is could be another killer feature of swaponline.

Ofcourse a free replacement for such feature is to open swaponline in private mode browser tab, save the private key, send the funds to newly generated address, close the tab, and send the exported private key to the receiver. Its a free alternative, but may be not so easy and require too much hassle.

Purpose

Why this is useful?

  1. From the marketing point of view, you need to remember - blockexplorer and blockchain info are two giant websites, that do nothing but create traffic thanks to link sharing. Making this functionality available - we create a great way to let people share links between each other, eventually promoting the service.

Remember that Telegram popularity comes from permalinks, there was no other advantages compared to WhatsApp.

Area

Wallet permalinks only require frontend changes, no backend is affected.

Estimate time of implementation

2 months

noxonsu commented 4 years ago

Проверить, что работают пермалинки.

  1. свой кошелек btc
  2. чужой кошелек btc
  3. свой и чужой eth
  4. свой и чужой erc20 (usd)
  5. btc транзакция из истории
  6. eth и erc20 транзации
  7. инвойс (при клике из истории)
noxonsu commented 4 years ago

almost done, "watch only", "incoices", "result balance" and cryptochecks moved to separate issue