HackMD
    • Sharing Link copied
    • /edit
    • View mode
      • Edit mode
      • View mode
      • Book mode
      • Slide mode
      Edit mode View mode Book mode Slide mode
    • Note Permission
    • Read
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • Write
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • More (Comment, Invitee)
    • Publishing
    • Commenting Enable
      Disabled Forbidden Owners Signed-in users Everyone
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Invitee
    • No invitee
    • Options
    • Versions and GitHub Sync
    • Transfer ownership
    • Delete this note
    • Template
    • Save as template
    • Insert from template
    • Export
    • Google Drive Export to Google Drive
    • Gist
    • Import
    • Google Drive Import from Google Drive
    • Gist
    • Clipboard
    • Download
    • Markdown
    • HTML
    • Raw HTML
Menu Sharing Help
Menu
Options
Versions and GitHub Sync Transfer ownership Delete this note
Export
Google Drive Export to Google Drive Gist
Import
Google Drive Import from Google Drive Gist Clipboard
Download
Markdown HTML Raw HTML
Back
Sharing
Sharing Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
More (Comment, Invitee)
Publishing
More (Comment, Invitee)
Commenting Enable
Disabled Forbidden Owners Signed-in users Everyone
Permission
Owners
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Invitee
No invitee
   owned this note    owned this note      
Published Linked with GitHub
Like BookmarkBookmarked
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Alpha Casper FFG Testnet Instructions _This document is waaay outdated and is being kept only for archaeology purposes._ ----------- Welcome to the first release of the alpha Casper FFG testnet, built on pyethereum. This network represents the result of years of work on cryptoeconomic proof-of-stake and months of active development of the client, and is a fully-featured and usable network, allowing users to send transactions, mine and become validators. However, this is still several steps away from a network that will be ready for launch. Some parameters are set differently from the intended final settings, and the currently only available client, pyethereum, has a much lower processing capacity than clients implemented in faster languages; as a result, network parameters will be heavily restricted to ensure network sustainability. **Do not expect performance equivalent to test networks operated by more performant clients such as Geth and Parity**. ### What is Casper FFG and how does it work? This is out of scope of this document, but you can find info in these links: * [Proof of stake FAQ](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ) * [Casper FFG paper](https://arxiv.org/abs/1710.09437) * [Presentation by Karl Floersch](https://www.youtube.com/watch?v=ycF0WFHY5kc) * [Jon Choi's Casper 101](https://medium.com/@jonchoi/ethereum-casper-101-7a851a4f1eb0) The rest of this document assumes some familiarity with Casper FFG. ### Just taking a look If you want to go straight to running a node, feel free to skip straight to the next section ("Running a Node") Look at the ethstats page here: [http://34.203.42.208:3000/](http://34.203.42.208:3000/) Also, you can use web3 (installation: `sudo pip3 install web3`) to connect to a node as follows (assuming python 3): ```python > from web3 import Web3, HTTPProvider > web3 = Web3(HTTPProvider('http://52.87.179.32:8545')) > web3.eth.getBlock('latest') # This should return the head of the chain ``` Then: ```python > import urllib.request, json # This may take a while depending on your internet connection > casper_abi = json.load(urllib.request.urlopen( "https://gist.githubusercontent.com/vbuterin/868a6213b058fb4f1fdfcf64e54f0e91/raw/33fc177da3863ec320d1ebf95816ba52ffbffbe8/casper_abi")) > casper = web3.eth.contract(abi=casper_abi, address='0xbd832b0cd3291c39ef67691858f35c71dfb3bf21').call() # This should return the current epoch > casper.get_current_epoch() ``` Look through [the Casper contract](https://github.com/ethereum/casper/blob/master/casper/contracts/simple_casper.v.py) to see all the functions that you can call. Any public variable has a corresponding getter method, eg. a variable `x`, if it's public, has the corresponding getter `get_x()`; see the Viper documentation for a more complete description on what getters are available. ### Running a node To run a node, follow the following instructions to download and run a Docker instance: Installing docker (if you do not yet have it) on Ubuntu: ```bash curl -fsSL get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER ``` Make sure to log out and log back in after this step. On MacOS, follow the instructions here: https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac Getting the docker containers for the testnet nodes (warning, this involves a few hundred MB of downloading) ```bash $ git clone http://github.com/karlfloersch/docker-pyeth-dev $ cd docker-pyeth-dev $ make new-account 🌟 Creating keystore directory at ./validator/data/config/keystore 🌟 Enter a new password to encrypt your account: 🌟 Your password is stored at ./validator/data/config/password.txt 🌟 Pyethapp container is creating new address for you, might take few seconds: ``` Running: ```bash $ make run-node bootstrap_node=enode://d3260a710a752b926bb3328ebe29bfb568e4fb3b4c7ff59450738661113fb21f5efbdf42904c706a9f152275890840345a5bc990745919eeb2dfc2c481d778ee@54.167.247.63:30303 ``` If that enode does not work, try replacing with: `enode://a120401858c93f0be73ae7765930174689cad026df332f7e06a047ead917cee193e9210e899c3143cce55dd991493227ecea15de42aa05b9b730d2189e19b567@52.87.179.32:30303` If you are running a node, then you can use web3.py to connect to it: ```bash $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 20a0dfe1d9e2 casper-validator "sh /root/start.sh p…" 18 minutes ago Up 18 minutes 8545/tcp, 30303/tcp, 30303/udp validator $ docker exec -it 20a0dfe1d9e2 python ``` Replace `20a0dfe1d9e2` with whatever container ID appears in the output when you run `docker ps`. Then repeat the web3 instructions above inside the python console that appears, but use `Web3(HTTPProvider('http://localhost:8545'))` in place of the remote node. To mine: ```bash $ make run-node mine_percent=90 bootstrap_node=enode://d3260a710a752b926bb3328ebe29bfb568e4fb3b4c7ff59450738661113fb21f5efbdf42904c706a9f152275890840345a5bc990745919eeb2dfc2c481d778ee@54.167.247.63:30303 ``` If you get an error like this: ``` docker: Error response from daemon: Conflict. The container name "/validator" is already in use... ``` Then, you can fix by running `docker rm validator`. ### Running a validator First, you will need to have enough testnet ETH to become a validator. You can either mine a lot of blocks, or ask us for ETH (faucet may be available soon). To ask for ETH, you will need to have an ETH address. You can either use a keystore file you already generated on your own, eg. using geth or pyeth_keys, or generate one with the docker tools. To login as a validator with the account you generated by running the `make new-account` command above, run: ``` make run-node validate=true deposit=2000 bootstrap_node=enode://d3260a710a752b926bb3328ebe29bfb568e4fb3b4c7ff59450738661113fb21f5efbdf42904c706a9f152275890840345a5bc990745919eeb2dfc2c481d778ee@54.167.247.63:30303 ``` Replacing 2000 with whatever amount of ETH you want to deposit (min 1500). From there, just leave the docker node running. Note that once you log on, it will take ~1.5 dynasties (normally, ~30 minutes) until you are in the active validator set and can start voting. ### Checking your status Aside from the web3 route, you can also play around with the node directly through the python console. Press Ctrl+C inside of it, and you will see an instruction like `Hit [ENTER], to launch console; [Ctrl+C] again to quit! [0s]`. Press Ctrl+C again and you will enter the console. From there, you can use `eth.chain` to access the pyethereum Chain object (see documentation [here](https://github.com/ethereum/pyethereum)). Use `eth.services.accounts.accounts[0].address` to get your validator's address, which is also used as a kind of ID for the validator. You can also create a python object that will let you call commands of the Casper contract as so: ```python >> import urllib.request, json >> casper_abi = casper_abi = json.load(urllib.request.urlopen( "https://gist.githubusercontent.com/vbuterin/868a6213b058fb4f1fdfcf64e54f0e91/raw/33fc177da3863ec320d1ebf95816ba52ffbffbe8/casper_abi")) >> from ethereum.tools import tester >> casper = tester.ABIContract(tester.State(eth.chain.state), casper_abi, '0xbd832b0cd3291c39ef67691858f35c71dfb3bf21') >> casper.get_current_epoch() # This should return the current epoch number ``` To get data about yourself, do: ```python >> my_index = casper.get_validator_indexes(eth.services.accounts.accounts[0].address) >> # This should return your current deposit size >> casper.get_deposit_size(my_index) >> # This should return the current dynasty, and your validator's start and end dynasty >> casper.get_dynasty(), casper.get_validators__start_dynasty(my_index), casper.get_validators__end_dynasty(my_index) ``` Note that you will need to re-run the `casper = tester.ABIContract...` line in order to call Casper with the most recent state. To broadcast a transaction, use `eth.app.services.chain.broadcast_transaction(tx)` To exit pyethapp, type Ctrl+D. ### Logging out You can log out with the command: ``` make run-node validate=true logout=true bootstrap_node=enode://d3260a710a752b926bb3328ebe29bfb568e4fb3b4c7ff59450738661113fb21f5efbdf42904c706a9f152275890840345a5bc990745919eeb2dfc2c481d778ee@54.167.247.63:30303 ``` Then just leave the validator running, and after the withdrawal period ends it will automatically send another transaction to withdraw you. Note that in general, staying online is important. You as a validator will only be profitable if you are online more than half the time in the normal case, and if many other validators are offline than you may need to be online almost all of the time in order not to incur a loss.

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lost their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.


Upgrade

All
  • All
  • Team
No template.

Create a template


Upgrade

Delete template

Do you really want to delete this template?

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Sign in via SAML

or

Sign in via GitHub

Help

  • English
  • 中文
  • 日本語

Documents

Tutorials

Book Mode Tutorial

Slide Example

YAML Metadata

Resources

Releases

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions

Versions and GitHub Sync

Sign in to link this note to GitHub Learn more
This note is not linked with GitHub Learn more
 
Add badge Pull Push GitHub Link Settings
Upgrade now

Version named by    

More Less
  • Edit
  • Delete

Note content is identical to the latest version.
Compare with
    Choose a version
    No search result
    Version not found

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub

      Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

       Sign in to GitHub

      HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Available push count

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully