Skip to content

Instantly share code, notes, and snippets.

View critesjosh's full-sized avatar
🥸

josh crites critesjosh

🥸
View GitHub Profile
@critesjosh
critesjosh / docker-compose.fork.yml
Last active January 11, 2023 20:05
A docker compose script to start an Ethereum mainnet fork with anvil and the Aztec stack locally, use chain id 3567
version: '3'
services:
fork:
image: ghcr.io/foundry-rs/foundry:nightly-8c4294c1d2321e20a3543fbd9a813d47053a8303
entrypoint: 'anvil -p=8545 --host 0.0.0.0 --fork-url ${FORK_URL} --chain-id ${CHAIN_ID}'
ports:
- '8545:8545'
contracts:
platform: linux/amd64
@critesjosh
critesjosh / docker-compose.dev.yml
Last active January 5, 2023 01:16
A docker compose script to start the Aztec stack locally (no bridges), chain id 31337
version: '3'
services:
contracts:
platform: linux/amd64
image: aztecprotocol/contracts:latest
environment:
ETHEREUM_HOST: ${ETHEREUM_HOST:-}
PORT: 8547
command: ./scripts/start_e2e.sh
ports:
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = function override(config) {
let fallback = config.resolve.fallback || {};
// These fallbacks are required for the @aztec/sdk v2.1.0-testnet.30 or greater
Object.assign(fallback, {
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
@critesjosh
critesjosh / rollupprocessor.json
Created June 6, 2022 19:15
aztec rollup processor abi
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_escapeBlockLowerBound",
"type": "uint256"
},
{
"internalType": "uint256",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_verifierAddress",
"type": "address"
},
{
"internalType": "uint256",
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "assetId",
"type": "uint256"
},
@critesjosh
critesjosh / setupSdk.js
Created May 19, 2022 14:45
[WIP] broken setup script for the aztec sdk
import {
AccountId,
AztecSdk,
createAztecSdk,
WalletProvider,
EthersAdapter,
EthAddress,
EthereumProvider,
SchnorrSigner,
TxSettlementTime,
@critesjosh
critesjosh / Example.sol
Last active April 15, 2022 17:41
Example solidity contract that uses the randomness contract
import "celo-monorepo/packages/protocol/identity/interfaces/IRandom.sol";
import "celo-monorepo/packages/protocol/common/interfaces/IRegistry.sol";
contract Example {
function test() external view returns (bytes32 randomness) {
randomness = IRandom(
IRegistry(0x000000000000000000000000000000000000ce10)
.getAddressFor(keccak256(abi.encodePacked("Random")))
).random();
}
@critesjosh
critesjosh / validate.js
Created March 17, 2022 20:10
validate a Celo account with regex
const regex = /^0x[a-fA-F0-9]{40}$/
const validAddress = "0x3cF01283119ECb00590F7eD1f5BFf863B43160b3"
const validResult = regex.exec(validAddress)
console.log(validResult)
const invalidAddress = "0xabv342{"
const invalidResult = regex.exec(invalidAddress)
console.log(invalidResult)
@critesjosh
critesjosh / createAccount.js
Created March 17, 2022 20:02
create a new Celo account in node.js
const { ethers } = require("ethers");
const wallet = new ethers.Wallet.createRandom();
console.log(`PRIVATE_KEY="` + wallet.privateKey + `"`);
console.log(`Your account address: `, wallet.address);