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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Segwit vs Native Segwit
서론주변에서 카드 결제를 할 때 서명을 귀찮아서 안하기도 하는데, 디지털 서명은 매우 중요하다.여기서 말하는 디지털 서명이란 서명을 컴퓨터 상에서 숫자 등으로 암호화하여 만드는 것이다.디지털 서명은 돈을 보내는 사람의 개인키로 암호화한 메세지를 돈을 받는 사람이 돈을 보내는 사람의 공개키로 해독하여 돈을 보내는 사람이 맞는지 신원을 확인하고 증명하는 것이다.디지털 서명이 중요한 만큼, 당연히 블록체인에서는 거래를 할 때 블록에 서명에 대한 데이터를 포함시킨다. 그런데 여기서 문제는, 비트코인 네트워크에서는 1개의 블록당 1MB로 크기가 제한되어 있다는 점이다. 이 문제를 해결하기 위해 등장한 개념이 바로 세그윗이다.세그윗 (Segregated Witness)세그윗은 분리된 증인의 축약어이다. 세그윗(P2SH) 및 네이티브 세그윗(Bech32)는 비트코인 계정을 위해 존재하는 최초 주소 형식이 아니다. 세그윗(SegWit), 또는 Wrapped 또는 Nested SegWit이라고...
<100 subscribers
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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Segwit vs Native Segwit
서론주변에서 카드 결제를 할 때 서명을 귀찮아서 안하기도 하는데, 디지털 서명은 매우 중요하다.여기서 말하는 디지털 서명이란 서명을 컴퓨터 상에서 숫자 등으로 암호화하여 만드는 것이다.디지털 서명은 돈을 보내는 사람의 개인키로 암호화한 메세지를 돈을 받는 사람이 돈을 보내는 사람의 공개키로 해독하여 돈을 보내는 사람이 맞는지 신원을 확인하고 증명하는 것이다.디지털 서명이 중요한 만큼, 당연히 블록체인에서는 거래를 할 때 블록에 서명에 대한 데이터를 포함시킨다. 그런데 여기서 문제는, 비트코인 네트워크에서는 1개의 블록당 1MB로 크기가 제한되어 있다는 점이다. 이 문제를 해결하기 위해 등장한 개념이 바로 세그윗이다.세그윗 (Segregated Witness)세그윗은 분리된 증인의 축약어이다. 세그윗(P2SH) 및 네이티브 세그윗(Bech32)는 비트코인 계정을 위해 존재하는 최초 주소 형식이 아니다. 세그윗(SegWit), 또는 Wrapped 또는 Nested SegWit이라고...
Share Dialog
Share Dialog
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 comments yet