Gas optimization in Solidity, Ethereum
Iβm sorry but my English is terrible. I hope you understand that generously.Recently, I was developing a toy project named Blind Market. Itβs a simple P2P trading application using smart contract. I was making a contract using Solidity, and the trade stage proceeded in the order of pending, shipping, and done. The problem was appeared in done phase. The problem was that when I tried to close the transaction by paying the price raised by the seller in msg.value, the following error occurred.Pe...
Uvicorn & Gunicorn
Uvicorn and GunicornUvicorn and Gunicorn are important concepts when developing applications in Python. However, there are many concepts to be aware of in order to fully understand Uvicorn and Gunicorn. The following is a brief summary of the necessary concepts, and the details will be dealt with separately later.Necessary ConceptsStarletteStarlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.FastAPIFastAPI provides many features on top of Starlet...
P2WPKH
P2WPKHP2WPKHλ λΉνΈμ½μΈ λ΄μμ κ°μ₯ μΌλ°μ μΈ μ€ν¬λ¦½νΈ νμμΌλ‘ λΉνΈμ½μΈ νλ‘ν μ½μ λν μ§λΆ κ±°λ μ νμ΄λ€. μ£Όμλ 1λ‘ μμνλλ°, μΈκ·Έμμ μ§μνλ μλ‘μ΄ μ£Όμ 3 λλ bc1λ‘ μμνλ μ£Όμλ³΄λ€ ν¨μ¬ λΉμΈλ€. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 μ¦, λΉνΈμ½μΈ μ£Όμκ° 1λ‘ μμνλ©΄ P2PKH μ£Όμλ₯Ό μ¬μ©νκ³ μλ κ²μ΄λ€. 곡κ°ν€μ κ°λ¨ν ν΄μμ΄λ©°, μ΄ ν΄μλ₯Ό μ£Όμλ‘ μ¬μ©νλ κ²μ΄λ€. μ΄κ²μ μλ λΉνΈμ½μΈ μ£Όμ νμμ΄μμΌλ©° μ€λκΉμ§λ μΆ©μ€ν μλνλ€. λ κ±°μ μ£Όμλ μΈκ·Έμκ³Ό νΈνλμ§ μμ§λ§, μ¬μ ν λ¬Έμ μμ΄ P2PKH μ£Όμμμ μΈκ·Έμ μ£Όμλ‘ BTCλ₯Ό λ³΄λΌ μ μλ€. κ·Έλ¬λ λ κ±°μ μ£Όμ νΈλμμ μ΄ λ ν¬κΈ° λλ¬Έμ P2PKH μ£Όμμμ μ μ‘νλ νκ· μλλ μΈκ·Έμ μ£Όμμμ μ μ‘ν λλ³΄λ€ λ λμ μκΈμ΄ λ°μν μ μλ€....
Smart Contract Developer, Web3 Backend Developer
Gas optimization in Solidity, Ethereum
Iβm sorry but my English is terrible. I hope you understand that generously.Recently, I was developing a toy project named Blind Market. Itβs a simple P2P trading application using smart contract. I was making a contract using Solidity, and the trade stage proceeded in the order of pending, shipping, and done. The problem was appeared in done phase. The problem was that when I tried to close the transaction by paying the price raised by the seller in msg.value, the following error occurred.Pe...
Uvicorn & Gunicorn
Uvicorn and GunicornUvicorn and Gunicorn are important concepts when developing applications in Python. However, there are many concepts to be aware of in order to fully understand Uvicorn and Gunicorn. The following is a brief summary of the necessary concepts, and the details will be dealt with separately later.Necessary ConceptsStarletteStarlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.FastAPIFastAPI provides many features on top of Starlet...
P2WPKH
P2WPKHP2WPKHλ λΉνΈμ½μΈ λ΄μμ κ°μ₯ μΌλ°μ μΈ μ€ν¬λ¦½νΈ νμμΌλ‘ λΉνΈμ½μΈ νλ‘ν μ½μ λν μ§λΆ κ±°λ μ νμ΄λ€. μ£Όμλ 1λ‘ μμνλλ°, μΈκ·Έμμ μ§μνλ μλ‘μ΄ μ£Όμ 3 λλ bc1λ‘ μμνλ μ£Όμλ³΄λ€ ν¨μ¬ λΉμΈλ€. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 μ¦, λΉνΈμ½μΈ μ£Όμκ° 1λ‘ μμνλ©΄ P2PKH μ£Όμλ₯Ό μ¬μ©νκ³ μλ κ²μ΄λ€. 곡κ°ν€μ κ°λ¨ν ν΄μμ΄λ©°, μ΄ ν΄μλ₯Ό μ£Όμλ‘ μ¬μ©νλ κ²μ΄λ€. μ΄κ²μ μλ λΉνΈμ½μΈ μ£Όμ νμμ΄μμΌλ©° μ€λκΉμ§λ μΆ©μ€ν μλνλ€. λ κ±°μ μ£Όμλ μΈκ·Έμκ³Ό νΈνλμ§ μμ§λ§, μ¬μ ν λ¬Έμ μμ΄ P2PKH μ£Όμμμ μΈκ·Έμ μ£Όμλ‘ BTCλ₯Ό λ³΄λΌ μ μλ€. κ·Έλ¬λ λ κ±°μ μ£Όμ νΈλμμ μ΄ λ ν¬κΈ° λλ¬Έμ P2PKH μ£Όμμμ μ μ‘νλ νκ· μλλ μΈκ·Έμ μ£Όμμμ μ μ‘ν λλ³΄λ€ λ λμ μκΈμ΄ λ°μν μ μλ€....
Smart Contract Developer, Web3 Backend Developer

Subscribe to Primrose

Subscribe to Primrose
<100 subscribers
<100 subscribers
Share Dialog
Share Dialog
μ ν리μΌμ΄μ μ΄ μμλ λ, μ΄λ€ ν΄λμ€κ° μ΅μ΄ ν λ²λ§ λ©λͺ¨λ¦¬λ₯Ό ν λΉ(static)νκ³ ν΄λΉ λ©λͺ¨λ¦¬μ μΈμ€ν΄μ€λ₯Ό λ§λ€μ΄ μ¬μ©νλ ν¨ν΄.
μ½κ² μκΈ°νλ©΄ μ±κΈν€ ν¨ν΄μ νλμ μΈμ€ν΄μ€λ§ μμ±νμ¬ μ¬μ©νλ λμμΈ ν¨ν΄,
μ¦, κ°μ²΄μ μΈμ€ν΄μ€κ° μ€μ§ 1κ°λ§ μμ±λλ ν¨ν΄μ μλ―Ένλ€.
μ±κΈν€ ν¨ν΄μ ꡬννλ λ°©λ²μ μ¬λ¬ κ°μ§κ° μμ§λ§, κ°μ²΄λ₯Ό 미리 μμ±ν΄λκ³ κ°μ Έμ€λ λ°©λ²μ΄ κ°μ₯ λ¨μνκ³ μμ νλ€.
public class Singleton {
private static Singleton instance = new Singleton();
private Singleton() {
// ...
}
public static Singleton getInstance() {
return instance;
}
public void say() {
System.out.println("hi, there");
}
}
type Singleton struct {
Instance string
}
// private
func (sg *Singleton) instanceConstructor() {
// ...
}
// public
func (sg *Singleton) GetInstance() {
return sg.Instance
}
func (sg *Singleton) Say() {
fmt.Println("hi, there");
}
μΈμ€ν΄μ€κ° νμν λ, λκ°μ μΈμ€ν΄μ€λ₯Ό λ§λ€μ§ μκ³ κΈ°μ‘΄μ μΈμ€ν΄μ€λ₯Ό νμ©.
μ΄λ κ² μΈμ€ν΄μ€λ₯Ό μ€μ§ ν κ°λ‘λ§ κ°μ Έκ°κ² λλ©΄ λͺ κ°μ§ μ΄μ μ΄ μλ€.
μ΅μ΄ νλ²λ§ κ³ μ λ λ©λͺ¨λ¦¬ μμμ μ¬μ©νκΈ° λλ¬Έμ μΆν ν΄λΉ κ°μ²΄μ μ κ·Όν λ λ©λͺ¨λ¦¬ λλΉλ₯Ό λ°©μ§ν μ μλ€.
λν μ΄λ―Έ μμ±λ μΈμ€ν΄μ€λ₯Ό νμ©νλ μλ μΈ‘λ©΄μμλ μ΄μ μ΄ μλ€κ³ λ³Ό μ μλ€.
μ±κΈν€ μΈμ€ν΄μ€λ μ μμΌλ‘ μ¬μ©λκΈ° λλ¬Έμ μλ‘ λ€λ₯Έ κ°μ²΄κ°μ λ°μ΄ν° 곡μ κ° μ½λ€.
νμ§λ§ μ¬λ¬ κ°μ²΄μ μΈμ€ν΄μ€μμ μ±κΈν΄ μΈμ€ν΄μ€μ λ°μ΄ν°μ λμμ μ κ·Όνκ² λλ©΄ λμμ± λ¬Έμ κ° λ°μν μ μμ΄μ μ΄ μ μ μ μν΄μΌνλ€.
λ³΄ν΅ μ±κΈν€ ν¨ν΄μ 곡ν΅λ κ°μ²΄λ₯Ό μ¬λ¬ κ° μμ±ν΄μ μ¬μ©ν΄μΌ νλ μν©,
μλ₯Ό λ€λ©΄ λ°μ΄ν°λ² μ΄μ€μ 컀λ₯μ ν, μ€λ λ ν, μΊμ, λ‘κ·Έ κΈ°λ‘ κ°μ²΄ λ±μ λ§μ΄ μ¬μ©νλ€.
μ΄ μΈμλ λλ©μΈ κ΄μ μμ μΈμ€ν΄μ€κ° ν κ°λ§ μ‘΄μ¬νλ κ²μ 보μ¦νκ³ μΆμ κ²½μ° μ±κΈν€ ν¨ν΄μ μ¬μ©νκΈ°λ νλ€.
μ±κΈν€ ν¨ν΄μ μ μ©νλ©΄ μμ κ°μ ν¨μ¨μ μΈ μΈ‘λ©΄μμμ μ΄μ μ΄ μμ§λ§, λ€μκ³Ό κ°μ λ¬Έμ μ μ΄ λ°μν μ μλ€.
κ°λ°μλ μ΄λ¬ν λ¬Έμ μ κ³Ό μ΄μ μ trade-offλ₯Ό μ κ³ λ €ν΄μΌνλ€.
λ§μ½ μ±κΈν€ μΈμ€ν΄μ€κ° νΌμ λ무 λ§μ μΌμ νκ±°λ, λ§μ λ°μ΄ν°λ₯Ό 곡μ μν€λ©΄ λ€λ₯Έ ν΄λμ€λ€ κ°μ κ²°ν©λκ° λμμ§κ² λλλ°, μ΄λ κ°λ°©-νμ μμΉμ΄ μλ°°λλ€.
κ²°ν©λκ° λμμ§λ©΄ μ μ§λ³΄μκ° νλ€κ³ ν μ€νΈλ μννκ² μ§ννκΈ° νλ€λ€.
μ μ ν©ν 리 λ©μλμμ κ°μ²΄ μμ±μ νμΈνκ³ μμ±μλ₯Ό νΈμΆνλ κ²½μ°μ, λ©ν°μ€λ λ νκ²½μμλ λμμ± λ¬Έμ κ° λ°μν μ μλ€.
λ©ν° μ€λ λ νκ²½μμ λκΈ°ν μ²λ¦¬λ₯Ό νμ§ μμλ€λ©΄ μΈμ€ν΄μ€κ° 2κ°κ° μμ±λλ λ¬Έμ λ λ°μν μ μλ€.
μ΄λ¬ν λ¬Έμ λ₯Ό ν΄κ²°νκΈ° μν΄μ λκΈ°ν μ²λ¦¬λ₯Ό νλ€λ©΄ ν¨μ¨ μ ν λ° μΆκ°μ μΈ μ½λ μμ±μ΄ λ°μνλ€.
μ ν리μΌμ΄μ μ΄ μμλ λ, μ΄λ€ ν΄λμ€κ° μ΅μ΄ ν λ²λ§ λ©λͺ¨λ¦¬λ₯Ό ν λΉ(static)νκ³ ν΄λΉ λ©λͺ¨λ¦¬μ μΈμ€ν΄μ€λ₯Ό λ§λ€μ΄ μ¬μ©νλ ν¨ν΄.
μ½κ² μκΈ°νλ©΄ μ±κΈν€ ν¨ν΄μ νλμ μΈμ€ν΄μ€λ§ μμ±νμ¬ μ¬μ©νλ λμμΈ ν¨ν΄,
μ¦, κ°μ²΄μ μΈμ€ν΄μ€κ° μ€μ§ 1κ°λ§ μμ±λλ ν¨ν΄μ μλ―Ένλ€.
μ±κΈν€ ν¨ν΄μ ꡬννλ λ°©λ²μ μ¬λ¬ κ°μ§κ° μμ§λ§, κ°μ²΄λ₯Ό 미리 μμ±ν΄λκ³ κ°μ Έμ€λ λ°©λ²μ΄ κ°μ₯ λ¨μνκ³ μμ νλ€.
public class Singleton {
private static Singleton instance = new Singleton();
private Singleton() {
// ...
}
public static Singleton getInstance() {
return instance;
}
public void say() {
System.out.println("hi, there");
}
}
type Singleton struct {
Instance string
}
// private
func (sg *Singleton) instanceConstructor() {
// ...
}
// public
func (sg *Singleton) GetInstance() {
return sg.Instance
}
func (sg *Singleton) Say() {
fmt.Println("hi, there");
}
μΈμ€ν΄μ€κ° νμν λ, λκ°μ μΈμ€ν΄μ€λ₯Ό λ§λ€μ§ μκ³ κΈ°μ‘΄μ μΈμ€ν΄μ€λ₯Ό νμ©.
μ΄λ κ² μΈμ€ν΄μ€λ₯Ό μ€μ§ ν κ°λ‘λ§ κ°μ Έκ°κ² λλ©΄ λͺ κ°μ§ μ΄μ μ΄ μλ€.
μ΅μ΄ νλ²λ§ κ³ μ λ λ©λͺ¨λ¦¬ μμμ μ¬μ©νκΈ° λλ¬Έμ μΆν ν΄λΉ κ°μ²΄μ μ κ·Όν λ λ©λͺ¨λ¦¬ λλΉλ₯Ό λ°©μ§ν μ μλ€.
λν μ΄λ―Έ μμ±λ μΈμ€ν΄μ€λ₯Ό νμ©νλ μλ μΈ‘λ©΄μμλ μ΄μ μ΄ μλ€κ³ λ³Ό μ μλ€.
μ±κΈν€ μΈμ€ν΄μ€λ μ μμΌλ‘ μ¬μ©λκΈ° λλ¬Έμ μλ‘ λ€λ₯Έ κ°μ²΄κ°μ λ°μ΄ν° 곡μ κ° μ½λ€.
νμ§λ§ μ¬λ¬ κ°μ²΄μ μΈμ€ν΄μ€μμ μ±κΈν΄ μΈμ€ν΄μ€μ λ°μ΄ν°μ λμμ μ κ·Όνκ² λλ©΄ λμμ± λ¬Έμ κ° λ°μν μ μμ΄μ μ΄ μ μ μ μν΄μΌνλ€.
λ³΄ν΅ μ±κΈν€ ν¨ν΄μ 곡ν΅λ κ°μ²΄λ₯Ό μ¬λ¬ κ° μμ±ν΄μ μ¬μ©ν΄μΌ νλ μν©,
μλ₯Ό λ€λ©΄ λ°μ΄ν°λ² μ΄μ€μ 컀λ₯μ ν, μ€λ λ ν, μΊμ, λ‘κ·Έ κΈ°λ‘ κ°μ²΄ λ±μ λ§μ΄ μ¬μ©νλ€.
μ΄ μΈμλ λλ©μΈ κ΄μ μμ μΈμ€ν΄μ€κ° ν κ°λ§ μ‘΄μ¬νλ κ²μ 보μ¦νκ³ μΆμ κ²½μ° μ±κΈν€ ν¨ν΄μ μ¬μ©νκΈ°λ νλ€.
μ±κΈν€ ν¨ν΄μ μ μ©νλ©΄ μμ κ°μ ν¨μ¨μ μΈ μΈ‘λ©΄μμμ μ΄μ μ΄ μμ§λ§, λ€μκ³Ό κ°μ λ¬Έμ μ μ΄ λ°μν μ μλ€.
κ°λ°μλ μ΄λ¬ν λ¬Έμ μ κ³Ό μ΄μ μ trade-offλ₯Ό μ κ³ λ €ν΄μΌνλ€.
λ§μ½ μ±κΈν€ μΈμ€ν΄μ€κ° νΌμ λ무 λ§μ μΌμ νκ±°λ, λ§μ λ°μ΄ν°λ₯Ό 곡μ μν€λ©΄ λ€λ₯Έ ν΄λμ€λ€ κ°μ κ²°ν©λκ° λμμ§κ² λλλ°, μ΄λ κ°λ°©-νμ μμΉμ΄ μλ°°λλ€.
κ²°ν©λκ° λμμ§λ©΄ μ μ§λ³΄μκ° νλ€κ³ ν μ€νΈλ μννκ² μ§ννκΈ° νλ€λ€.
μ μ ν©ν 리 λ©μλμμ κ°μ²΄ μμ±μ νμΈνκ³ μμ±μλ₯Ό νΈμΆνλ κ²½μ°μ, λ©ν°μ€λ λ νκ²½μμλ λμμ± λ¬Έμ κ° λ°μν μ μλ€.
λ©ν° μ€λ λ νκ²½μμ λκΈ°ν μ²λ¦¬λ₯Ό νμ§ μμλ€λ©΄ μΈμ€ν΄μ€κ° 2κ°κ° μμ±λλ λ¬Έμ λ λ°μν μ μλ€.
μ΄λ¬ν λ¬Έμ λ₯Ό ν΄κ²°νκΈ° μν΄μ λκΈ°ν μ²λ¦¬λ₯Ό νλ€λ©΄ ν¨μ¨ μ ν λ° μΆκ°μ μΈ μ½λ μμ±μ΄ λ°μνλ€.
No activity yet