Coder Social home page Coder Social logo

badger-cash / badger Goto Github PK

View Code? Open in Web Editor NEW
63.0 16.0 47.0 38.79 MB

Your gateway to the world of Bitcoin Cash (BCH) apps

Home Page: https://badger.bitcoin.com/

License: MIT License

Shell 0.06% JavaScript 89.74% Dockerfile 0.02% HTML 0.63% CSS 9.55%

badger's Introduction

Badger

Installation

API Documentation

https://developer.bitcoin.com/badger/docs/getting-started

Docker build distribution

Notes:

  • Recent docker version needed to build.
  • OSX or Linux build environment preferred.
  • Execute commands from the source directory.

Steps:

  1. Build and run the image, run command: docker build -f Dockerfile -t badger:0.7.16 . && docker run --name badger0716 badger:0.7.16

  2. After the build is complete, copy the distribution files to your local folder: docker cp badger0716:/app/builds/. ./

  3. A distribution file for each supported browser will be copied, such as badgerwallet-firefox-0.7.16.zip for Firefox browsers.

Intro

Badger is a secure identity vault for Bitcoin Cash. It allows you to hold BCH & tokens, and serves as your bridge to decentralized applications (dapps).

Bitcoin Cash and tokens enable an entirely new dimension to the web with micro-payments, smart-assets, decentralized exchanges, distributed autonomous organizations and much more.

Badger is your identity on this new web. You can pay for premium content, run smart contracts and experience dapps seemlessly and trust free.

Powered by BITBOX, Badger is 100% non-custodial. Your private keys never leave your computer.

Badger Button

Badger Button is a library of open source UI components which content creators and entrepreneurs can drop in to their site to enable micro payments, premium content, tipping, e-commerce and much more.

CashID

Credits

badger's People

Contributors

2-am-zzz avatar alextsg avatar bdresser avatar bitpshr avatar brunobar79 avatar chikeichan avatar danfinlay avatar danjm avatar dapperkangaroo avatar estebanmino avatar flyswatter avatar frankiebee avatar greenkeeper[bot] avatar jaredpereira avatar jennypollack avatar kumavis avatar lazaridiscom avatar nyatla avatar orangemio avatar paool avatar phyrextsai avatar scsaba avatar sdtsui avatar spendbch avatar tmashuang avatar trejgun avatar vinarmani avatar whymarrh avatar wjmelements avatar zmitton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

badger's Issues

Incoming txns not showing on badger-firefox mobile

On Badger for Firefox at least on mobile, if I send and receive BCH I see the txns, but if I send and receive SLP, I see the sends but not the ones I receive. I see the tokens, in balance, but not the txns.
Everything works, but it would be nice if TXNs coming in displayed when they arrived and in history

Branded Button with Progress Animation

What problem are you trying to solve?
Offer a default branded button with loading animation. Ensure users know they are tipping with Bitcoin Cash.

Worth considering - add a <small> text below button that reads "What is badger button?" which leads users to badger.bitcoin.com to learn more.

Describe the solution you'd like
Provide consistent UX to users integrating badger into their projects.

Additional context
Some ideas for inspiration - I think it's worth ensuring the Bitcoin Cash logo is prominently displayed attached or next to the button in some way.

Add back Network button

I recently removed the network button because it was causing a bug where a spinner overlaid the modal and never went away which required a user to reinstall badger.

Here is the PR: #48. Add back the network tab and allow users to select testnet as well as mainnet.

Allow multiple outputs to Badger Button

Summary

If we allow multiple outputs and a way to allocate %s to each output it would enable things such as content creators hiding premium content behind a badger button. When a user clicks the button a certain % of the BCH/tokens go to the content creator and a certain % go to the content hoster.

Copy BCH or SLP address should be plaintext, not rich HTML

In the current implementation, clicking on the SLP or BCH address will copy the address as rich HTML, not plain text. When pasted into an application, it will paste the text wrapped inside HTML. It would be better if it was copied as plain text, as that would work for all applications.

Constant refresh when running Metamask and Badger side-by-side

Originally reported by Soupernerd in the Badger Wallet Telegram channel on 1/28/2019:

The following is a test on firefox with metamask active. Notice the constant refreshing. Closing paybutton modal. Initially we thought it was paybutton specific but then tried other "normal" badger buttons and experienced the same. It was sporadic at times, and expected at others:

https://imgur.com/R9KAXyU

The following is firefox without metamask active (seems to work as intended):

https://imgur.com/FuRjutd

And just for the sake of it, the following are chrome and brave testing. Similar variables (seem to work as intended):

Chrome:

https://imgur.com/GORHgnn

Brave:

https://imgur.com/ypiRBK9

Send All

Summary

Sending all your BCH in a single tx is a common use case. We need a 'Send All' btn which creates a tx and spends all available utxo.

Split/Lock UTXO to enable new use cases.

The ability to "lock/split" UTXO.

either a new method like

web4bch.bch.splitUTXO(txParams, (err, txid) => {

or an additional param to the existing

web4bch.bch.sendTransaction({ value: "1000", split: true}, (err, txid) => {

badger would send the value to yourself to create the utxo of the exact value you need.
The front end would omit the utxo from the balance just like how 546 sat utxo are currently.
And since the utxo are still under the user's control, to "unlock" them would simply change the UI state to make it visible again in the app.

Use Cases

  • To complete a non-custodial trade between bch/slp. and other future combinations/tokens.

  • future payments. a crypto eBay site for example, where the user can place a bid and sign the utxo amount. If they win, the payment is already signed for and the exact amount deducted.

  • Subscriptions. lets say you want to charge a user every month. The next month's payment can be locked and signed for; If there are not enough funds available, the site/app alerts the user and they have XX days to split/sign the required amount or their services are frozen.

I'm sure there are more possible scenarios that I have yet to think of.

Does not support passwords with foreign characters

From the Badger Telegram channel, reported by kos at 10:45PM 2/22/19:

Also, just fyi, the badger wallet doesn't support passwords using foreign characters for some reason. I have to use only american characters if I don't want to restore from seed every time I log in

Probably something about the way you parse passwords on login vs registration. Should be parsed the same way, or certain characters should be prohibited

Upgrade to React 16

What problem are you trying to solve?
Update the project to the newest major version of React

Describe the solution you'd like
Update to at least React 16.3 so the majority of current React libraries are compatible with our codebase

Badger wallet doesn't show SLP tokens

Describe the bug
Badger wallet does not show tokens. I have tried to create tokens in the SLP version of Electron Cash and send them to Badger wallet, but they are not shown. Tried to create a new account in Badger, still no success. I also tried to reinstall badger and import my account.

To Reproduce
Steps to reproduce the behavior:

  1. Create token in Electron Cash.
  2. Send them to badger
  3. Look in the left menu

Expected behavior
I would see my tokens in the left menu.

Screenshots
billede

Browser details (please complete the following information):

  • OS: Ubuntu Linux 18.10
  • Browser: tested in Firefox 64.0 and Chromium 71.0.3578.98
  • Badger Version 0.1.3

When I open a browser and not logged into Badger

Open browser not logged into Badger

Click on a badger Button
Nothing happens
MetaMask - RPC Error: Error: Invalid from address undefined not a string in console
Login to Badger by clicking on the plugin
Works as expected.

What I expect:

Open browser not logged into Badger
Click on a badger Button
Popup with login prompt (as before)
Works as expected

Showing failed outgoing transaction in transaction history list

Description

When hitting the 25 tx limit, Badger Wallet still shows the outgoing transaction in the transaction history list, but there is no actual transaction on the blockchain.

Steps to reproduce the behavior

  1. Send 0.0001BCH from Account 1 to Account 2 in Badger
  2. Send as many txs as needed to trigger the 25 unconfirmed-chained tx error message

Expected behavior

In Badger's outgoing transaction it should only show the transactions which were actually sent.

Actual behavior

Badger Wallet still shows the outgoing transaction in the transaction history list, but there is no actual transaction on the blockchain.

Firefox login in add on graphics gone

Firefox box extension after login displays a flick of user data and after that it displays white box only! begun after firefox update. tried restarting browser and reboot computer. Still the same issue.
Thank you

screen shot 2019-01-12 at 18 02 22

Callback function can not be on a global object

Badger 0.1.2 in Chrome

It's good practice to not pollute the global window context. So it would be cool if Badger would allow the callback function to be part of my main app object (think of an object compiled with WebPack having more functions):

	var myApp = {
			pay: function(txid) {
				console.log("PAID", txid);
			}
	}

When I use data-success-callback="myApp.pay" it fails by saying window[successCallback] is not a function.
I know it works with a "normal" global function, so we can classify this between "bug" and "feature request" ๐Ÿ˜‡

Retain login status between browser sessions

Right now Badger seems to log itself out whenever browser is closed, which is quite annoying in UX especially for browsers consuming a lot of memory. A timeout mechanism would seem to make more sense.

If having the wallet exposed while browser is closed is a concern, a workaround might be to allow clickable buttons even when Badger is logged out anyway, but pop up a password prompt upon clicking (as opposed to the button just greying out altogether).

Feature Request: Button style

For Badger Button and other BCH-based buttons (gateway.cash and more) to be adopted it would be very helpful if you could provide 1 or 2 CSS classes with button styles. Think of the MasterCard, Visa,... logos & buttons on payment pages.

If every website uses its images & styles for the payment button it will

  • not immediately be recognized by users
  • look less trustworthy

Add Cashshuffle support

Summary

Cashshuffle enables privacy-enhanced transactions. Enabling greater user privacy will have positive effect for users across the world and offers an opportunity for BCH to differentiate from other cryptos.

Add Cashshuffle support to Badger.

https://cashshuffle.com/

Segregate SLP tokens to another account

What problem are you trying to solve?
Prevent people from unintentinally losing/burning SLP tokens.

Describe the solution you'd like
I don't think I have a very good solution but here is a proposal.

Do not mix BCH and SLP in the same account. Badger Wallet would always start with a BCH-only account (m/44'/145'/0'). To receive SLP tokens the user would need to create a new SLP-only account. That account (m/44'/145'/1') would only show a simpleledger:... address. To fund transfers, for those tokens, Badger Wallet would use the main account m/44'/145'/0' (or the first BCH-only account with funds) which avoids having to fund those accounts.

Additional context
People may use the same seed on multiple wallets to avoid having multiple backups or to have control over the same balance on multiple wallets. If you receive simpleledger tokens with Badger Wallet and import the same see on another wallet you may lose tokens because. To most wallets those ouptuts are regular outputs that may be spent, for example, in a send max operation.

Segregating tokens to another account keeps the wallet BIP44 compliant and hides token outputs from a default import of the same seed on another wallet. You obviously can still override the derivation path to have the SLP accounts imported, for example, to Electron Cash.

Token value formatting improvements

What problem are you trying to solve?
large amounts of tokens ie, 1000000 are formatted poorly.

Describe the solution you'd like
now: 1000000
better: 1,000,000

BadgerWallet submits form when the button is being placed inside a form

Badger Wallet 0.4.3 in Chrome 73

When we place a Badger button inside a form, then clicking on the badger button causes the form to be submitted. This happens before the payment is sent (right when the badger popup opens).
This is particularly annoying for forms where the user should pay BCH to submit it, as happening in my WordPress plugin: https://cashtippr.com/shout/

Sample bug based on your official demo code:

<!doctype html>
<html>
<body>
<p>Send BCH</p>
<p>
  <form action="" method="post">
    <button id="badger-button">
      Tip 100 BCH Satoshis
    </button>
  <p>Page loaded: <span id="loadCount"></span> times</p>
</form>
</p>

<script>
    var loadCount = localStorage.getItem("pageLoadCount") || 0;
    document.getElementById("loadCount").innerText = loadCount;
    localStorage.setItem("pageLoadCount", ++loadCount);
    var badgerButton = document.getElementById("badger-button")

    badgerButton.addEventListener('click', function(event) {
        if (typeof web4bch !== 'undefined') {
            web4bch = new Web4Bch(web4bch.currentProvider)

            var txParams = {
                to: "bitcoincash:qp76l5qeztrmjxpas35wgznn3zxdj7e89qcj2v6mlq",
                from: web4bch.bch.defaultAccount,
                value: "100"
            }
            web4bch.bch.sendTransaction(txParams, (err, res) => {
                if (err) {
                    console.log('send err', err)
                } else {
                    console.log('send success, transaction id:', res)
                }
            })
        } else {
            console.log("Ensure Badger Wallet is installed and unlocked, then refresh this page")
        }
    })
</script>

</body>

</html>

My workaround currently is to cancel the first form submit event (coming from badger) and then remove this handler again so that the next submit event goes through.

        this.cashtippr.$(".ct-shout-form").on("submit.cashtippr", (event) => { // fix for badger wallet submitting form on click (before payment)
            event.preventDefault();
            this.cashtippr.$(event.target).off("submit.cashtippr");
        });

Suggested proper fix:
Badger should process the payment and use the API callback, but never submit any forms automatically.

Improve Error Message when Sending Tokens without BCH

image

Above is the error message displayed when a user tries to send a token without any BCH in their wallet. This was a common errror message seen by users when trying to pass the SLP torch.

This is the error message coming from rest.bitcoin.com. This specific error message should be captured in Badger Wallet and displayed as a more intuitive message like: "Not enough BCH in the wallet to complete this transaction! Please add BCH to your wallet."

SLP transactions create extra output for 0 SLP token change

The bug
Any SLP transaction sent from Badger wallet creates a SLP change output back to badger wallet, even when change is 0. This is creating extra UTXOs unnecessarily locking up BCH in 0 amount SLP tokens.

To Reproduce
Send an SLP transaction with the whole balance of a certain token to another wallet and examine the transaction.

Expected behavior
Should not create a change output of 0 tokens.

Browser details (please complete the following information):
Any

Additional context
NA

Multiple badger buttons on the same page can't have different amounts

Tested with Badger: 0.1.2 in Chrome

When I use multiple badger buttons on the same HTML page for my WordPress addon https://cashtippr.com/ they can not have different amounts. I need this feature in some cases. I see no reason why it shouldn't be possible, so I'm assuming a bug.

Steps to reproduce:

  1. add a 2nd button with different amount in your sample: https://github.com/Bitcoin-com/badger-samples/blob/master/badger-button.html
  2. click on pay - both buttons ask for the same amount :(

Make it easy to send BCH with tokens

One of the common issues that became apparent in the SLP Torch passing is that many people using Badger Wallet for the first time got stuck, because they received the token without having any BCH in their wallet. This appears to be a common, recurring problem for new users.

Badger Wallet needs some intuitive user interface for sending a small amount of BCH along with a token. If the sender can do that, then the receiver is much less likely to get stuck.

For reference, look at the Badger Wallet Telegram group chat logs from 3/6-3/7.

Add type checking to the project

What problem are you trying to solve?
Add type checking to the project for easier and faster development

Describe the solution you'd like
Add flow to the project, and continue to use flow as development continues.

Received transaction history

What problem are you trying to solve?
Can only see outgoing transactions, would be good to be able to see incoming transactions as well.

Describe the solution you'd like
Visible incoming transactions

Badger Button should show proper error message when not logged in

Badger Wallet 0.1.3 in Chrome

When I am not logged in to my wallet (it asks for password when clicking on the icon) and I click on the Badger Button to pay, nothing happens.

Steps to reproduce:

  1. logout of badger
  2. click on the button in your sample https://github.com/Bitcoin-com/badger-samples/blob/master/badger-button.html
  3. nothing happens

It should show a proper error message asking the user to login (just like you redirect him when the wallet is not installed).

Badger wallet let me send my full balance with no transaction fee.

Reported in Telegram 1/10/19 @ 5:12pm PST

This made the transaction get stuck.

The balance showed on my wallet still but any attempt to transact would show and error of insufficent funds.

I was able to work around this issue by restoring from seed to electron cash new wallet and sending it to another address.

This time it had a fee on it.

Few minutes later, fixed.

My badger wallet still shows a balance that it quite frankly doesn't have anymore though.

Move mnemonic backup flow until after a user has funds

Summary

Currently when you first set up Badger we show the mnemonic and have the user back it up and confirm they got it correct. We should move this so that the user isn't prompted to backup their seed until they have funds

This will be a better on-boarding UX.

Allow nullData outputs in Badger Button

Summary

Writing data to the blockchain via OP_RETURN in nulldata outputs is a very popular and useful feature of BCH.

Update Badger Button API to allow nulldata outputs.

Inconsistent behavior between Firefox & Chrome when Badger is locked

Originally reported by Soupernerd in the Badger Wallet Telegram channel on 1/28/2019:

  1. Firefox, when badger button is clicked and badger is locked, still it pops up badger to unlock. It then pushes the tx info and amounts (ideal)

  2. Chrome and brave will do nothing if clicking a badger button and badger button is locked. So we put in a check, and alert user to please unlock badger wallet before proceeding. (Not ideal as it adds more required userside interactions)

Update to node.js v10

What problem are you trying to solve?
Node.js v10 is now in LTS status. Currently, trying to npm install with node.js v10 installed will error out.

Describe the solution you'd like
The scope of this Issue is to fix the dependencies to make the software work in Node.js v10.

UI: Scrollbar pixels on Linux Chorome

On linux the scrollbar shows on the BadgerWallet extension popup. Its off by about 5 to 10 pixels.

this would be on the login window where it says 'Welcome Back'

Extension non-functional with Chromium v57 on Debian Linux

Describe the bug
For a brand new, first time installation the extension fails to function. Although it installs just fine, it is completely non-functional for me. Clicking on the wallet extension icon loads the main popup but the frame is totally empty except for short vertical scrollbar. I've tried completely reinstalling it but the issue persists. Inspecting the background page view shows a single error Uncaught SyntaxError: Unexpected token ) at background.js:17487 . I can't follow it any further though because it refers to a line number that doesn't exist in my source window. Furthermore, attempting to view the errors/warning on the extension management page freezes the page entirely requiring me to force close the tab. I expect it's because the script is insanely large (almost 17,000 lines).

To Reproduce
Steps to reproduce the behavior:

  1. Install extension from https://chrome.google.com/webstore/detail/badger-wallet/jadobjbcgibiopkifknkfnohlelpocll/related
  2. Click on Badger Wallet extension icon
  3. Confirm main popup is blank

Expected behavior
A clear description of what you expected to happen.

Screenshots
badger-fail

Browser details (please complete the following information):

  • OS: Debian Linux 9.5 (64-bit)
  • Browser: Chromium v57.0.2987.98
  • Badger Version: 0.1.3

Allow user to store address info for one-click payment and delivery info

What problem are you trying to solve?
As a user, I'd like the delivery information (address, phone number, etc) automatically filled in when I place an order with Badger Button.

Describe the solution you'd like
This is an extension to the Cash ID integration. This feature would allow a user to add their standard delivery information like address and phone number to Badger Wallet. When an ecommerce store that uses badger wallet is used, Badger Wallet could automatically fill in this delivery info. This would mimic features that are standard in Paypal and Amazon.com.

Add prettier support to project

What problem are you trying to solve?
Add prettier support to project and connect to our .eslint config

Describe the solution you'd like
Add prettier to the project for highly enforced code consistency and formatting

Selecting Mainnet in Chrome created permanent overlay

Originally reported by Theo in the Badger Wallet Telegram group on 1/30/2019:

Clicking the button in the Chrome menu bar to open the popover, and then clicking the mainnet button (to see the list of networks, of which there is only mainnet of course), then clicking mainnet from the list...

Produces an overlay saying connecting to mainnet but it never finishes/goes away (even though underneath I can see my balance changes, so the rest is working)

Add better error handling

What problem are you trying to solve?
Currently we just bubble up any error from tx creation or from the full node and display them to the user. People are contacting us daily confused by the 25 chained unconfirmed tx history. We should inspect the error message and pass back a meaningful error message to the browser modal. Also we should create a faq on badger.bitcoin.com/faq and deep link from the modal to the appropriate error description

The problem is Badger or the browser don't consistently display a modal. It appears to only accept explorer.bitcoin urls and it doesn't always show them. And when it does sometimes it doesn't open a new tab on click. To reproduce throw an error in the transaction flow and see if a modal appears.

I've started work on this here https://github.com/Bitcoin-com/badger/tree/error-message

To test

  1. Throw an error here: https://github.com/Bitcoin-com/badger/blob/error-message/app/scripts/controllers/transactions/bitbox-utils.js#L113
  2. See if modal appears here: https://github.com/Bitcoin-com/badger/blob/error-message/app/scripts/platforms/extension.js#L64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.