Use when the challenge involves cross-chain operations, chain signatures, NEAR intents, multi-chain interactions, or bridging assets between NEAR and other blockchains.
NEAR's MPC network allows a NEAR contract to sign transactions for other chains (Ethereum, Bitcoin, Solana, etc.) without bridges.
v1.signer-prod.testnetv1.signer.nearnear contract call-function as-read-only v1.signer-prod.testnet derived_public_key \
json-args '{"path":"ethereum-1","predecessor":"<your-account.testnet>"}' \
network-config testnet now
use near_sdk::{Promise, Gas, NearToken, env};
pub fn sign_payload(&self, payload: Vec<u8>, path: String) -> Promise {
let signer: AccountId = "v1.signer-prod.testnet".parse().unwrap();
Promise::new(signer).function_call(
"sign".to_string(),
serde_json::json!({
"request": {
"payload": payload,
"path": path,
"key_version": 0
}
}).to_string().into_bytes(),
NearToken::from_near(1), // deposit for MPC fee
Gas::from_tgas(250), // needs significant gas
)
}
Declarative approach: express WHAT you want, not HOW to execute it.
{
"intent_type": "swap",
"source": {
"chain": "near",
"token": "wrap.near",
"amount": "1000000000000000000000000"
},
"target": {
"chain": "ethereum",
"token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"min_amount": "500000000000000000"
},
"recipient": "0x1234...",
"deadline": 1708900000
}
#[near_bindgen]
impl IntentContract {
#[payable]
pub fn submit_intent(&mut self, intent: Intent) -> u64 {
let id = self.next_id;
self.next_id += 1;
self.intents.insert(id, IntentRecord {
creator: env::predecessor_account_id(),
intent,
status: IntentStatus::Open,
deposit: env::attached_deposit(),
created_at: env::block_timestamp(),
});
id
}
pub fn fulfill_intent(&mut self, intent_id: u64, proof: FulfillmentProof) -> Promise {
let record = self.intents.get_mut(&intent_id).expect("Not found");
assert_eq!(record.status, IntentStatus::Open, "Not open");
// Verify proof of cross-chain execution
record.status = IntentStatus::Fulfilled;
// Release deposit to solver
Promise::new(env::predecessor_account_id()).transfer(record.deposit)
}
}
| Resource | Address |
|---|---|
| MPC Signer | v1.signer-prod.testnet |
| Wrapped NEAR | wrap.testnet |
| NEAR Testnet RPC | https://rpc.testnet.near.org |
| NEAR Explorer | https://testnet.nearblocks.io |
If challenge involves agent-to-agent communication or payments:
If challenge involves running AI models:
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NEAR_AI_CLOUD_KEY" \
-d '{"model":"deepseek-ai/DeepSeek-V3.1","messages":[{"role":"user","content":"Analyze this data"}]}'
OpenAI-compatible. Use openai Python/JS SDK with base_url="https://cloud-api.near.ai/v1".
Available models: DeepSeek, Llama, OpenAI, Qwen. Runs in TEEs (Trusted Execution Environments).