Skip to content

Conversation

@dviejokfs
Copy link

@dviejokfs dviejokfs commented Aug 14, 2025

Add node documentation for other organizations to join GalaChain

Comment on lines 58 to 63
// Token class with 18 decimal places (standard for ERC-20 compatibility)
export class TokenClass {
decimals: number = 8;
symbol: string;
name: string;
}
Copy link
Collaborator

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

Comment on lines 68 to 69
const balance = new BigNumber("1000000000000000000"); // 1 token with 18 decimals
const humanReadable = balance.dividedBy(10 ** 8); // 1.0
Copy link
Collaborator

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");

```

**Key Points**:
- Default precision: 18 decimal places
Copy link
Collaborator

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

Comment on lines 129 to 174
### 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;
}
}
```
Copy link
Collaborator

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:

  1. We enforce uniqueKey in DTOs for write transactions to prevent from double spending
  2. Every write operation must be signed by the caller public key (prevents from replay attack along with uniqueKey)
  3. Optionally you can set a timeout with dtoExpiresAt field in the dto

dviejokfs and others added 5 commits August 26, 2025 17:03
Co-authored-by: Jakub Dzikowski <[email protected]>
…hancements for GalaChain integration

Signed-off-by: dviejokfs <[email protected]>
…ication steps, and server configuration examples for ChainLaunch.

Signed-off-by: dviejokfs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants