Skip to content

Instantly share code, notes, and snippets.

View tpmccallum's full-sized avatar

Timothy McCallum tpmccallum

View GitHub Profile
tpmccallum$ lityc/lityc --abi ~/simple_storage/simple_storage.sol 
[{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]
tpmccallum$ lityc/lityc --opcodes ~/simple_storage/simple_storage.sol 
PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xec DUP1 PUSH2 0x1f PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x49 JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xffffffff AND DUP1 PUSH4 0x60fe47b1 EQ PUSH1 0x4e JUMPI DUP1 PUSH4 0x6d4ce63c EQ PUSH1 0x85 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x59 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x83 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x6e JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0xad JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x90 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x97 PUSH1 0xb7 JUMP JUMPDEST PUSH1 0x40 MLOA
tpmccallum$ lityc/lityc --bin-runtime ~/simple_storage/simple_storage.sol
6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146085575b600080fd5b348015605957600080fd5b50608360048036036020811015606e57600080fd5b810190808035906020019092919050505060ad565b005b348015609057600080fd5b50609760b7565b6040518082815260200191505060405180910390f35b8060008190555050565b6000805490509056fea165627a7a7230582037a6182517eb7335095ca48cb7b895cbcbbdb824f48911f3f69fdc1869c7263e0029
tpmccallum$ lityc/lityc --bin ~/simple_storage/simple_storage.sol
608060405234801561001057600080fd5b5060ec8061001f6000396000f3fe6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146085575b600080fd5b348015605957600080fd5b50608360048036036020811015606e57600080fd5b810190808035906020019092919050505060ad565b005b348015609057600080fd5b50609760b7565b6040518082815260200191505060405180910390f35b8060008190555050565b6000805490509056fea165627a7a7230582037a6182517eb7335095ca48cb7b895cbcbbdb824f48911f3f69fdc1869c7263e0029
pragma solidity >=0.4.0 <0.6.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

Machine

  • i3.xlarge ($0.374 per Hour)
  • 1 x 950 NVMe SSD Storage
  • 4 CPU
  • 30.5 GB RAM

Software (OS)

sudo apt-get update sudo apt-get -y upgrade sudo apt-get install -y build-essential

@tpmccallum
tpmccallum / devchain_commandline_work.md
Last active August 8, 2019 06:09
The commands which I used to perform research, development and testing on the SecondState BaaS infrastructure

SecondState R&D

This file is a list of commands and links which I used to interact with the suite of SecondState tools and services.

Initialize SecondState Blockchain as a Service (BaaS)

Create new blockchain in just a few clicks at http://baas-mvp.secondstate.io/ Save the RPC endpoint and Smart Contract Search Engine URLs for our code below.

Install Ubuntu 18.04 Server and then run the following commands

@tpmccallum
tpmccallum / ethereum_full_node_on_aws.md
Last active August 4, 2019 23:40
Instructions on how to install a full node Ethereum blockchain

Machine

  • i3.xlarge ($0.374 per Hour)
  • 1 x 950 NVMe SSD Storage
  • 4 CPU
  • 30.5 GB RAM

Software (OS)

sudo apt-get update sudo apt-get -y upgrade sudo apt-get install -y build-essential

@tpmccallum
tpmccallum / deconstruct_uint256.md
Last active April 13, 2019 03:33
A design patter which allows big integers to be deconstructed into much smaller data types

Update: This idea has been moved to this GitHub repo for further development

A design pattern to deconstruct (big) blockchain integers such as uint256

This is a design which can be implemented in any language which supports modulo arithmetic and exponentiation (i.e. Python and even Solidity).

Function logic(psuedo code) to obtain any digit[s] from a uint256

((_value % (10 ** _position)) - (_value % (10 ** (_position - _size)))) / (10 ** (_position - _size));

Here are the descriptions for the pattern's arguments

@tpmccallum
tpmccallum / draft_ideas.md
Last active March 25, 2019 05:04
A comparison of uint256 and bytes32 as well as draft code to research and test for the Chopsticks Challenge

uint256 code example

contract ChopsticksBytes {
    uint256 a = 0;
    
    constructor() public{
        a = 1;
    }
   
}