On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8.
Install Homebrew Cask first if you haven’t:
brew update
brew tap caskroom/cask
# A Boolean True Expression Between Special Characters | |
{|"\\"|}="\"\\\\\"";; | |
# A Boolean True Expression Between Strong Literals | |
{delimiter|the end of this|}quoted string is here|delimiter} | |
= "the end of this|}quoted string is here";; |
/// @dev given a number get a slice of any bits, at certain offset | |
/// @param _n a number to be sliced | |
/// @param _nbits how many bits long is the new number | |
/// @param _offset how many bits to skip | |
function _sliceNumber(uint256 _n, uint256 _nbits, uint256 _offset) private pure returns (uint256) { | |
// mask is made by shifting left an offset number of times | |
uint256 mask = uint256((2**_nbits) - 1) << _offset; | |
// AND n with mask, and trim to max of _nbits bits | |
return uint256((_n & mask) >> _offset); | |
} |
pragma solidity ^0.4.14; | |
/* | |
Example of how to verify BLS signatures and BGLS aggregate signatures in Ethereum. | |
Signatures are generated using https://github.com/Project-Arda/bgls | |
Code is based on https://github.com/jstoxrocky/zksnarks_example | |
*/ | |
contract BLSExample { |
0x00 0 STOP | |
0x01 3 ADD | |
0x02 5 MUL | |
0x03 3 SUB | |
0x04 5 DIV | |
0x05 5 SDIV | |
0x06 5 MOD | |
0x07 5 SMOD | |
0x08 8 ADDMOD | |
0x09 8 MULMOD |
# Baby Step Giant Step DLP problem y = a**x mod n | |
# Example 70 = 2**x mod 131 | |
# Use SAGE for complex operations | |
y = 70 | |
a = 2 | |
n = 131 |
// package.json | |
{ | |
"dependencies": { | |
"web3": "0.17.0-alpha", | |
"solc": "^0.4.4" | |
} | |
} | |
//Create file Ecrow.sol and create 3 variables: a buyer, a seller, and an arbiter | |
contract Escrow { |
This gist shows how formal conditions of Solidity smart contracts can be automatically verified even in the presence of potential re-entrant calls from other contracts.
Solidity already supports formal verification of some contracts that do not make calls to other contracts. This of course excludes any contract that transfers Ether or tokens.
The Solidity contract below models a crude crowdfunding contract that can hold Ether and some person can withdraw Ether according to their shares. It is missing the actual access control, but the point that wants to be made
contract auction { | |
// An auction contract written in Solidity | |
// Can be deployed similarly to what is described at: | |
// https://dappsforbeginners.wordpress.com/tutorials/your-first-dapp/ | |
// Initialization. | |
// Remembering bids from each address. | |
mapping (address => uint) bids; | |
// Also remembering the max_bid and the max_bidder to easily determine the winner. | |
uint max_bid = 0; |
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt |