- https://redd.it/83d3lz
- CryptoPrimitive slack invite. Make sure to check out #weekend-hackathon!
Table of Content
Smart contracts should, in theory, make coordination easier.
Then, with Python's strength in rapid prototyping, we could build as we use them. So as I build a given interface, I could, say, open BP with a few keystrokes, and trust that it might get seen within the dev group and taken care of within minutes.
The focus will be on quickly building Python apps that the participants can use via command-line right away. We will begin by interfacing with the already-written contracts here: Burnable Payments, BurnChat, and CrowdServe. This should be accomplished at a basic level within the first few hours.
After that, the focus of the hackathon will be on making interaction easier and more fluid via Python command line or simple GUI.
brew install python3
pip3 install --upgrade pip
pip install web3 --pre
# - OR -
pip install web3==4.0.0b11 # https://gitter.im/ethereum/web3.py?at=5a98dc0a6f8b4b9946dc1a32
python3
from cli import bp
bp.getBPCount()
bp.getBP(0)
https://populus.readthedocs.io/en/latest/dev_cycle.html
brew install python3
pip3 install --upgrade pip
pip install virtualenv
virtualenv myenv
./myenv/bin/pip install web3
# Install following packages to complie https://github.com/ludbb/secp256k1-py
# needed while installing populus
brew install pkg-config libffi autoconf automake libtool openssl
# Needed while finishing populus installation
sudo touch /usr/local/LICENSE
sudo chown "$(whoami)" /usr/local/LICENSE
./myenv/bin/pip install populus
# - OR -
git clone https://github.com/ethereum/populus.git
cd populus
pip install -e . -r requirements-dev.txt
./myenv/bin/populus init
# Install solidiy (solc) to compile solidity souce code
# http://solidity.readthedocs.io/en/develop/installing-solidity.html
brew tap ethereum/ethereum
brew install solidity
./myenv/bin/populus compile
# Test deploy, no need to run before py.test
./myenv/bin/populus deploy --chain tester Donator
# Unit-testing
# py.test required eth-utils 0.7.* version
./myenv/bin/pip install eth-utils==0.7.*
./myenv/bin/pytest
# test selected test file
./myenv/bin/pytest tests/test_project_ownership.py --disable-pytest-warnings
# test selected test-case
./myenv/bin/pytest tests/test_project_ownership.py::test_another_participant --disable-pytest-warnings
More about solidity contract testing using populus at http://populus.readthedocs.io/en/latest/testing.html#web3
http://populus.readthedocs.io/en/latest/dev_cycle.part-06.html
# install geth
brew tap ethereum/ethereum
brew install ethereum
# init new chain and run
./myenv/bin/populus chain new horton
chains/horton/./init_chain.sh
chains/horton/./run_chain.sh
# deploy contracts to the new chain (--no-wait-for-sync to use dummy Ether to run the transaction immediately)
./myenv/bin/populus deploy --chain horton Donator --no-wait-for-sync
http://populus.readthedocs.io/en/latest/dev_cycle.part-07.html
Populus does not ask you for the address and the ABI of the projects’ contracts: it already has the address in the registrar file at registrar.json, and the ABI in build/contracts.json
./myenv/bin/python3 scripts/donator.py
http://populus.readthedocs.io/en/latest/dev_cycle.part-08.html
solc --abi contracts/Donator.sol
./myenv/bin/python3 cli/donator.py
ganache-cli
for example
npm install -g ganache-cli
ganache-cli -p 7545
Add following config to "chains": { ... }
in project.json
"ganache": {
"chain": {
"class": "populus.chain.ExternalChain"
},
"web3": {
"provider": {
"class": "web3.providers.rpc.HTTPProvider",
"settings": {
"endpoint_uri": "http://127.0.0.1:7545"
}
}
},
"contracts": {
"backends": {
"JSONFile": {"$ref": "contracts.backends.JSONFile"},
"ProjectContracts": {
"$ref": "contracts.backends.ProjectContracts"
}
}
}
}
./myenv/bin/populus deploy --chain ganache Donator --no-wait-for-sync
Check out https://github.com/cryptoprimitive/CPTools for details
git submodule add https://github.com/cryptoprimitive/CPTools.git cptools
git submodule update
cd cptools
python3
from cptools import cptools
cptools.printNumberedAccountList()
cptools.printUpdates()
See security
brew install node
npm i npm to update
npm install -g truffle
# https://ethereum.stackexchange.com/questions/42840/contracts-will-not-compile-using-truffle-with-the-emit-keyword-included-in-fro/42849
npm install -g [email protected]
npm install -g ganache-cli
ganache-cli -p 7545
open migrations/2_deploy_contracts.js
# Add contracts wanted to deploy
truffle migrate --network development
truffle console --network development
https://vyper.readthedocs.io/en/latest/vyper-by-example.html https://www.reggie.io/blog/deploying-ethereum-viper/ https://github.com/ethereum/pyethereum/wiki/Using-pyethereum.tester