-
Notifications
You must be signed in to change notification settings - Fork 42
Add Node Deployment Guide for GalaChain nodes #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: David VIEJO <[email protected]>
docs/node-deployment.md
Outdated
| // Token class with 18 decimal places (standard for ERC-20 compatibility) | ||
| export class TokenClass { | ||
| decimals: number = 8; | ||
| symbol: string; | ||
| name: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's configurable, and 0 for NFTs. For GALA we use 8 I think
docs/node-deployment.md
Outdated
| const balance = new BigNumber("1000000000000000000"); // 1 token with 18 decimals | ||
| const humanReadable = balance.dividedBy(10 ** 8); // 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we don't multiply. The string representation is 1 in this case, just the token definition contains the information of how many decimals we support. So it's new BigNumber("1");
docs/node-deployment.md
Outdated
| ``` | ||
|
|
||
| **Key Points**: | ||
| - Default precision: 18 decimal places |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default is 0, assuming we create NFTs mostly. You need to provide a proper value on creation
docs/node-deployment.md
Outdated
| ### 4. Expiration Time | ||
|
|
||
| GalaChain implements configurable expiration mechanisms: | ||
|
|
||
| #### Transaction Expiration | ||
| ```typescript | ||
| // DTO with expiration time | ||
| export class ExpiringOperationDto extends ChainCallDTO { | ||
| @IsString() | ||
| operationId: string; | ||
|
|
||
| @IsNumber() | ||
| expiresAt: number; // Unix timestamp in milliseconds | ||
| } | ||
|
|
||
| // Contract method that checks expiration | ||
| @Submit({ | ||
| in: ExpiringOperationDto | ||
| }) | ||
| public async ExecuteOperation(ctx: GalaChainContext, dto: ExpiringOperationDto): Promise<void> { | ||
| const txTimestamp = ctx.stub.getTxTimestamp(); | ||
| const currentTime = txTimestamp.seconds.toNumber() * 1000; // Convert to milliseconds | ||
| if (currentTime > dto.expiresAt) { | ||
| throw new ExpirationError("Operation has expired"); | ||
| } | ||
|
|
||
| // Execute operation | ||
| await performOperation(ctx, dto); | ||
| } | ||
| ``` | ||
|
|
||
| #### Token Expiration | ||
| ```typescript | ||
| // Token with expiration | ||
| export class ExpiringToken { | ||
| @IsString() | ||
| tokenId: string; | ||
|
|
||
| @IsNumber() | ||
| expiresAt: number; // Unix timestamp in milliseconds | ||
|
|
||
| isExpired(currentTime: number): boolean { | ||
| return currentTime > this.expiresAt; | ||
| } | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work this way. And this is also a comment to 6. Replay Protection and Timestamp-based Protection. I think basically you need to compile some text from https://github.com/GalaChain/sdk/blob/main/docs/authorization.md#authentication-and-authorization-flow
The key takeaway is:
- We enforce
uniqueKeyin DTOs for write transactions to prevent from double spending - Every write operation must be signed by the caller public key (prevents from replay attack along with uniqueKey)
- Optionally you can set a timeout with
dtoExpiresAtfield in the dto
Co-authored-by: Jakub Dzikowski <[email protected]>
…hancements for GalaChain integration Signed-off-by: dviejokfs <[email protected]>
…ain/sdk into feat/node-deployment-docs Signed-off-by: dviejokfs <[email protected]>
…ication steps, and server configuration examples for ChainLaunch. Signed-off-by: dviejokfs <[email protected]>
Signed-off-by: dviejokfs <[email protected]>
Add node documentation for other organizations to join GalaChain