Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
set "GOPATH=C:\g\ethereum\go-ethereum-src"
set "Path=%USERPROFILE%\bin;%Path%"
setx GOPATH "%GOPATH%"
setx Path "%Path%"
mkdir src\github.com\ethereum
git clone https://github.com/ethereum/go-ethereum src\github.com\ethereum\go-ethereum
cd src\github.com\ethereum\go-ethereum
go get -u -v golang.org/x/net/context
@ericmaino this is how to install Node 6 or 7 on Ubuntu, via PPA
`curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -`
`curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -`
@cicorias
cicorias / Provenance.sol
Created February 4, 2017 03:06
Ethereum solidity provenance
// provenance concept contract created by M.ElBoudi, A.Blackwell, M.Terzi et al during Ethereum development workshop in London
contract Certifiers {
mapping (address => bool) certifier;
address provenance;
//initialiser is run the first time the contract is uploaded to the network. Launched by Provenance and reads provenance "public key"
function Certifiers () {
provenance = msg.sender;
}
@cicorias
cicorias / genesis-what.md
Created March 10, 2017 00:20
Explain the genesis file

Genesis block Explanation

mixhash A 256-bit hash which proves, combined with the nonce, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoW). The combination of nonce and mixhash must satisfy a mathematical condition described in the Yellowpaper, 4.3.4. Block Header Validity, (44). It allows to verify that the Block has really been cryptographically mined, thus, from this aspect, is valid.

nonce A 64-bit hash, which proves, combined with the mix-hash, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoW). The combination of nonce and mixhash must satisfy a mathematical condition described in the Yellowpaper, 4.3.4. Block Header Validity, (44), and allows to verify that the Block has really been cryptographically mined and thus, from this aspect, is valid. The nonce is the cryptographically secure mining proof-of-work that proves beyond reasonable doubt that a particular amount of computation has been expended

@cicorias
cicorias / ExampleLOC-.md
Last active March 10, 2017 01:28
Some Smart Contract stuff

Skip to contentCrypto Posts https://rajbhadra.wordpress.com/2016/09/26/blockchain-based-letter-of-credit-implementation/ Home About Contact Blockchain based Letter of Credit implementation Posted on September 26, 2016 by rajbhadra Alice lives in America has an animal husbandry farm. Her farm has developed a cattle breed with advantageous properties. She is keen on selling them and lets people know of her desire.

Bob hears extremely positive reviews of Alice’s endeavor from his American peers and decides to purchase a bunch her cattle to fulfill the needs of his Belgian farm.

He requests Alice for a large order and they reach an agreement. Alice will ship the goods through Charlie the Carrier. Alice wants the funds to be delivered in Bank of Alice and Bob will utilize Bank of Bob. Alice does not trust Bob and being a canny businesswoman requests a Letter of Credit.

@cicorias
cicorias / PriceFeed_cryptocompare
Created March 10, 2017 04:03 — forked from anonymous/PriceFeed_cryptocompare
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.9+commit.364da425.js&optimize=undefined&gist=
// Ethereum + Solidity
// This code sample & more @ dev.oraclize.it
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract PriceFeed is usingOraclize {
uint public ETHUSD;
function PriceFeed(){
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
@cicorias
cicorias / web3-solc-contract-compile-deploy.js
Created March 12, 2017 00:06 — forked from tomconte/web3-solc-contract-compile-deploy.js
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);
@cicorias
cicorias / compile-deploy-sign.js
Created March 12, 2017 00:06 — forked from tomconte/compile-deploy-sign.js
Shows how to compile and deploy a Smart Contract using client-side transaction signature, i.e. does not require the account to be unlocked in the Ethereum node.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
const Tx = require('ethereumjs-tx')
// Private key to use to sign the transactions
// To decrypt your private key, use e.g. https://www.myetherwallet.com/#view-wallet-info
// You will find your private key file in e.g. .ethereum/keystore or .parity/keys
// In this example the key should correspond to the web3.eth.coinbase address
var privateKey = new Buffer('088c110b6861b6c6c57461370d661301b29a7570d59cb83c6b4f19ec4b47f642', 'hex')
@cicorias
cicorias / truffle-config.js
Created March 12, 2017 17:06 — forked from tomconte/truffle-config.js
Example Truffle 3.0 configuration file to allow deploying contracts to an Azure "Bletchley" Ethereum consortium network. Based on the Truffle docs for Infura (http://truffleframework.com/tutorials/using-infura-custom-provider).
var bip39 = require("bip39");
var ethwallet = require('ethereumjs-wallet');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");
// Insert raw hex private key here, e.g. using MyEtherWallet
var wallet = ethwallet.fromPrivateKey(Buffer.from('324a58ceac32c9a5a465a57a87600c086df72aa4ae0c6beb062436a2b6c0a2a6', 'hex'));
@cicorias
cicorias / mock_notification.js
Created March 14, 2017 09:30 — forked from danfinlay/mock_notification.js
A simple metamask notification code example.
var state = {
imageifyIdenticons: false,
txData: {
"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false
},
accounts: {
'0xfdea65c8e26263f6d9a1b5de9555d2931a33b825': {
balance: "0x15e578bd8e9c8000",
}
},