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...
P2WPKH
P2WPKHP2WPKH란 비트코인 내에서 가장 일반적인 스크립트 형식으로 비트코인 프로토콜에 대한 지불 거래 유형이다. 주소는 1로 시작하는데, 세그윗을 지원하는 새로운 주소 3 또는 bc1로 시작하는 주소보다 훨씬 비싸다. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 즉, 비트코인 주소가 1로 시작하면 P2PKH 주소를 사용하고 있는 것이다. 공개키의 간단한 해시이며, 이 해시를 주소로 사용하는 것이다. 이것은 원래 비트코인 주소 형식이었으며 오늘까지도 충실히 작동한다. 레거시 주소는 세그윗과 호환되지 않지만, 여전히 문제없이 P2PKH 주소에서 세그윗 주소로 BTC를 보낼 수 있다. 그러나 레거시 주소 트랜잭션이 더 크기 때문에 P2PKH 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
golang container package
container packagegolang에는 빌트인으로 사용할 수 있는 container package가 있다. 개발을 하다보면, 자료구조를 사용할 일이 꽤 생긴다. go에서는 container 패키지에서 기본 자료구조를 제공해주므로 꽤나 편리하게 사용할 수 있다. 패키지에서 제공하는 자료구조는 다음과 같다.Linked listHeapRing (Circular list)container 패키지를 이용해서 간단한 자료구조를 구현해보자.container/listpackage main import ( "container/list" "log" ) func main() { lst := list.New() lst.PushBack(1) lst.PushBack(2) lst.PushBack(3) log.Println(lst.Len()) } 위와 같이 container/list 패키지를 import하면, 손쉽게 linked list를 사용할 수 있다. 개발을 하면서 linked list를 사용...
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...
P2WPKH
P2WPKHP2WPKH란 비트코인 내에서 가장 일반적인 스크립트 형식으로 비트코인 프로토콜에 대한 지불 거래 유형이다. 주소는 1로 시작하는데, 세그윗을 지원하는 새로운 주소 3 또는 bc1로 시작하는 주소보다 훨씬 비싸다. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 즉, 비트코인 주소가 1로 시작하면 P2PKH 주소를 사용하고 있는 것이다. 공개키의 간단한 해시이며, 이 해시를 주소로 사용하는 것이다. 이것은 원래 비트코인 주소 형식이었으며 오늘까지도 충실히 작동한다. 레거시 주소는 세그윗과 호환되지 않지만, 여전히 문제없이 P2PKH 주소에서 세그윗 주소로 BTC를 보낼 수 있다. 그러나 레거시 주소 트랜잭션이 더 크기 때문에 P2PKH 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
golang container package
container packagegolang에는 빌트인으로 사용할 수 있는 container package가 있다. 개발을 하다보면, 자료구조를 사용할 일이 꽤 생긴다. go에서는 container 패키지에서 기본 자료구조를 제공해주므로 꽤나 편리하게 사용할 수 있다. 패키지에서 제공하는 자료구조는 다음과 같다.Linked listHeapRing (Circular list)container 패키지를 이용해서 간단한 자료구조를 구현해보자.container/listpackage main import ( "container/list" "log" ) func main() { lst := list.New() lst.PushBack(1) lst.PushBack(2) lst.PushBack(3) log.Println(lst.Len()) } 위와 같이 container/list 패키지를 import하면, 손쉽게 linked list를 사용할 수 있다. 개발을 하면서 linked list를 사용...
Smart Contract Developer, Web3 Backend Developer

Subscribe to Primrose

Subscribe to Primrose
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
Uvicorn 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.
Starlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.
FastAPI provides many features on top of Starlette. If you used only Starlette without FastAPI, you have to implement all data validation and serialization.
Because of that, final application may have same overhead as building using the FastAPI.
And in most cases, data validation and serialization are the highest amounts of code written by an application.
FastAPI saves development time, bugs, and cord-lines, and gives you the same performance (or better performance) when you don't.
Asyncio is library which allows to make asynchronous code with using async/await phrase.
Asyncio is used as the basis for several Python asynchronous frameworks that provide high-performance network and web servers, database connection libraries, and distributed task queues.
Asyncio is best suited for IO bottleneck and high-level structured network code.
Uvloop is an event loop replacement for asyncio, making asyncio faster, and more than twice the performance compared to node.js, gevent, and other Python frameworks.
In “uvloop.readthedocs.io”, describes uvloop as follows.
uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is released under the MIT license.
uvloop and asyncio, combined with the power of async/await in Python 3.5, makes it easier than ever to write high-performance networking code in Python.
uvloop makes asyncio fast. In fact, it is at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework. The performance of uvloop-based asyncio is close to that of Go programs.
https://uvloop.readthedocs.io/
The uvloop was written in Cython based on libuv. Libuv is a high-performance, multi-platform asynchronous I/O library used by node.js, and is fast and stable.
It is no exaggeration to say that the reason why node.js became popular and widely distributed is because of libuv.
Gunicorn is WSGI server. WSGI is the promised interface or rule between a Python-written web application and a Python-written server.
Simply put, when WSGI servers and web applications are created in accordance with WSGI’s rules, web applications provide the flexibility to freely select and use WSGI servers regardless of internal implementation.
For example, Django provides the wsgi.py for WSGI, you can freely select the WSGI servers, such as gunicorn, uwsgi, without change of internal implementation.
Gunicorn’s process adopts a process-based processing method(프로세스 기반의 처리 방식), which is largely divided into master process and worker process internally.
When gunicorn runs, the process itself is the master process, and the worker process is created based on the number of workers assigned to the setting using forks.
Master process is responsible for managing the worker process, which imports web applications, and receives requests and forwards them to the web application code for processing.

Uvicorn is a superfast ASGI Web server. Runs uvloop-based asynchronous Python code in a single process.


https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=parkjy76&logNo=221983329279
Uvicorn 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.
Starlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.
FastAPI provides many features on top of Starlette. If you used only Starlette without FastAPI, you have to implement all data validation and serialization.
Because of that, final application may have same overhead as building using the FastAPI.
And in most cases, data validation and serialization are the highest amounts of code written by an application.
FastAPI saves development time, bugs, and cord-lines, and gives you the same performance (or better performance) when you don't.
Asyncio is library which allows to make asynchronous code with using async/await phrase.
Asyncio is used as the basis for several Python asynchronous frameworks that provide high-performance network and web servers, database connection libraries, and distributed task queues.
Asyncio is best suited for IO bottleneck and high-level structured network code.
Uvloop is an event loop replacement for asyncio, making asyncio faster, and more than twice the performance compared to node.js, gevent, and other Python frameworks.
In “uvloop.readthedocs.io”, describes uvloop as follows.
uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is released under the MIT license.
uvloop and asyncio, combined with the power of async/await in Python 3.5, makes it easier than ever to write high-performance networking code in Python.
uvloop makes asyncio fast. In fact, it is at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework. The performance of uvloop-based asyncio is close to that of Go programs.
https://uvloop.readthedocs.io/
The uvloop was written in Cython based on libuv. Libuv is a high-performance, multi-platform asynchronous I/O library used by node.js, and is fast and stable.
It is no exaggeration to say that the reason why node.js became popular and widely distributed is because of libuv.
Gunicorn is WSGI server. WSGI is the promised interface or rule between a Python-written web application and a Python-written server.
Simply put, when WSGI servers and web applications are created in accordance with WSGI’s rules, web applications provide the flexibility to freely select and use WSGI servers regardless of internal implementation.
For example, Django provides the wsgi.py for WSGI, you can freely select the WSGI servers, such as gunicorn, uwsgi, without change of internal implementation.
Gunicorn’s process adopts a process-based processing method(프로세스 기반의 처리 방식), which is largely divided into master process and worker process internally.
When gunicorn runs, the process itself is the master process, and the worker process is created based on the number of workers assigned to the setting using forks.
Master process is responsible for managing the worker process, which imports web applications, and receives requests and forwards them to the web application code for processing.

Uvicorn is a superfast ASGI Web server. Runs uvloop-based asynchronous Python code in a single process.


https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=parkjy76&logNo=221983329279
No activity yet