Skip to content

Instantly share code, notes, and snippets.

View afope's full-sized avatar
🤖

afọpẹ́fólúwa òjó afope

🤖
View GitHub Profile
@afope
afope / deploy_a_smart_contract.js
Last active April 28, 2020 15:29
Deploying a smart contract
const HDWalletProvider = require("@truffle/hdwallet-provider");
require('dotenv').config(); // Store environment-specific variable from '.env' to process.env
const rpcURL = 'YOUR_RPC_URL_GOES_HERE';
let creds = process.env.USERNAME + ':' + process.env.PASSWORD;
const secURL = 'https://' + creds + '@' + rpcURL;
module.exports = {
/**
* Networks define how you connect to your ethereum client and let you set the
@afope
afope / listening_to_events.js
Last active April 28, 2020 15:13
Listening to events
coconst Web3 = require('web3');
const username = 'YOUR_USERNAME_HERE';
const password = 'YOUR_PASSWORD_HERE';
const url = 'YOUR_URL_HERE'; // make sure to strip the wss:// prefix!
const wsSecURL = 'wss://' + username + ':' + password + '@' + url;
const web3ws = new Web3(new Web3.providers.WebsocketProvider(wsSecURL));
const tether_abi = require('./tether_abi.json'); // you can copy the ABI for the Tether contract here: https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7#code
@afope
afope / send_a_transaction.js
Last active June 6, 2020 06:32
Send a transaction
// require dependencies
const Web3 = require('web3');
const EthTx = require('ethereumjs-tx').Transaction;
// assign address and private key to account
const account = {
address: 'YOUR_ETHEREUM_ADDRESS_GOES_HERE', // Your address goes here
privateKey: 'YOUR_PRIVATE_KEY_GOES_HERE' // Your private key goes here
};
@afope
afope / turtle_circles.py
Created January 2, 2018 19:44 — forked from macloo/turtle_circles.py
Use random numbers to make 100 circles with Python's turtle module.
# fun with turtle, a Python module
# draw 100 circles of many colors
# http://docs.python.org/3.1/library/turtle.html
# http://static.michael0x2a.com/turtle_examples.html
# http://www.eg.bucknell.edu/~hyde/Python3/TurtleDirections.html
import random
import time
import turtle
t = turtle.Pen()