Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tutorials to v0.4.0. should change whole tutorial story #3

Merged
merged 26 commits into from
Nov 14, 2021

Conversation

brenzi
Copy link
Member

@brenzi brenzi commented Jun 6, 2021

No description provided.

@brenzi
Copy link
Member Author

brenzi commented Aug 8, 2021

@anizeani as we now have inverse meetup logic, the tutorials are out of date. from the changes in the bot-community script you should be able to derive what needs to be changed in the tutorial
so it's not only python instead of bash, it's also about sending other's attestations istead of own

@brenzi
Copy link
Member Author

brenzi commented Sep 18, 2021

@anizeani what is the status?

@anizeani
Copy link
Contributor

My changes are for now in the branch:
https://github.com/encointer/book/commits/TutorialPythonInsteadOfBash
Do you want to review?

@brenzi
Copy link
Member Author

brenzi commented Sep 18, 2021

yes, please merge your changes into this PR so I can comment here

@brenzi
Copy link
Member Author

brenzi commented Oct 22, 2021

is this ready for review?

@anizeani
Copy link
Contributor

I want to make some minor changes until comming monday.

@anizeani
Copy link
Contributor

now you can review

@brenzi
Copy link
Member Author

brenzi commented Oct 27, 2021

The following is outdated.

## Play!
But now you'd like to play with it, right? So get our cli client and start playing! The following instructions start from prebuilt binaries for ubuntu 18.04. If you use some other OS, you will have to build the client yourself.
```console
mkdir test
cd test
wget https://github.com/encointer/encointer-node/releases/download/v0.4.0/encointer-client-notee
chmod u+x encointer-client-notee
ln -s encointer-client-notee encointer-client
./encointer-client -u wss://gesell.encointer.org -p 443 get-phase
```
you should see either of REGISTERING, ASSIGNING or ATTESTING
for simplicity, we'll create an alias for the client
```console
# Gesell node endpoint
NURL=wss://gesell.encointer.org
NPORT=443
alias nctr="./encointer-client -u $NURL -p $NPORT"
```
let's create a new account
```console
> nctr new-account
5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
# you can now check that your local keystore has a new entry
> ls my_keystore
73723235ae365cf166bab30448f25b3751b06d034be9c992a8ba5501d3adcde640ab9b1e
> nctr balance 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
ERT balance for 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex 0
```
As with other blockchains, you'll need some funds in order to pay fees. As you can read in our whitepaper, we'll avoid this entry barrier in the future. We have a faucet in place that gets you started immediately:
```bash
> nctr faucet 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
```
Should the faucet be exhausted, please post a message to our [element channel](https://app.element.io/#/room/#encointer:matrix.org) and friendly request some topup. Please be patient.
```bash
> nctr balance 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
ERT balance for 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex is 998999854
# now you could send around your new ERT
> nctr transfer 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex 5G18LaJA315RwJqtYYbWrbE52g9FEQCgBYN1A1XG66XnKAw5 123456789
```
Let's create and fund two more accounts for later use:
```console
nctr new-account
nctr new-account
```
giving us `5Dy4K5eNr13D37NcMcq4ffQZBAmt9BZhkgi5kBGuUWwK8cB7` and `5GCdWmdr5eZRvRPx6XE8YxFD472EvSMSTK6GQCHyuiNnw7rK` which we will fund with
```console
nctr faucet 5Dy4K5eNr13D37NcMcq4ffQZBAmt9BZhkgi5kBGuUWwK8cB7 \
5GCdWmdr5eZRvRPx6XE8YxFD472EvSMSTK6GQCHyuiNnw7rK
```
## Bootstrap your own currency
Now that we have some funds to pay platform fees, we can start our own local currency and bootstrap a bot population!
Define Meetup Locations
First of all, we need to define in what region the currency shall be issued. For this we use the geojson standard to define a set of meetup places and add some meta-information about the currency. You can use geojson.io to select meetup places on a map (define a few "Points"). Make sure that you select places that are >100m apart. You also need to keep this minimal distance from other registered currencies. You can list all registered currencies with
```bash
> nctr list-currencies
```
Our [explorer](https://explorer.encointer.org) allows you to browse all regsitered currencies and their attributes on a map.
The number of locations that you should define depends on the size of the population N you'd like to bootstrap. As a rule of thumb, there should be at least N locations in order to guarantee reasonable randomization. As a maximum of 12 people can attend the same meetup the hard lower limit is N/12.
## Trusted Setup
Every local currency needs a trusted setup. A trustworthy group of 3-12 local people will hold the bootstrapping ceremony publicly. These bootstrappers need to be defined in the metadata block:
```json
{
"type": "FeatureCollection",
"community": {
"meta": {
"name": "Mediterranea",
"symbol": "MTA",
"icons": "QmVmew4gZHyCK2Fv4UBgsvfLdf1Q6UiF9MD6wsfPCuNVQp"
},
"bootstrappers": [
"5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex",
"5Dy4K5eNr13D37NcMcq4ffQZBAmt9BZhkgi5kBGuUWwK8cB7",
"5GCdWmdr5eZRvRPx6XE8YxFD472EvSMSTK6GQCHyuiNnw7rK"
]
},
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
11.25,
40.03182061333687
]
}
}
]
}
```
As one of the bootstrappers, you can now save the above to minimal.json and register your new currency:
```bash
> nctr new-currency minimal.json 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES
```
Your currency has been registered and the return value is your currency-identifier (cid). Let's check the registry again:
```bash
> nctr list-currencies
number of currencies: 1
currency with cid HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES
```
In order to bootstrap your bot currency, You'll need to fund all bootstrappers and register all of them
```bash
#check if phase is REGISTERING
nctr get-phase
# REGISTERING
# ok, let's register, but first we will define a few variables and a new alias
alias nctr="./encointer-client -u $NURL -p $NPORT --cid HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES"
account1=5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex
account2=5Dy4K5eNr13D37NcMcq4ffQZBAmt9BZhkgi5kBGuUWwK8cB7
account3=5GCdWmdr5eZRvRPx6XE8YxFD472EvSMSTK6GQCHyuiNnw7rK
nctr register-participant $account1
nctr register-participant $account2
nctr register-participant $account3
# if everything goes well, you should find your registrations here:
nctr list-participants
```
giving us
```console
listing participants for cid HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES and ceremony nr 38
number of participants assigned: 3
ParticipantRegistry[38, 1] = 7080e1799d2e646d8b3f9e7eab53b2f011476d6fd4abe3ac69aa039bf3f11440 (5EcDWHsG...)
ParticipantRegistry[38, 2] = b6fc46e65b3b24af03845fa12917668863db7b5bd46d6125643170400ca25c41 (5GCdWmdr...)
ParticipantRegistry[38, 3] = 5429da7a940f960b9a79cb1b7889142b8ee209b7f43ac5953df9c56f1bc0a726 (5Dy4K5eN...)
```
Now you'll have to wait ~10min until the ceremony phase turns to ASSIGNING. The blockchain then assigns all participants to randomized groups that will have to meet at a random meetup location at a specific time. Participants can learn their assignment with:
```bash
> nctr list-meetups
listing meetups for cid HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES and ceremony nr 38
number of meetups assigned: 1
MeetupRegistry[38, 1] location is Some(Location { lat: 40.0318206134, lon: 11.25 })
MeetupRegistry[38, 1] meeting time is Some(1586541900000)
MeetupRegistry[38, 1] participants are:
7080e1799d2e646d8b3f9e7eab53b2f011476d6fd4abe3ac69aa039bf3f11440 (5EcDWHsG...)
b6fc46e65b3b24af03845fa12917668863db7b5bd46d6125643170400ca25c41 (5GCdWmdr...)
5429da7a940f960b9a79cb1b7889142b8ee209b7f43ac5953df9c56f1bc0a726 (5Dy4K5eN...)
```
The ceremony phase will change to ATTESTING before the date of the ceremony.
An encointer ceremony happens at high sun on the same day all over the world. This way, no single person can attend more than one meetup. At each meetup, participants attest each others personhood. For this testnet, however, we don't care about real time or physical presence as we're testing with bot communities. See [Time Warping](./testnets.html#time-warping-for-testnets) to learn how the timing maps between mainnet and Gesell.
Our bot communities can perform meetups simply with the following lines. In later networks, a mobile app will be used (similar to what we demonstrated in PoC1).
```bash
# each participant generates a claim of attendance including her vote on how many people N are actually physically present at that moment
claim1=$(nctr new-claim $account1 3)
claim2=$(nctr new-claim $account2 3)
claim3=$(nctr new-claim $account3 3)
# this claim is then sent to all other participants who will verify them and sign an attestation
witness1_2=$(nctr sign-claim $account1 $claim2)
witness1_3=$(nctr sign-claim $account1 $claim3)
witness2_1=$(nctr sign-claim $account2 $claim1)
witness2_3=$(nctr sign-claim $account2 $claim3)
witness3_1=$(nctr sign-claim $account3 $claim1)
witness3_2=$(nctr sign-claim $account3 $claim2)
# and send that attestation back to the claimant who assembles all attestations and sends them to the chain
nctr register-attestations $account1 $witness2_1 $witness3_1
nctr register-attestations $account2 $witness1_2 $witness3_2
nctr register-attestations $account3 $witness1_3 $witness2_3
```
Now you have to wait for the ceremony phase to become REGISTERING. Then we can verify that our bootstrapping was successful and our bootstrappers have received their basic income issue on their accounts in units of the new currency (beware that we still use the alais including our cid. This means we're not querying ERT token balance, but the balnce in your new local currency).
```bash
> nctr balance $account1
NCTR balance for 5EcDWHsGzERpiP3ZBoFfceHpinBeifq5Lh1VnCkzxca9f9ex is 0.99999932394375560185 in currency HKKAHQhLbLy8b84u1UjnHX9Pqk4FXebzKgtqSt8EKsES
```
Your new currency has a very special property called [demurrage](./economics-demurrage.md). This means that the nominal value of your holdings decreases over time. Currently it is halving every year. You can observe this by waiting for a few blocks and checking your balance again. Think of this demurrage like a solidarity fee that you pay to the decentralized "state" that takes care of redistributing wealth among the local population at every ceremony as newly issued basic income.

I suggest to not just fix it as it is a mostly boring tutorial

This tutorial should be re-purposed to "how to bootstrap an encointer community"

  1. create bootstrapper accounts
  2. manually compose a community spec json file with the help of geojson.io
  3. register community

@anizeani
Copy link
Contributor

I have pushed a new version. I explain the functionality of the python script in detail.
Nevertheless, I think the Bash tutorial is still helpfull to understand many basic functionalities which are wrapped in the pyhton client. I therefore splittet the tutorial into Bootstrapping a comunity automated/manually

@anizeani anizeani marked this pull request as draft October 28, 2021 15:19
@brenzi
Copy link
Member Author

brenzi commented Oct 31, 2021

I don't like the structure yet. You start with Gesell -> Tutorial, but then you begin with explaining a local test. Only when scrolling down you see the instructions to register a community on Gesell.

It should be clear from the TOC what happens on Gesell or Locally

@anizeani anizeani marked this pull request as ready for review November 14, 2021 07:28
@brenzi brenzi merged commit d5d9a3d into master Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants