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
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
Go에서 panic은 예기치 않은 오류가 발생할 때 프로그램의 실행을 중지하는데 사용할 수 있는 내장 함수이다.
프로그램 실행 중 어느 시점에서든 즉시 중지시킬수 있을 것이다.
대부분의 경우에 panic을 사용하는 이유는 디버그 용도, 중대한 결함이 있는 경우, 프로그램 실행 중(bootstrap) 오류와 같다.
중대한 결함이나 네트워크 오류 등이 있는 경우에는 프로그램을 안전하게 지속하는 것 자체가 불가능하므로 panic 상태로 프로그램을 종료하는 것이 나을 수 있다.
panic을 사용하는 간단한 예시는 다음과 같다. 0으로 나누는 경우에 panic을 일으킨다.
따라서 다음 fmt.Println절은 실행되지 않을 것이다.
package main
import "fmt"
func divide(a, b int) int {
if b == 0 {
panic("divide by zero")
}
return a / b
}
func main() {
fmt.Println("Divide 1 by 0", divide(1, 0))
fmt.Println("This line will never be printed")
}
go에서는 panic 이 트리거된 상황에서 recover() 함수를 사용하면 패닉을 중지하고 프로그램을 다시 정상 실행할 수가 있다.
go 런타임은 panic시 deferred function(스택에 쌓인 지연함수)를 실행하기 시작하는데, 보통 다음과 같이 사용한다.
package main
import "fmt"
func connect() error {
// Attempt to connect to server
if err != nil {
panic(err)
}
return nil
}
func main() {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recovered from panic:", r)
}
}()
err := connect()
if err != nil {
fmt.Println("Error connecting to server:", err)
}
// Continue executing program
}
Go에서 panic은 예기치 않은 오류가 발생할 때 프로그램의 실행을 중지하는데 사용할 수 있는 내장 함수이다.
프로그램 실행 중 어느 시점에서든 즉시 중지시킬수 있을 것이다.
대부분의 경우에 panic을 사용하는 이유는 디버그 용도, 중대한 결함이 있는 경우, 프로그램 실행 중(bootstrap) 오류와 같다.
중대한 결함이나 네트워크 오류 등이 있는 경우에는 프로그램을 안전하게 지속하는 것 자체가 불가능하므로 panic 상태로 프로그램을 종료하는 것이 나을 수 있다.
panic을 사용하는 간단한 예시는 다음과 같다. 0으로 나누는 경우에 panic을 일으킨다.
따라서 다음 fmt.Println절은 실행되지 않을 것이다.
package main
import "fmt"
func divide(a, b int) int {
if b == 0 {
panic("divide by zero")
}
return a / b
}
func main() {
fmt.Println("Divide 1 by 0", divide(1, 0))
fmt.Println("This line will never be printed")
}
go에서는 panic 이 트리거된 상황에서 recover() 함수를 사용하면 패닉을 중지하고 프로그램을 다시 정상 실행할 수가 있다.
go 런타임은 panic시 deferred function(스택에 쌓인 지연함수)를 실행하기 시작하는데, 보통 다음과 같이 사용한다.
package main
import "fmt"
func connect() error {
// Attempt to connect to server
if err != nil {
panic(err)
}
return nil
}
func main() {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recovered from panic:", r)
}
}()
err := connect()
if err != nil {
fmt.Println("Error connecting to server:", err)
}
// Continue executing program
}
No activity yet