Skip to content

Instantly share code, notes, and snippets.

@peekpi
peekpi / [email protected]
Created March 25, 2022 16:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
@peekpi
peekpi / README.md
Last active April 6, 2021 15:41
example for RPC trace_block

run commond below, the parameter is block number:

curl --request POST 'http://52.147.194.138:9500' --header 'Content-Type: application/json' --data-raw '{
    "jsonrpc": "2.0",
    "method": "trace_block",
    "params": ["0x766914"],
    "id": 1
}'
@peekpi
peekpi / README.md
Last active November 18, 2020 03:26
trace inner transaction
  • complex.sol: the contract used for testing
  • trace.js: the js script to trace internal transactions
  • response_raw.json: raw response in json
  • response_format.txt: formated response

run node trace.js to get the inner transactions. The txhash and node url is hardcoded into the script.

curl example:

curl --request POST 'http://40.70.223.9:9500' --header 'Content-Type: application/json' --data-raw '{
@peekpi
peekpi / Complex.sol
Last active November 6, 2020 14:50
try generate inter transactions with tracer module
pragma solidity ^0.6.2;
contract SubContract {
function _revert(bool cond, string memory error) public pure {
require(cond, error);
}
function destruct() public {}
function deposit() payable public {}
// src/app.ts
// import "./dashboard";
//import "./explorer";
import express from "express";
import http from "http";
import "source-map-support/register";
const app = express();
const server = http.createServer(app);
@peekpi
peekpi / generate_bitcoin_address.sh
Created July 26, 2018 10:36 — forked from colindean/generate_bitcoin_address.sh
Bitcoin address generator in bash
#!/bin/bash
#
# This is free and unencumbered software released into the public domain.
#
# Requires bc, dc, openssl, xxd
#
# by grondilu from https://bitcointalk.org/index.php?topic=10970.msg156708#msg156708
base58=({1..9} {A..H} {J..N} {P..Z} {a..k} {m..z})
bitcoinregex="^[$(printf "%s" "${base58[@]}")]{34}$"
@peekpi
peekpi / Controlled.sol
Created May 25, 2018 08:54
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract Controlled {
address public controller;
modifier onlyController {
require(msg.sender == controller);
_;
}
constructor() public
{
@peekpi
peekpi / Controlled.sol
Created May 25, 2018 02:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract Controlled {
address public controller;
modifier onlyController {
require(msg.sender == controller);
_;
}
constructor() public
{
@peekpi
peekpi / Controlled.sol
Last active May 24, 2018 14:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract Controlled {
address public controller;
modifier onlyController {
require(msg.sender == controller);
_;
}
constructor() public
{
@peekpi
peekpi / Controlled.sol
Created May 24, 2018 10:53
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract Controlled {
address public controller;
modifier onlyController {
require(msg.sender == controller);
_;
}
constructor() public
{