# Upgrading a parachain in chopsticks You need to: 0) Run chopsticks with the relay chain and the parachain you want 1) Create an extrinsic on the parachain you want that's `system::authorizeUpgrade(hash)` with the hash of the new wasm. You can hash the file in the PJS Apps UI if needed 2) Create an extrinsic on the relay that's `xcmPallet::send()` that sends the following message to the parachain you want to upgrade: [UnpaidExecution, Transact(Superuser, enough_weight, call)] with the previous call 3) Note the preimage in the relay chain. Call `preimage::note_preimage(previous call)` 4) Use the following PJS script to make the scheduler dispatch that preimage: ```typescript import { ApiPromise, WsProvider } from '@polkadot/api'; const api = await ApiPromise.create({ provider: new WsProvider(<your websocket endpoint>) }); // get current block number. const number = (await api.rpc.chain.getHeader()).number.toNumber(); // use chopsticks dev_setStorage to inject the call into the scheduler state for the next block. await api.rpc('dev_setStorage', { scheduler: { agenda: [ [ [number + 1], [ { call: { Lookup: { hash: <preimage hash from step 3>, len: <preimage length from step 3 (not the hash length)> } }, origin: { system: 'Root' } } ] ] ] } }); // Make a block to include the extrinsic await api.rpc('dev_newBlock', { count: 1 }); ``` 5) Check that `system::authorizedUpgrade` has the hash you want. You can do that in PJS Apps -> Chain state 6) Call `system::applyAuthorizedUpgrade` with the wasm directly on the parachain 7) ??? 8) Profit