A Bank running on the Blockchain.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Create a new ERC20 Token and start your own Bank allowing users to invest your token and earn interest. Things you can do:
- Create your own token
- Enable (approve) your address to be able to invest on the bank
- Deposit tokens
- Withdraw tokens
- Earn interest!!!
A list of commonly used resources that I find helpful are listed in the acknowledgements.
In the following sections you will learn how to clone this repo and get it up and running in no time.
You need to have npm installed.
- Download and install node, which already comes with npm:
-
Clone the repo
git clone https://github.com/vinivst/bankchain.git
-
Install NPM packages in project ("backend")
npm install
-
Install NPM packages in client
cd client npm install
-
Register a new account in Infura and create a new project to get your rinkeby key at https://infura.io/dashboard/ethereum
-
Create a .env file at root path
-
Create and save inside the .env the following:
- The MNEMONIC (12 words seed phrase from your wallet)
- INFURA_KEY (that you got from step 3)
- INITIAL_TOKENS (the initial supply of your Token)
- TOKEN_NAME (the name of your token)
- TOKEN_SYMBOL (the symbol of your token)
- TOKEN_REWARD_POOL (the amount of initial tokens that will be rewarded to the users as interest)
- TIME_PERIOD (IN SECONDS - the minimum amount of time to allow users to withdraw, the more time a user stay with funds on the contract more interests he earns)
Use .env.example file to help:
INITIAL_TOKENS = 1000000 MNEMONIC = globe nephew genre emotion morning best penalty trade bid glare unaware dragon INFURA_KEY = https://rinkeby.infura.io/v3/you_key_here TOKEN_NAME = Vinicius TOKEN_SYMBOL = VINI TOKEN_REWARD_POOL = 1000 TIME_PERIOD = 60
-
Deploy your smart contracts
truffle migrate --network rinkeby
-
Change to client directory and run react
cd client npm start
-
Enjoy your new ERC20 Token and your own Bank! 😄
-
User must approve an amount first to invest
-
Then user can deposit tokens
-
After TIME_PERIOD has passed user can withdraw their funds plus interest
You can see all the tests inside the test folder. The tests were all made using Truffle and Web3. To run the tests simply use:
truffle test
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU GPLv3 License. See LICENSE
for more information.
Vinicius Santiago - Linkedin
Project Link: https://github.com/vinivst/bankchain