-
Creating Ethereum testnet
- Info: https://medium.com/mercuryprotocol/how-to-create-your-own-private-ethereum-blockchain-dad6af82fc9f
- Get geth from : https://geth.ethereum.org/downloads/
- Create a genesis file: myGenesis.json with content:
{ "config": { "chainId": 1994, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0 }, "difficulty": "400", "gasLimit": "2000000", "alloc": { "7b684d27167d208c66584ece7f09d8bc8f86ffff": { "balance": "100000000000000000000000" }, "ae13d41d66af28380c7af6d825ab557eb271ffff": { "balance": "120000000000000000000000" } } }
- Initiate node:
geth --datadir ./myDataDir init ./myGenesis.json
- Delete generated DAG before starting node:
rm ~\AppData\Ethash\full*
- Start peer node:
geth –datadir ./myDataDir --networkid 1114 console 2>> myEth.log
- Read log: gc .\myEth.log | Select-String -Pattern "INFO" | Select-Object -Last 30
-
Golang templates (tags: golang html server template)
- Templates are you know what they are pfff.
- Parse whenever you parse new template text the previous one is overwritten (genius)
{{ define }}
and{{ template }}
don’t work with Parse- ParseFiles needs exact file location so forget that too.
- Important links: https://gowebexamples.com/templates/
-
Http post request form-data vs json data body
Form-data Json-data Content-Type: application/x-www-form-urlencoded
Content-Type: application/json
Example data: say=Hi&to=Mom
Example data: {“say”: “Hi”, “to”: “Mom”}
Form-data is sent by browser in a post request “json-data” is generally used in REST protocol -
Go channels:
- Create a channel: something := make(chan Struc)
- Write only:
chan<-
- Read only:
<-chan
- Imp links: https://tour.golang.org/concurrency/2
-
Golang testing:
- A test file ends with
{something}_test.go
- Execute with:
go test
- Call
t.Parallel()
to run that test in parallel to its siblings i.e. its children will still run sequentially t.Run
completes only when all its inner tests complete.
- A test file ends with
-
Lambda Calculus:
-
Adding formatted code text in windows (tag code formatted text notepad notepad++ plugin)
- Do this by adding NppExport Plugin to notepad++
- To add a plugin to notepad++:
- Download the plugin dll file
- Create a folder inside the plugin folder (C:\Program Files\Notepad++\plugins)
-
- Tags: wasm c# csharp c sharp web development razor pages
-
Golang http server:
- If writing a server look at this blog again: https://medium.com/statuscode/how-i-write-go-http-services-after-seven-years-37c208122831
- Create a routes.go file for storing routes
- Handlers are defined with returning a handler function http.HandlerFunc
- The middlewares take a handler and return another handler.
- The server struct contains all the global state that is needed. (database )