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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Ethereum Beacon chain
Beacon chain이더리움은 확장성 문제를 해결하기 위해 샤딩과 POS를 도입하기로 했다. 샤딩이란, 데이터베이스를 분할해서 데이터베이스의 부하와 체인의 지나친 중앙화를 막는 전략이다. POS란 지분 증명으로, 기존 POW와는 다르게 속도면에서 빠르다. POW는 컴퓨팅 자원을 소모해야만 합의 과정에 참여할 수 있지만, POS는 가지고 있는 ETH로 합의 과정에 참여할 수 있기 때문이다. 이더리움의 비콘 체인은 POS가 적용된 블록체인이다. 기존의 POW 가 아닌 이더리움 2.0을 위한 POS 가 적용된 블록체인이다. 비콘체인은 참여자들을 관리하는데, 어떤 검증자가 블록을 제안해야 할지, 위원회가 되어 블록을 증명해야 하는지 등의 역할을 한다.그림처럼 POW로 블록을 생성하는 메인 체인과 평행하게, POS 로 블록을 생성한다. 그러다 The Merge 업그레이드로 POW 가 아닌 POS 로 Mainnet 의 TX 처리를 시작하면서 블록 전파 및 합의 로직까지 담당하게 되었다....
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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Ethereum Beacon chain
Beacon chain이더리움은 확장성 문제를 해결하기 위해 샤딩과 POS를 도입하기로 했다. 샤딩이란, 데이터베이스를 분할해서 데이터베이스의 부하와 체인의 지나친 중앙화를 막는 전략이다. POS란 지분 증명으로, 기존 POW와는 다르게 속도면에서 빠르다. POW는 컴퓨팅 자원을 소모해야만 합의 과정에 참여할 수 있지만, POS는 가지고 있는 ETH로 합의 과정에 참여할 수 있기 때문이다. 이더리움의 비콘 체인은 POS가 적용된 블록체인이다. 기존의 POW 가 아닌 이더리움 2.0을 위한 POS 가 적용된 블록체인이다. 비콘체인은 참여자들을 관리하는데, 어떤 검증자가 블록을 제안해야 할지, 위원회가 되어 블록을 증명해야 하는지 등의 역할을 한다.그림처럼 POW로 블록을 생성하는 메인 체인과 평행하게, POS 로 블록을 생성한다. 그러다 The Merge 업그레이드로 POW 가 아닌 POS 로 Mainnet 의 TX 처리를 시작하면서 블록 전파 및 합의 로직까지 담당하게 되었다....
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