basic js for chall
bytecode.bin
has extra newline, making it 2 lines long- ethers will interpret that \n as a byte in bytecode, reports "Error: invalid bytecode"
- solution: remove newline after cloning repo
-
create package.json
- without it, npm tries to install packages to your home directory(~/node_modules) I think
- add pair of brackes('{}') to package.json
- linux:
echo '{}' > package.json
-
install npm and node
- tons of ways to do it, I just installed node from the website(https://nodejs.org/en/download/ - npm comes with it) and symlinked the node and npm binaries to ~/.local/bin
- node runs .js files, npm lets you install ethers
-
install ethers(npm library)
npm install ethers
(makesnode_modules
dir to use ethers in that dir only)- or
sudo npm install ethers -g
(idk how this works, but it makes ethers lib accessible from anywhere) - note: ^
sudo ... -g
borked my system later on, but that might have been bc I'd never used npm/node before
-
"install" ganache(mock blockchain gui)
- ganache sets up a test blockchain locally and gives you a nice gui to see it
- dont really need to "install" for linux, its just a standalone appimage
- get from: https://trufflesuite.com/ganache/
-
optional: install vscode extension(
if on kali linux, it's not available ini think its available now, dont quote me tho)code-oss
- you have to use the propietary version from msft- https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity
- sidenote: hardhat = eth development framework. but the same people also made this solidity syntax highlighter
Install ethers lib, run ganache, copy/paste pubkey & privkey of address you want to use into deploy.js
, then:
node deploy.js
abi.json
- came from https://ropsten.etherscan.io/address/0xb6514151340FF027469EAFcBB4c775C993A6Bdb0#code: "Contract ABI" => "Export ABI" => "Raw/Text Format"
- note from future self: wow, took me a whole network deprecation to write a blog post, smh
- came from https://ropsten.etherscan.io/address/0xb6514151340FF027469EAFcBB4c775C993A6Bdb0#code: "Contract ABI" => "Export ABI" => "Raw/Text Format"
bytecode.bin
- came from same link above^ : "Contract Creation Code"
deploy.js
- deploys Totally-Secure-Dapp to ganache(ganache must already be running)
interact-local.js
- script to interact with local contract from
deploy.js
- script to interact with local contract from
Initializable.sol
andTotallySecureDapp.sol
- arent needed to run js scripts or anything, but nice to reference
interact-remote.js
- script to interact with actual dapp from chall