Skip to content

Instantly share code, notes, and snippets.

View zmanian's full-sized avatar

Zaki Manian zmanian

View GitHub Profile

Using node config NodeConfig { base: BaseConfig { data_dir_path: "/home/zaki/node_config", temp_data_dir: None, node_sync_retries: 7, node_sync_channel_buffer_size: 10, node_async_log_chan_size: 256 }, metrics: MetricsConfig { dir: "metrics", collection_interval_ms: 1000, push_server_addr: "" }, execution: ExecutionConfig { address: "localhost", port: 55404, testnet_genesis: false, genesis_file_location: "genesis.blob" }, admission_control: AdmissionControlConfig { address: "0.0.0.0", admission_control_service_port: 55394, need_to_check_mempool_before_validation: false, upstream_proxy_timeout: 1s }, debug_interface: DebugInterfaceConfig { admission_control_node_debug_port: 55396, secret_service_node_debug_port: 55400, storage_node_debug_port: 55402, metrics_server_port: 55398, address: "0.0.0.0" }, storage: StorageConfig { address: "localhost", port: 55410, dir: "libradb/db", grpc_max_receive_len: Some(100000000) }, networks: [NetworkConfig { peer_id: "1e5d5a74b0fd09f601ac0fca2fe7d213704e02e51943d18cf25a546b8

Unmarshal/deserialize

val := types.MustUnmarshalValidator(cdc, res)

Now this is a very common construct in Go.

It consists of 3 key pieces

ChainWeb and IBC

ChainWeb is a multi chain braid that supports an IBC like interchain messaging protocol. This is minimally specified and implemented in the testnet. These is an intent to extend this messaging protocol beyond the braid to support other chains. This use case is basically identical to Cosmos.

Handshake

The current chain web protocol does not need an introduction/handshake because all chains in the braid are introduced to each other at genesis. Adding new chains to the braid requires a restart/hardfork.

Broadcast

The protocol supports asynchronous broadcast messages with origin and destination chains and origin and destination pact contracts. There is a protocol level system for authenticating messages that pact contracts can invoke.

Cosmos signing

Cosmos transaction signing is a fairly simple process.

Every Cosmos transaction has a canonical json representation. The gaiacli and stargate rest interfaces provides canonical json representations of transactions and their broadcast function will provide compact amino(a protobuf like format) encoding translations.

Things to know when signing messages.

{
"genesis_time": "2018-08-06T08:00:00.123456789Z",
"chain_id": "gaia-7005",
"consensus_params": {
"block_size_params": {
"max_bytes": "22020096",
"max_txs": "10000",
"max_gas": "-1"
},
"tx_size_params": {
E[07-29|15:20:36.482] CONSENSUS FAILURE!!! module=consensus err="should not already be unbonded, validator: {974A7590D8BC1B9D323F7A9770D5388D324DA0E7 PubKeyEd25519{C1D509AC04DB20DEC2F698330F3681678580350CD02FEFEBFB7EB25EA0DD7824} false 0 5/1 5/1 {fullnode04 [do-not-modify] [do-not-modify] [do-not-modify]} 27237 0 0/1 0/1 0/1 0/1 0/1}\n" stack="goroutine 131181 [running]:\nruntime/debug.Stack(0xc427b0bb58, 0xd014a0, 0xc424bc1cc0)\n\t/snap/go/2130/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine.func1(0xc420112600)\n\t/home/zaki/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus/state.go:558 +0x57\npanic(0xd014a0, 0xc424bc1cc0)\n\t/snap/go/2130/src/runtime/panic.go:502 +0x229\ngithub.com/cosmos/cosmos-sdk/x/stake/keeper.Keeper.unbondValidator(0x105db80, 0xc42003ef10, 0xc4200e2460, 0x105db80, 0xc42003eef0, 0xfe7850, 0xc4200e2460, 0x4, 0x1065880, 0xc42741

Starfish: Collecting Genesis bonding transactions

Initializing a proof of stake blockchain is a high risk moment in the chain life cycle.

The purpose of the StarFish tool is to allow Cosmos community members who control an address in the recommended genesis allocation to declare and bond validators.

The finally genesis state of the network should include all valid candidacy with. 2/3 +1 of the top 100 validators sorted by bond need to come online to start the network. We ask that any community member who wants to participate be available to start their equipment within 12 hours of publication of the genesis state.

We also ask that community members who participate optionally broadcast their intentions and the tx id of their genesis bonding via twitter or some other broadcast to provide additional accountability to the ICF.

This expects that your have a cosmos node running on localhost and opened ports 80 and 443 on your firewall and assigned a domain name to your server's public ip address.

  1. Download Traefik

https://github.com/containous/traefik/releases

wget https://github.com/containous/traefik/releases/download/v1.6.0/traefik

  1. Create a traefik config from the example below. Change the domain at #MUSTCHANGE to yours

Generating an address for an ed25519 public key

    const TypeDistinguisher = HexToBytes("1624de6220")


    //prepend the TypeDistinguisher as Bytes
    SerializedBytes = TypeDistinguisher ++ PubKey.asBytes()

Building enduring value from the ICO boom

The ICO boom is precipitating a profound sea change in the availability of resources for blockchain Research and Development. For the 1st time, the sector has a entry level resources for developing a radical new set of tools for the global(solar system?) economy.

Our goal in 10 -15 years is pretty clear- Blockchain based systems should be the most useful and powerful liquidity rails for all kinds of assets. We have a lot of works to do fulfill the nascent potential of the blockchain space.

Here is a non-comprehensive list all the things we need to get to the moon.

Cryptographic Engineering

  • Safe, mature libraries for implementing complex protocols. NACL and libsodium aren’t going to cut it. Bitcoin-Core’s libsecp256k1 and Isis & Henry’s curve25519- Dalek are the way forward
  • Zero knowledge proof libraries need to be substantially matured. Libsnark and the forthcoming STARK work need mature, battle tested domain specific languages and compilers for securely