Skip to content

Commit 626077b

Browse files
committed
docs: improve code examples and documentation
1 parent 57b8008 commit 626077b

File tree

3 files changed

+135
-77
lines changed

3 files changed

+135
-77
lines changed

README.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ smart contract platform that enables near-instant settlement and can process mil
55

66
## Overview
77

8-
Radius provides scalable, low-latency smart contract execution with sub-second finality. These SDKs make it easy to
9-
build applications that leverage Radius' high throughput and near-instant settlement capabilities.
8+
Next-generation payments require processing power that is orders of magnitude more efficient than what is currently
9+
available. Built by the team that brought USDC to market, Radius is the result of many years rethinking smart contract
10+
scalability from first principles.
1011

11-
## Key Features
12+
Unlike blockchains that sequentially process a limited batch of transactions at a time, our distributed execution layer
13+
handles multiple transactions simultaneously. Our platform has demonstrated that it can process over 2.8 million
14+
transactions per second with near zero latency and cost, far exceeding any other system that exists today.
1215

13-
- 2.8M+ transactions per second
14-
- 100+ gigagas/sec throughput
15-
- ~500 ms latency
16-
- Transaction cost < $0.000001
17-
- Full EVM compatibility & multi-VM support
18-
- Horizontal scaling
19-
- Parallel execution & state updates
20-
- No global transaction ordering
16+
Radius is fully EVM-compatible and provides SDKs in [multiple programming languages](#available-sdks) with a clean,
17+
consistent interface, enabling developers to easily add instant payments to their apps with just a few lines of code.
18+
19+
No block times. No bidding wars. Just instant settlement.
2120

2221
## Available SDKs
2322

@@ -26,6 +25,40 @@ build applications that leverage Radius' high throughput and near-instant settle
2625
- [Rust SDK](rust/README.md) (coming soon)
2726
- [TypeScript SDK](typescript/README.md)
2827

28+
## Use Cases
29+
30+
Radius is capable of handling millions of micro-payments per second at a cost that makes doing so economically viable.
31+
This is particularly well-suited for AI agent use cases, and equally so for any application that requires massive scale,
32+
instant settlement, and cryptographic guarantees.
33+
34+
### AI Payments
35+
- AI agents buying products and services in real-time
36+
- Pay-per-API-call data access at fractions of a cent
37+
- Pay-per-compute, storage, bandwidth request
38+
- High-frequency trading settlement
39+
40+
### Traditional Payments
41+
- High-frequency trading and settlement
42+
- Pay-per-use services and subscriptions
43+
- Real-time revenue sharing and splits
44+
45+
### Beyond Payments
46+
- Decentralized social networks and content systems
47+
- Gaming and virtual world state management
48+
- IoT sensor networks and data marketplaces
49+
- Identity and attestation systems
50+
51+
## Available Today
52+
53+
The Radius invite-only testnet launched in January 2025 with major stablecoin issuers and AI labs already onboard.
54+
Radius supports both simple payments and other EVM-compatible smart contracts, so developers can experience the
55+
efficiency of its parallel execution design.
56+
57+
The next trillion transactions won't come from humans typing on keyboards. They'll come from AI agents making
58+
split-second decisions. We're building the infrastructure necessary to make that future possible.
59+
60+
Ready to build the future? Start [here](https://docs.radiustech.xyz/radius-testnet-access).
61+
2962
## Contributing
3063

3164
We welcome contributions to all Radius SDKs! Please see:
@@ -37,9 +70,9 @@ We welcome contributions to all Radius SDKs! Please see:
3770
## Support
3871

3972
- [Website](https://radiustech.xyz/)
40-
- [Documentation](https://docs.radiustech.xyz/)
73+
- [Testnet Access](https://docs.radiustech.xyz/radius-testnet-access)
4174
- [GitHub Issues](https://github.com/radiustechsystems/sdk/issues)
4275

4376
## License
4477

45-
This SDK is released under the [MIT License](LICENSE).
78+
All Radius SDKs are released under the [MIT License](LICENSE).

go/README.md

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,87 @@
11
# Radius Go SDK
22

3-
A Go client library for interacting with the [Radius platform](https://radiustech.xyz/), providing a simple and
4-
idiomatic way to interact with Radius services.
3+
The official Go client library for interacting with the [Radius platform](https://radiustech.xyz/), providing a simple
4+
and idiomatic way to interact with Radius services.
55

66
## Features
77

88
- Account management and transaction signing
99
- Smart contract deployment and interaction
1010
- Optional request logging and interceptors
11-
- EVM compatibility with high performance
12-
- Comprehensive error handling
11+
- EVM compatibility with high performance & low latency
1312

1413
## Requirements
1514

16-
- Go 1.23.3 or higher
15+
- Go 1.13 or higher
16+
- Radius JSON-RPC endpoint: https://docs.radiustech.xyz/radius-testnet-access
17+
- Ethereum private key: https://ethereum.org/en/developers/docs/accounts/#account-creation
1718

1819
## Installation
1920

2021
```bash
2122
go get github.com/radiustechsystems/sdk/go
22-
go mod tidy
2323
```
2424

2525
## Quickstart Examples
2626

2727
### Connect to Radius and Create an Account
2828

29-
```go
30-
// Connect to Radius
31-
client, err := radius.NewClient("https://your-radius-endpoint")
32-
if err != nil {
33-
log.Fatal(err)
34-
}
29+
Be sure to use your own `RADIUS_ENDPOINT` and `PRIVATE_KEY` values, as mentioned in the [Requirements](#requirements).
3530

36-
// Create an account using a private key
37-
account := radius.NewAccount(
38-
radius.WithPrivateKeyHex("your-private-key", client),
31+
```go
32+
const (
33+
RADIUS_ENDPOINT = "https://rpc.testnet.tryradi.us/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
34+
PRIVATE_KEY = "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036415f";
3935
)
36+
37+
client, err := radius.NewClient(RADIUS_ENDPOINT)
38+
account := radius.NewAccount(radius.WithPrivateKeyHex(PRIVATE_KEY, client))
4039
```
4140

4241
### Transfer Value Between Accounts
4342

43+
Here, we send 100 tokens to another account. Be sure to replace the recipient's address with one of your own.
44+
4445
```go
4546
// Send 100 tokens to another account
46-
recipient, err := radius.AddressFromHex("0x...")
47+
recipient, err := radius.AddressFromHex("0x5e97870f263700f46aa00d967821199b9bc5a120") // Recipient's address
4748
amount := big.NewInt(100)
4849
receipt, err := account.Send(context.Background(), client, recipient, amount)
4950
if err != nil {
50-
log.Fatal(err)
51+
log.Fatal(err)
5152
}
5253

5354
log.Printf("Transaction hash: %s", receipt.TxHash.Hex())
5455
```
5556

5657
### Deploy a Smart Contract
5758

59+
Here, we deploy the [SimpleStorage.sol](https://github.com/radiustechsystems/sdk/tree/main/contracts/solidity)
60+
example contract included in this SDK, with the application binary interface (ABI) and bytecode that were generated
61+
using the Solidity compiler [solcjs](https://docs.soliditylang.org/en/latest/installing-solidity.html#npm-node-js).
62+
5863
```go
59-
// Parse ABI and bytecode
64+
// Parse ABI and bytecode of the SimpleStorage contract
6065
abi := radius.ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`)
61-
bytecode := radius.BytecodeFromHex("608060405234801561001057600080fd5b50610150806100...")
66+
bytecode := radius.BytecodeFromHex("6080604052348015600e575f5ffd5b5060a580601a5f395ff3fe6080604052348015600e575f5ffd5b50600436106030575f3560e01c806360fe47b11460345780636d4ce63c146045575b5f5ffd5b6043603f3660046059565b5f55565b005b5f5460405190815260200160405180910390f35b5f602082840312156068575f5ffd5b503591905056fea26469706673582212207655d86666fa8aa75666db8416e0f5db680914358a57e84aa369d9250218247f64736f6c634300081c0033")
6267

6368
// Deploy the contract
6469
contract, err := client.DeployContract(
65-
context.Background(),
66-
account.Signer(),
67-
bytecode,
68-
abi,
70+
context.Background(),
71+
account.Signer(),
72+
bytecode,
73+
abi,
6974
)
7075
```
7176

7277
### Interact with a Smart Contract
7378

79+
Assuming the contract was previously deployed (which is typically the case), we can interact with it using the contract
80+
address and ABI. Be sure to replace the contract address with that of your own deployed contract.
81+
7482
```go
75-
// Reference an existing contract
76-
address, err := radius.AddressFromHex("0x...")
83+
// Reference a previously deployed contract
84+
address, err := radius.AddressFromHex("0x5e97870f263700f46aa00d967821199b9bc5a120") // Contract address
7785
abi := radius.ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`)
7886
contract := radius.NewContract(address, abi)
7987

@@ -92,7 +100,7 @@ log.Printf("Stored value: %v", result[0])
92100

93101
```go
94102
type MyCustomSigner struct{
95-
// ...
103+
// ...
96104
}
97105
func (s *MyCustomSigner) Address() radius.Address { /* ... */ }
98106
func (s *MyCustomSigner) ChainID() *big.Int { /* ... */ }
@@ -108,25 +116,25 @@ customSignerAccount := radius.NewAccount(radius.WithSigner(customSigner))
108116

109117
```go
110118
client, err := radius.NewClient("https://your-radius-endpoint",
111-
radius.WithLogger(func(format string, args ...any) {
112-
log.Printf(format, args...)
113-
}),
114-
radius.WithInterceptor(func(reqBody string, resp *http.Response) (*http.Response, error) {
115-
// Examine request body, modify response, etc.
116-
return resp, nil
117-
}),
119+
radius.WithLogger(func(format string, args ...any) {
120+
log.Printf(format, args...)
121+
}),
122+
radius.WithInterceptor(func(reqBody string, resp *http.Response) (*http.Response, error) {
123+
// Examine request body, modify response, etc.
124+
return resp, nil
125+
}),
118126
)
119127
```
120128

121129
### Custom HTTP Client
122130

123131
```go
124132
httpClient := &http.Client{
125-
Timeout: time.Second * 30,
133+
Timeout: time.Second * 30,
126134
}
127135

128136
client, err := radius.NewClient("https://your-radius-endpoint",
129-
radius.WithHttpClient(httpClient),
137+
radius.WithHttpClient(httpClient),
130138
)
131139
```
132140

@@ -144,4 +152,4 @@ For repository-wide guidelines, see the [General Contributing Guide](../CONTRIBU
144152

145153
## License
146154

147-
This project is licensed under the [MIT License](../LICENSE).
155+
All Radius SDKs are released under the [MIT License](../LICENSE).

typescript/README.md

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# Radius TypeScript SDK
22

3-
A TypeScript client library for interacting with [Radius](https://radiustech.xyz/), providing a simple and type-safe
4-
way to interact with the Radius platform.
3+
The official TypeScript client library for interacting with the [Radius platform](https://radiustech.xyz/), providing
4+
a simple and idiomatic way to interact with Radius services.
55

66
## Features
77

88
- Account management and transaction signing
99
- Smart contract deployment and interaction
1010
- Optional request logging and interceptors
11-
- EVM compatibility with high performance
12-
- Type-safe contract interactions
11+
- EVM compatibility with high performance & low latency
1312

1413
## Requirements
1514

16-
- Node.js >= 20.12.2
15+
- Node.js >= 20.12
16+
- Radius JSON-RPC endpoint: https://docs.radiustech.xyz/radius-testnet-access
17+
- Ethereum private key: https://ethereum.org/en/developers/docs/accounts/#account-creation
1718

1819
## Installation
1920

@@ -32,58 +33,74 @@ yarn add @radiustechsystems/sdk
3233

3334
### Connect to Radius and Create an Account
3435

36+
Be sure to use your own `RADIUS_ENDPOINT` and `PRIVATE_KEY` values, as mentioned in the [Requirements](#requirements).
37+
3538
```typescript
36-
import { NewClient, NewAccount, withPrivateKey } from '@radiustechsystems/sdk';
39+
import { Account, Client, NewClient, NewAccount, withPrivateKey } from '@radiustechsystems/sdk';
40+
41+
const RADIUS_ENDPOINT = "https://rpc.testnet.tryradi.us/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
42+
const PRIVATE_KEY = "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036415f";
43+
44+
const client: Client = await NewClient(RADIUS_ENDPOINT);
45+
const account: Account = await NewAccount(withPrivateKey(PRIVATE_KEY, client));
46+
```
3747

38-
// Connect to Radius
39-
const client = await NewClient('https://your-radius-endpoint');
48+
Alternatively, using plain JavaScript and CommonJS `require` syntax:
4049

41-
// Create an account using a private key
42-
const account = await NewAccount(withPrivateKey('your-private-key', client));
50+
```javascript
51+
const { Account, Client, NewClient, NewAccount, withPrivateKey } = require('@radiustechsystems/sdk');
4352
```
4453

4554
### Transfer Value Between Accounts
4655

56+
Here, we send 100 tokens to another account. Be sure to replace the recipient's address with one of your own.
57+
4758
```typescript
48-
import { AddressFromHex } from '@radiustechsystems/sdk';
59+
import { Address, AddressFromHex, Receipt } from '@radiustechsystems/sdk';
4960

50-
// Send 100 tokens to another account
51-
const recipient = AddressFromHex('0x...');
52-
const amount = BigInt(100);
53-
const receipt = await account.send(client, recipient, amount);
61+
const recipient: Address = AddressFromHex('0x5e97870f263700f46aa00d967821199b9bc5a120'); // Recipient's address
62+
const amount: bigint = BigInt(100);
63+
const receipt: Receipt = await account.send(client, recipient, amount);
5464

5565
console.log('Transaction hash:', receipt.txHash.hex());
5666
```
5767

5868
### Deploy a Smart Contract
5969

70+
Here, we deploy the [SimpleStorage.sol](https://github.com/radiustechsystems/sdk/tree/main/contracts/solidity)
71+
example contract included in this SDK, with the application binary interface (ABI) and bytecode that were generated
72+
using the Solidity compiler [solcjs](https://docs.soliditylang.org/en/latest/installing-solidity.html#npm-node-js).
73+
6074
```typescript
61-
import { ABIFromJSON, BytecodeFromHex } from '@radiustechsystems/sdk';
75+
import { ABI, ABIFromJSON, BytecodeFromHex } from '@radiustechsystems/sdk';
6276

63-
// Parse ABI and bytecode
64-
const abi = ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`);
65-
const bytecode = BytecodeFromHex('608060405234801561001057600080fd5b50610150806100...');
77+
// Parse ABI and bytecode of the SimpleStorage contract
78+
const abi: ABI = ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`);
79+
const bytecode: Uint8Array = BytecodeFromHex('6080604052348015600e575f5ffd5b5060a580601a5f395ff3fe6080604052348015600e575f5ffd5b50600436106030575f3560e01c806360fe47b11460345780636d4ce63c146045575b5f5ffd5b6043603f3660046059565b5f55565b005b5f5460405190815260200160405180910390f35b5f602082840312156068575f5ffd5b503591905056fea26469706673582212207655d86666fa8aa75666db8416e0f5db680914358a57e84aa369d9250218247f64736f6c634300081c0033');
6680

6781
// Deploy the contract
6882
const contract = await client.deployContract(account.signer, bytecode, abi);
6983
```
7084

7185
### Interact with a Smart Contract
7286

87+
Assuming the contract was previously deployed (which is typically the case), we can interact with it using the contract
88+
address and ABI. Be sure to replace the contract address with that of your own deployed contract.
89+
7390
```typescript
74-
import { NewContract, AddressFromHex, ABIFromJSON } from '@radiustechsystems/sdk';
91+
import { ABI, Address, AddressFromHex, ABIFromJSON, Contract, NewContract, Receipt } from '@radiustechsystems/sdk';
7592

76-
// Reference an existing contract
77-
const address = AddressFromHex('0x...');
78-
const abi = ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`);
79-
const contract = NewContract(address, abi);
93+
// Reference a previously deployed contract
94+
const address: Address = AddressFromHex('0x5e97870f263700f46aa00d967821199b9bc5a120'); // Contract address
95+
const abi: ABI = ABIFromJSON(`[{"inputs":[],"name":"get","outputs":[{"type":"uint256"}],"type":"function"},{"inputs":[{"type":"uint256"}],"name":"set","type":"function"}]`);
96+
const contract: Contract = NewContract(address, abi);
8097

8198
// Write to the contract
82-
const value = BigInt(42);
83-
const receipt = await contract.execute(client, account.signer, 'set', value);
99+
const value: bigint = BigInt(42);
100+
const receipt: Receipt = await contract.execute(client, account.signer, 'set', value);
84101

85102
// Read from the contract
86-
const result = await contract.call(client, 'get');
103+
const result: unknown[] = await contract.call(client, 'get');
87104
console.log('Stored value:', result[0]);
88105
```
89106

@@ -148,4 +165,4 @@ SDK. For repository-wide guidelines, see the [General Contributing Guide](../CON
148165

149166
## License
150167

151-
This project is licensed under the [MIT License](../LICENSE).
168+
All Radius SDKs are released under the [MIT License](../LICENSE).

0 commit comments

Comments
 (0)