Skip to content

Instantly share code, notes, and snippets.

View austintgriffith's full-sized avatar
💭
:bowtie:

Austin Griffith austintgriffith

💭
:bowtie:
View GitHub Profile
@austintgriffith
austintgriffith / create.js
Last active February 24, 2020 20:47
create an ethereum account and store it in account.json
const fs = require('fs');
const Web3 = require('web3');
const web3 = new Web3("http://localhost:8545");
const filename = "account.json"
if (fs.existsSync(filename)) {
console.log(filename+" already exists (delete it to create a new account)")
}else{
let account = web3.eth.accounts.create();
console.log(filename,account)
#!/bin/bash
sudo apt install golang-go -y
chmod 0777 /home/nuc/*.log
sudo apt-get install -y build-essential
cd /home/nuc/go-ethereum; git pull > /home/nuc/pull.log; make geth > /home/nuc/make.log
/home/nuc/go-ethereum/build/bin/geth version > /home/nuc/geth.log 2>&1
/home/nuc/go-ethereum/build/bin/geth --allow-insecure-unlock --cache=4096 --maxpeers=50 --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi="db,eth,net,web3,personal,admin,debug,miner,txpool" >> /home/nuc/geth.log 2>&1 &
bash <(curl https://get.parity.io -Lk)
cd /home/nuc/;su - nuc -c 'parity --chain poa-chain-spec/spec.json --reserved-peers poa-chain-spec/bootnodes.txt --ports-shift=10 --jsonrpc-hosts=all --jsonrpc-interface=all --jsonrpc-cors=all --no-warp' >> /home/nuc/parity-xdai.log 2>&1 &
let messageBuffer = {}
module.exports = (web3)=>{
let burnerWeb3 = web3
var iframe = document.createElement('iframe')
iframe.style.opacity = 0.9
iframe.style.position = "absolute"
iframe.style.width = "300px"
@austintgriffith
austintgriffith / predictivedeployment.js
Last active November 17, 2018 18:46
simple script to create a predictive deployment of a smart contract
var ethers = require('ethers');
var fs = require('fs');
var Wallet = ethers.Wallet;
//usage: node craft.js ABI_FILE BYTECODE_FILE GAS_LIMIT GAS_PRICE [...CONSTRUCTOR ARGUMENTS]
//node craft.js "../Sweeper/Sweeper.abi" "../Sweeper/Sweeper.bytecode" 250000 100000000000 (cat ../Loan/Loan.address) (cat ../SomeCoin/SomeCoin.address) 1
const wallet = ethers.Wallet.createRandom();
let httpProvider = new ethers.providers.JsonRpcProvider();
let abi = fs.readFileSync(process.argv[2]).toString()
let bytecode = fs.readFileSync(process.argv[3]).toString()
let factory = new ethers.ContractFactory(abi, bytecode, wallet);
@austintgriffith
austintgriffith / relayer.js
Last active March 6, 2024 03:00
A super simple meta transaction relayer.
"use strict";
const express = require('express');
const helmet = require('helmet');
const app = express();
const fs = require('fs');
const ContractLoader = function(contractList,web3){
let contracts = []
for(let c in contractList){
try{
let abi = require("./src/contracts/"+contractList[c]+".abi.js")
@austintgriffith
austintgriffith / Proxy.sol
Created October 26, 2018 06:35
A blind meta transaction proxy.
pragma solidity ^0.4.24;
// adapted from https://github.com/austintgriffith/bouncer-proxy/blob/master/BouncerProxy/BouncerProxy.sol
// Blind proxy - forward everything
contract Proxy {
constructor() public {}
mapping(address => uint) public nonce;
function getHash(address signer, address destination, uint value, bytes data) public view returns(bytes32){
return keccak256(abi.encodePacked(address(this), signer, destination, value, data, nonce[signer]));
}
function forward(bytes sig, address signer, address destination, uint value, bytes data) public {
Verifying my identity on Peepeth.com 0x34aa3f359a9d614239015126635ce7732c18fdf3
/*
Takes a collection of pngs layers and joins them for
https://github.com/austintgriffith/nifties-vs-nfties
brew install imagemagick
brew install graphicsmagick
npm install --save gm
node index.js
/*
Takes a collection of pngs layers and joins them for
https://github.com/austintgriffith/nifties-vs-nfties
brew install imagemagick
brew install graphicsmagick
npm install --save gm
node index.js
//May the 4th be with you
//example usage
//?difficulty=5&input=helloworld3
const express = require('express');
const helmet = require('helmet');
const fs = require('fs');
//const md5 = require('md5');
const crypto = require('crypto');
const app = express();
app.use(helmet());