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...
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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
<100 subscribers
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...
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 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Share Dialog
Share Dialog
Solidity에는 modifier라는 것이 있다.
modifier는 우리가 컨트랙트를 개발할 때 함수의 동작을 제어할 수 있도록 해준다.
간단한 modifier의 예시를 보자.
modifier modifierName {
// ...modifier code...
_; // this represents the function body that the modifier is applied to
}
_;키워드는 함수의 나머지 body 부분을 실행하라는 명령을 나타낸다.
다음과 같이 함수에 적용할 수 있다.
function functionName() modifierName public {
// ...function code...
}
보통 modifier를 통해서 달성하고자 하는 목표는 다음과 같다.
Access control : onlyOwner와 같이 Role에 따라 함수 Access를 제한하기 위함
Precondition : 함수의 동작을 위한 전제조건, (e.g. decorator를 이용한 제어와 비슷하다)
보통 modifier 를 작성할 때 error 및 assestion을 처리하기 위해 revert(), require() 및 assert()와 같은 몇 가지 기능을 사용한다.
revert() 함수는 블록체인의 상태를 현재 함수가 호출되기 전의 상태로 되돌린다.
이는 현재 기능에서 블록체인에 대한 변경 사항이 취소되었음을 의미한다.
일반적으로 처리 방법을 모르거나 처리하지 않으려는 오류가 발생할 때 사용된다.
revert()는 오류에 대한 자세한 정보를 제공할 수 있는 선택적 문자열 메시지도 허용한다.
require() 함수는 항상 참이어야 하는 항목의 유효성을 검사하는 데 사용된다.
일반적으로 입력의 유효성을 검사하기 위해 함수를 시작할 때 또는 작업의 결과를 검사하기 위해 함수를 실행할 때 사용된다.
require() 내부 조건이 false이면 revert()와 유사하게 트랜잭션을 반환한다.
require()는 또한 요구 사항이 충족되지 않은 이유를 설명하는 선택적 문자열 메시지를 허용한다.
assert() 함수는 require()와 비슷하지만 내부 오류 또는 절대 발생해서는 안 되는 조건을 확인하는 데 사용된다.
assert() 내부의 조건이 거짓이면 심각한 문제가 발생하여 트랜잭션이 반환됩니다.
assert()는 고장이 났을 때 남은 가스를 모두 소비하므로, revert()보다 사용 비용이 더 많이 필요하다.
나라면 실제 프로덕션에서는 require와 revert를 사용하고, assert는 테스트넷 혹은 디버깅을 위해 사용할 것 같다.
Solidity에는 modifier라는 것이 있다.
modifier는 우리가 컨트랙트를 개발할 때 함수의 동작을 제어할 수 있도록 해준다.
간단한 modifier의 예시를 보자.
modifier modifierName {
// ...modifier code...
_; // this represents the function body that the modifier is applied to
}
_;키워드는 함수의 나머지 body 부분을 실행하라는 명령을 나타낸다.
다음과 같이 함수에 적용할 수 있다.
function functionName() modifierName public {
// ...function code...
}
보통 modifier를 통해서 달성하고자 하는 목표는 다음과 같다.
Access control : onlyOwner와 같이 Role에 따라 함수 Access를 제한하기 위함
Precondition : 함수의 동작을 위한 전제조건, (e.g. decorator를 이용한 제어와 비슷하다)
보통 modifier 를 작성할 때 error 및 assestion을 처리하기 위해 revert(), require() 및 assert()와 같은 몇 가지 기능을 사용한다.
revert() 함수는 블록체인의 상태를 현재 함수가 호출되기 전의 상태로 되돌린다.
이는 현재 기능에서 블록체인에 대한 변경 사항이 취소되었음을 의미한다.
일반적으로 처리 방법을 모르거나 처리하지 않으려는 오류가 발생할 때 사용된다.
revert()는 오류에 대한 자세한 정보를 제공할 수 있는 선택적 문자열 메시지도 허용한다.
require() 함수는 항상 참이어야 하는 항목의 유효성을 검사하는 데 사용된다.
일반적으로 입력의 유효성을 검사하기 위해 함수를 시작할 때 또는 작업의 결과를 검사하기 위해 함수를 실행할 때 사용된다.
require() 내부 조건이 false이면 revert()와 유사하게 트랜잭션을 반환한다.
require()는 또한 요구 사항이 충족되지 않은 이유를 설명하는 선택적 문자열 메시지를 허용한다.
assert() 함수는 require()와 비슷하지만 내부 오류 또는 절대 발생해서는 안 되는 조건을 확인하는 데 사용된다.
assert() 내부의 조건이 거짓이면 심각한 문제가 발생하여 트랜잭션이 반환됩니다.
assert()는 고장이 났을 때 남은 가스를 모두 소비하므로, revert()보다 사용 비용이 더 많이 필요하다.
나라면 실제 프로덕션에서는 require와 revert를 사용하고, assert는 테스트넷 혹은 디버깅을 위해 사용할 것 같다.
No comments yet