Skip to content

vanessaholland/blockchain-sandbox

Repository files navigation

blockchain-sandbox, really just playing around

codecov Node.js CI

Following a tutorial, but making tweaks to use newer versions of solidity, web3, solc, webpack, etc., and ganache instead of infura.
Also taking steps to not hard-code vars and compiled contracts.
Will expand functionality from here.


dependencies

This project assumes that you have metamask and ganache installed.

After starting ganache (quickstart is fine), copy the RCP Server address and set that as PROVIDER_URL in your .env file (if you haven't already, now's the time to make one).
Next, copy the account mnemonic generated and set that as MNEMONIC in your .env file.

You can also use another test network with fake Ether. Swap out the PROVIDER_URL and MNEMONIC if so.
You can skip the next section about setting ganache as the provider if you go this route.

setting up ganache as the provider for metamask

You can follow the steps outlined here.
This will require an update in the /src/web3.js like this example.

TBH, I think this approach is cleaner and I plan to refactor this codebase soon to use this approach.

OR manually setting up ganache as the provider for metamask

Open metamask and select Create New Server from the server dropdown. Name it something descriptive like local_ganache, using the RCP Server address from ganache as the RCP url, chain id 1337 (this is the default for ganache), and Currency Symbol ETH.

NOTE: VERY IMPORTANT
DO NOT FOLLOW THIS NEXT STEP IF YOU DON'T HAVE YOUR REAL MNEMONIC STORED SOMEWHERE.

If you already have metamask set up with real assets, you will need to select lock on your accounts so you can import the accounts generated by ganache.
AGAIN, DO NOT CLICK LOCK IF YOU DON'T HAVE YOUR REAL MNEMONIC.

For real, don't use real assets during testing and don't lose access to your real account either. After locking, you can select forgot password to be prompted to in put the mnemonic generated by ganache. Copy+Paste it in there and set any password you want, than click Restore. You'll need to do this each to you restart the ganache server as the mnemonic changes.

npm run deploy-lottery

will look into how to deploy all contracts at one time in the future.
this command manually compiles and deploys.
for now, compiles all contracts but deploys only the lottery contract.

you can also pass the contract you wish to deploy as a commandline arg node deploy.js <Example> also take a look at the built-in scripts for example usage.

add additional contracts to compile.js as needed.

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test-ui

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published