A hackable token for BSV and BCH. Intended as a starting point for developpers to build on top of. Build on the Bitcoin Computer library.
The smart contract itself could not be simpler
class Token {
constructor(to, supply, name) {
this.coins = supply
this._owners = [to]
this.name = name
}
send(amount, to) {
if (this.coins < amount) throw new Error()
this.coins -= amount
return new Token(to, amount, this.name)
}
}
The constructor creates a new Token object that stores amount
tokens and that is owned by a public key to
. The send function first checks for insufficient funds. If the test passes a new object with number
tokens is created and the amount in the current token is reduced by number
. This guarantees that the total number of tokens remains constant.
You can find more information in the accompanying Medium Article.
Clone the repo and run
npm run start
To log in you need a BIP39 seed phrase, for exmple from the Bitcoin SV Account Generator. You then need to fund the wallet using a Bitcoin SV faucet
For more information see the Bitcoin Computer Docs or ask in the Telegram Group.
The app is very bare bones and contributions are more than welcome. Have a look at the open issues, or make a pull request with a new feature. You can also request a feature request by creating an issue.
Copyright 2020 Clemens Ley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.